Jest
A JavaScript Testing Framework
| Type | object |
|---|---|
| File match |
jest.config.json
|
| Schema URL | https://catalog.lintel.tools/schemas/schemastore/jest/latest.json |
| Source | https://www.schemastore.org/jest.json |
Validate with Lintel
npx @lintel/lintel check
Properties
Whether all imported modules in your tests should be mocked automatically. All modules used in your tests will have a replacement implementation, keeping the API surface.
How many failures until jest stops running. Value of true is equivalent to 1.
The directory where Jest should store its cached dependency information.
Whether to automatically clear mock calls and instances between every test.
Whether to collect coverage information while executing the test
An array of glob patterns indicating a set of files for which coverage information should be collected.
The directory where Jest should output its coverage files.
An array of regexp pattern strings that will be ignored when calculating coverage
[
"/node_modules/"
]
Indicates which provider should be used to instrument code for coverage.
A list of reporter names that Jest uses when writing coverage reports.
[
"clover",
"json",
"lcov",
"text"
]
An object that configures minimum threshold enforcement for coverage results.
Enable the use of a custom dependency extractor.
A custom label that is printed alongside a test while it is running.
Whether calling deprecated APIs should throw an error.
Files extensions that Jest should treat as ESM.
[]
Customize the behavior of fake timers.
{}
A list of regexp strings are added to code coverage; this overrides any previous ignored file patterns
[
""
]
A set of global variables that need to be available in all test environments.
{}
Use a custom global setup module to setup the global environment.
Use a custom global teardown module to teardown the global environment.
Customize jest-haste-map, Jest's internal file crawler/cache system
9 nested properties
Whether to hash functions using SHA1
The default platform
Whether to use Node's filesystem API instead of shelling out to find
Whether to follow symlinks when crawling the filesystem. This option cannot be used in projects that use watachman.
Path to a custom implementation of Haste.
A list of platforms to target.
Whether to throw an error on module collision
Path to a custom implementation of HasteMap.
Whether to retain all files, allowing e.g. search for tests in node_modules.
Whether to inject global variables into the global environment. Only supported if using the default jest-circus test runner.
A number limiting the number of tests that are allowed to run at the same time when using test.concurrent. Any test above this limit will be queued and executed once a slot is released.
Specifies the maximum number of workers the worker-pool will spawn for running tests.
An array of directory names to be searched recursively up from the requiring module's location.
[
"node_modules"
]
An array of file extensions your modules use.
[
"js",
"mjs",
"cjs",
"jsx",
"ts",
"tsx",
"json",
"node"
]
A map from regular expressions to module names that allow to stub out resources, like images or styles with a single module.
An array of regexp pattern strings that are matched against all module paths before those paths are to be considered 'visible' to the module loader.
[]
An array of directory names that should be used when resolving modules. This is an alternative API to NODE_PATH.
[]
Whether to use native OS notifications for test results. This requires the installation of the node-notifier package
Specifies when notifications should be triggered.
Print a warning indicating that there are probable open handles if Jest does not exit cleanly this number of milliseconds after it completes. Use 0 to disable the warning.
A preset that is used as a base for Jest's configuration.
The path to a module that exports an object with a format method.
Jest will run tests in all of these specified projects at the same time.
Whether to randomize the order of the tests in a file.
A list of reporter names (and configuration) that Jest can use.
[
"default"
]
Automatically reset mock state before every test.
By default, each test file gets its own independent module registry. Setting this option to true resets the module registry before running each individual tes
Use a custom resolver.
Automatically restore mock state and implementation before every test.
The root directory that Jest should scan for tests and modules within.
A list of paths to directories that Jest should use to search for files in.
[
"<rootDir>"
]
The test environment that will be used for testing.
DEPRECATED. Renamed to sandboxInjectedGlobals in Jest 28
List of extra properties to be defined in the vm for faster lookups.
A list of paths to modules that run some code to configure or set up the testing environment.
[]
A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed.
[]
Whether to print the seed in the test report summary.
The number of seconds after which a test is considered as slow and reported as such in the results.
Allows overriding specific snapshot formatting options documented in the pretty-format readme.
{
"escapeString": false,
"printBasicPrototype": false
}
The path to a module that can resolve test<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk.
A list of paths to snapshot serializer modules Jest should use for snapshot testing.
[]
The test environment that will be used for testing.
Options that will be passed to the testEnvironment.
{}
Exit code of jest command if the test run failed.
The glob patterns Jest uses to detect test files.
[
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[jt]s?(x)"
]
An array of regexp pattern strings that are matched against all test paths before executing the test. If the test path matches any of the patterns, it will be skipped.
[
"/node_modules/"
]
The pattern or patterns Jest uses to detect test files.
Use a custom results processor.
Use a custom test runner.
Use a custom test sequencer.
Default timeout of a test in milliseconds.
A map from regular expressions to paths to transformers.
An array of regexp pattern strings that are matched against all source file paths before transformation. If the file path matches any of the patterns, it will not be transformed.
[
"/node_modules/",
"\\.pnp\\.[^\\/]+$"
]
An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them. If a module's path matches any of the patterns in this list, it will not be automatically mocked by the module loader.
[]
Indicates whether each individual test should be reported during the run. All errors will also still be shown on the bottom after execution.
An array of RegExp patterns that are matched against all source file paths before re-running tests in watch mode. If the file path matches any of the patterns, when it is updated, it will not trigger a re-run of tests.
[]
Enable custom watch plugins
[]
Whether to use watchman for file crawling.
Specifies the memory limit for workers before they are recycled.
Comment
Whether to use worker threads for parallelization. Child processes are used by default.