CLM-0001
Mock functions are also known as "spies", because they let you observe a function that other code calls indirectly.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/MockFunctionAPI.md 1 verified Re-check this claim
CLM-0002
You create a mock function with jest.fn().https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/MockFunctionAPI.md 1 verified Re-check this claim
CLM-0003
Without an implementation, a mock function created with jest.fn() returns undefined when invoked.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/MockFunctionAPI.md 1 verified Re-check this claim
CLM-0004
mockFn.getMockImplementation() returns the implementation set by mockImplementation(), or undefined if none has been set.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/MockFunctionAPI.md 1 verified Re-check this claim
CLM-0005
mockFn.mock.calls is an array with one entry per call, and each entry is the array of arguments for that call.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/MockFunctionAPI.md 1 verified Re-check this claim
CLM-0006
mockFn.withImplementation works whether or not the callback is asynchronous.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/MockFunctionAPI.md 1 verified Re-check this claim
CLM-0007
For an async callback, mockFn.withImplementation returns a promise, and awaiting that promise awaits the callback and resets the implementation.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/MockFunctionAPI.md 1 verified Re-check this claim
CLM-0008
replacedProperty.restore() only works when the property was replaced with jest.replaceProperty().https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/MockFunctionAPI.md 1 verified Re-check this claim
CLM-0009
The restoreMocks configuration option can restore replaced properties automatically before each test.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/MockFunctionAPI.md 1 verified Re-check this claim
CLM-0010
The jest object is automatically in scope in every test file.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/JestObjectAPI.md 1 verified Re-check this claim
CLM-0011
The jest object can be imported explicitly with import {jest} from '@jest/globals'.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/JestObjectAPI.md 1 verified Re-check this claim
CLM-0012
Modules mocked with jest.mock are mocked only for the file that calls jest.mock.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/JestObjectAPI.md 1 verified Re-check this claim
CLM-0013
Another file importing a module mocked with jest.mock in a different file gets the original implementation.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/JestObjectAPI.md 1 verified Re-check this claim
CLM-0014
jest.setTimeout(timeout) sets the default timeout for all tests and hooks in the calling test file only.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/JestObjectAPI.md 1 verified Re-check this claim
CLM-0015
The default timeout is 5 seconds if jest.setTimeout(timeout) is not called.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/JestObjectAPI.md 1 verified Re-check this claim
CLM-0016
jest.retryTimes() must be declared at the top level of a test file or in a describe block.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/JestObjectAPI.md 1 verified Re-check this claim
CLM-0017
jest.retryTimes() is only available with the default jest-circus runner.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/JestObjectAPI.md 1 verified Re-check this claim
CLM-0018
expect is used together with a matcher function to assert something about a value.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0019
expect(bestLaCroixFlavor()).toBe('grapefruit') uses toBe as the matcher.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0020
.not tests the opposite of a matcher.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0021
A custom matcher returns an object (or a Promise of one) with pass and message.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0022
In a custom matcher's return object, message is a function with no arguments that returns the error message.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0023
Inside a custom matcher, this.isNot indicates the matcher was called with .not.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0024
Inside a custom matcher, this.promise is 'rejects', 'resolves', or ''.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0025
toHaveProperty(keyPath, value?) checks whether a property exists at keyPath.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0026
In toHaveProperty(keyPath, value?), deep references can use dot notation or an array.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0027
In toHaveProperty(keyPath, value?), an optional value is compared with deep equality.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ExpectAPI.md 1 verified Re-check this claim
CLM-0028
The Jest 30 upgrade guide says all alias matcher names were removed in favor of their primary names.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/UpgradingToJest30.md 1 verified Re-check this claim
CLM-0029
automock defaults to false.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0030
When automock is enabled, all modules used in tests are mocked automatically.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/JestObjectAPI.md 0.9 verified Re-check this claim
CLM-0031
resetMocks defaults to false.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0032
resetMocks is equivalent to calling jest.resetAllMocks() before each test.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0033
resetMocks removes fake implementations but does not restore the initial implementation.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0034
restoreMocks defaults to false.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0035
restoreMocks is equivalent to calling jest.restoreAllMocks() before each test.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0036
restoreMocks removes fake implementations and restores the initial implementation.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0037
resetModules defaults to false.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0038
By default each test file gets its own module registry.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0039
Enabling resetModules resets the module registry before each individual test.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0040
globals defaults to {}.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0041
globals must be JSON-serializable, so it cannot specify global functions.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0042
globalSetup must export a function (sync or async) that runs once before all test files.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0043
The function exported by globalSetup receives globalConfig and projectConfig.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0044
Globals defined in globalSetup can only be read in globalTeardown.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0045
watchman defaults to true.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0046
workerGracefulExitTimeout defaults to 500.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0047
For the node environment, testEnvironmentOptions.globalsCleanup accepts 'on', 'soft' or 'off'.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0048
The default for testEnvironmentOptions.globalsCleanup is 'soft', which keeps the properties but emits a JEST-01 deprecation warning on access.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/Configuration.md 1 verified Re-check this claim
CLM-0049
Every configuration option can also be specified through the CLI.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CLI.md 1 verified Re-check this claim
CLM-0050
CLI options take precedence over configuration values.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CLI.md 1 verified Re-check this claim
CLM-0051
Jest accepts both camelCase and dashed argument formats, for example --collect-coverage and --collectCoverage.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CLI.md 1 verified Re-check this claim
CLM-0052
--maxWorkers defaults in single-run mode to the number of available cores minus one.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CLI.md 1 verified Re-check this claim
CLM-0053
In watch mode --maxWorkers defaults to half of the available cores.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CLI.md 1 verified Re-check this claim
CLM-0054
Percentages such as --maxWorkers=50% are supported for --maxWorkers.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CLI.md 1 verified Re-check this claim
CLM-0055
--watch reruns tests related to changed files, while --watchAll reruns all tests.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CLI.md 1 verified Re-check this claim
CLM-0056
--workerThreads uses worker threads instead of child processes, which are the default.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CLI.md 1 verified Re-check this claim
CLM-0057
--workerThreads is documented as an experimental feature.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CLI.md 1 verified Re-check this claim
CLM-0058
A snapshot test compares the rendered output to a reference snapshot stored alongside the test.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/SnapshotTesting.md 1 verified Re-check this claim
CLM-0059
A snapshot test fails if the rendered output and reference snapshot do not match.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/SnapshotTesting.md 1 verified Re-check this claim
CLM-0060
jest --updateSnapshot (or -u) regenerates snapshots for failing snapshot tests.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/SnapshotTesting.md 1 verified Re-check this claim
CLM-0061
--testNamePattern limits which snapshots are re-recorded.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/SnapshotTesting.md 1 verified Re-check this claim
CLM-0062
As of Jest 20, snapshots are not automatically written on CI unless --updateSnapshot is passed explicitly.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/SnapshotTesting.md 1 verified Re-check this claim
CLM-0063
Snapshot files should be committed alongside the modules they cover and their tests.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/SnapshotTesting.md 1 verified Re-check this claim
CLM-0064
Jest ships with one transformer, babel-jest.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CodeTransformation.md 1 verified Re-check this claim
CLM-0065
babel-jest transforms files matching /\.[jt]sx?$/ and injects the Babel plugin needed for mock hoisting.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CodeTransformation.md 1 verified Re-check this claim
CLM-0066
Specifying excludeJestPreset: true for babel-jest stops jest.mock hoisting, which may break tests.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CodeTransformation.md 1 verified Re-check this claim
CLM-0067
If you want the default babel-jest alongside other preprocessors, include it explicitly in transform.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CodeTransformation.md 1 verified Re-check this claim
CLM-0068
Jest caches transformation results and attempts to invalidate them based on factors such as the file source and changed configuration.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/CodeTransformation.md 1 verified Re-check this claim
CLM-0069
Jest's ESM support is experimental.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ECMAScriptModules.md 1 verified Re-check this claim
CLM-0070
Enabling Jest's ESM support requires running node with --experimental-vm-modules and either disabling code transforms or configuring the transformer to emit ESM.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ECMAScriptModules.md 1 verified Re-check this claim
CLM-0071
In ESM, import jest from @jest/globals or use import.meta.jest.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ECMAScriptModules.md 1 verified Re-check this claim
CLM-0072
jest.mock hoisting does not work for ESM, because static imports are evaluated before code runs.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ECMAScriptModules.md 1 verified Re-check this claim
CLM-0073
ESM mocking goes through jest.unstable_mockModule, which is still work in progress.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ECMAScriptModules.md 1 verified Re-check this claim
CLM-0074
On Node v24.9 and later, Jest supports require() of an ES module from CJS code.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/ECMAScriptModules.md 1 verified Re-check this claim
CLM-0075
Jest 30 drops Node 14, 16, 19 and 21, with 18.x as the minimum.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/UpgradingToJest30.md 1 verified Re-check this claim
CLM-0076
Jest 30 requires TypeScript 5.4 or newer.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/UpgradingToJest30.md 1 verified Re-check this claim
CLM-0077
Jest 30 uses JSDOM v26 in jest-environment-jsdom.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/UpgradingToJest30.md 1 verified Re-check this claim
CLM-0078
Jest 29 changed the default snapshot formatting to {escapeString: false, printBasicPrototype: false}.https://github.com/jestjs/jest/blob/aa88f7cf0bfc7a3a2efbfcab97914886b22d4454/docs/UpgradingToJest29.md 1 verified Re-check this claim