Jest
Dev ToolsDelightful JavaScript Testing.
Release History
v30.2.02 fixes1 featureJest adds JSDOM v27 support and includes bug fixes such as exporting the TransformerConfig interface and improving TS loader handling in jest.config.ts.
v30.1.31 fixThis release fixes the unstable_mockModule handling of node-prefixed core modules.
v30.1.21 fixFixed snapshot header regexp in jest-snapshot-utils to work with newline characters across OSes.
v30.1.11 fixThis release fixes a deprecated goo.gl snapshot warning issue on Windows.
v30.1.04 fixes3 featuresThis release adds configurable GC aggressiveness, reduces redundant ReferenceError messages, improves failure reporting for onlyFailures mode, and fixes several snapshot, concurrency, and import path issues.
v30.0.22 fixesThis patch release fixes two issues: it hardens deepCyclicCopyObject in jest-matcher-utils and makes the garbage collection protection property writable.
v30.0.12 fixes1 featureThis release adds the new `defaultAsyncResolver`, fixes builtin module resolution and globals cleanup handling, and deprecates the `jest-repl` package.
v30.0.0Breaking1 fix33 featuresJest 30 is a substantial major release after a three-year gap, introducing numerous features like new matchers, improved configuration loading for TypeScript modules (mts/cts), and significant internal upgrades to JSDOM and fake timers. Users must consult the migration guide due to several breaking API changes.
v30.0.0-beta.41 featureJest v30.0.0-beta.4 introduces a runtime improvement by switching to `compileFunction` over `new Script`.
v30.0.0-beta.3Breaking11 fixes1 featureJest 30 drops Node 16 support, updates jsdom to v26, mitigates memory leaks, and introduces a new ArrayOf matcher while fixing numerous bugs.
v30.0.0-alpha.7Breaking4 fixes5 featuresJest v30.0.0-alpha.7 adds new CLI and runtime features, upgrades key dependencies, and includes several bug fixes, while also introducing breaking changes to fake‑timer handling and config option types.
Common Errors
ValueHavingError2 reportsThe "ValueHavingError" error in Jest often arises when comparing error objects, particularly when the error's properties like `cause` (or other custom properties) are not directly comparable using Jest's default equality checks. To fix this, use `.toThrowError(Error)` or `.toThrow(Error)` to check the error type, and then assert on specific error properties (like `cause`, `message`, or custom properties) using `.expect(thrownError.cause).toBe(...)` or `.expect(thrownError.message).toContain(...)` for a more granular comparison. Alternatively, consider writing a custom matcher for more complex error comparisons if needed.
JestAssertionError2 reportsJestAssertionError usually arises from mismatches between expected and actual outcomes in Jest's `expect` assertions, particularly when custom error classes or the `Error#cause` property are involved. To fix it, ensure your assertions accurately reflect the error message or properties being tested, and consider explicitly checking the `Error#cause` if it's relevant to your test's expectations by accessing the `cause` property of the error. If you are using custom error classes, export JestAssertionError from expect so that it can be extended.
IllegalArgumentException1 reportThe "IllegalArgumentException" in Jest coverage often arises from incorrect or circular references within your code, especially in complex class structures or when using decorators. Review your code for circular dependencies, incorrect class inheritance, or improperly used decorators, and refactor to eliminate these problematic references to ensure Jest can correctly traverse and analyze your codebase. Specifically, pay close attention to how classes are imported and extended, and simplify circular dependency chains.
AggregateError1 reportAggregateError in Jest usually indicates multiple unhandled promise rejections or exceptions occurring concurrently within a test case or test suite. To fix it, ensure all promises have proper `.catch()` handlers or use `try...catch` blocks around asynchronous operations, and verify that `async` functions always handle potential errors to prevent uncaught exceptions from propagating up and being aggregated.
Related Dev Tools Packages
Empowering everyone to build reliable and efficient software.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
Next generation frontend tooling. It's fast!
An extremely fast Python package and project manager, written in Rust.
A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.
Subscribe to Updates
Get notified when new versions are released