Jest
A JavaScript Testing Framework
jest.config.json
Validate
Check your file against this schema
Opens the validator with this schema already loaded. Paste your
jest.config.json and it validates in your browser — nothing is uploaded.
Reference
Fields
Generated directly from the schema, following local
$refs, to two levels of nesting.
| Field | Type | Description |
|---|---|---|
automock | boolean | 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. default: false |
bail | boolean | number | How many failures until jest stops running. Value of `true` is equivalent to 1. default: 0 |
cacheDirectory | string | The directory where Jest should store its cached dependency information. |
clearMocks | boolean | Whether to automatically clear mock calls and instances between every test. default: false |
collectCoverage | boolean | Whether to collect coverage information while executing the test default: false |
collectCoverageFrom | array<string> | An array of glob patterns indicating a set of files for which coverage information should be collected. |
coverageDirectory | string | The directory where Jest should output its coverage files. |
coveragePathIgnorePatterns | array<string> | An array of regexp pattern strings that will be ignored when calculating coverage default: ["/node_modules/"] |
coverageProvider | string | Indicates which provider should be used to instrument code for coverage. default: "babel"one of: "babel", "v8" |
coverageReporters | array | A list of reporter names that Jest uses when writing coverage reports. default: ["clover", "json", "lcov", "text"] |
coverageThreshold | object | An object that configures minimum threshold enforcement for coverage results. |
dependencyExtractor | string | Enable the use of a custom dependency extractor. |
displayName | oneOf | A custom label that is printed alongside a test while it is running. |
errorOnDeprecated | boolean | Whether calling deprecated APIs should throw an error. default: false |
extensionsToTreatAsEsm | array<string> | Files extensions that Jest should treat as ESM. default: [] |
fakeTimers | object | Customize the behavior of fake timers. default: {} |
forceCoverageMatch | array<string> | A list of regexp strings are added to code coverage; this overrides any previous ignored file patterns default: [""] |
globals | object | A set of global variables that need to be available in all test environments. default: {} |
globalSetup | string | Use a custom global setup module to setup the global environment. |
globalTeardown | string | Use a custom global teardown module to teardown the global environment. |
haste | object | Customize `jest-haste-map`, Jest's internal file crawler/cache system |
haste.computeSha1 | boolean | Whether to hash functions using SHA1 |
haste.defaultPlatform | string | null | The default platform |
haste.forceNodeFilesystemAPI | boolean | Whether to use Node's filesystem API instead of shelling out to `find` |
haste.enableSymlinks | boolean | Whether to follow symlinks when crawling the filesystem. This option cannot be used in projects that use watachman. |
haste.hasteImplModulePath | string | Path to a custom implementation of Haste. |
haste.platforms | array<string> | A list of platforms to target. |
haste.throwOnModuleCollision | boolean | Whether to throw an error on module collision |
haste.hasteMapModulePath | string | Path to a custom implementation of HasteMap. |
haste.retainAllFiles | boolean | Whether to retain all files, allowing e.g. search for tests in `node_modules`. |
injectGlobals | boolean | Whether to inject global variables into the global environment. Only supported if using the default `jest-circus` test runner. default: true |
maxConcurrency | number | 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. default: 5 |
maxWorkers | number | string | Specifies the maximum number of workers the worker-pool will spawn for running tests. |
moduleDirectories | array<string> | An array of directory names to be searched recursively up from the requiring module's location. default: ["node_modules"] |
moduleFileExtensions | array<string> | An array of file extensions your modules use. default: ["js", "mjs", "cjs", "jsx", "ts", "tsx", "json", "node"] |
moduleNameMapper | object | A map from regular expressions to module names that allow to stub out resources, like images or styles with a single module. |
modulePathIgnorePatterns | array<string> | 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. default: [] |
modulePaths | array<string> | An array of directory names that should be used when resolving modules. This is an alternative API to `NODE_PATH`. default: [] |
notify | boolean | Whether to use native OS notifications for test results. This requires the installation of the `node-notifier` package default: false |
notifyMode | string | Specifies when notifications should be triggered. default: "failure"one of: "always", "failure", "success", "change", "success-change", "failure-change" |
openHandlesTimeout | number | 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. default: 1000 |
preset | string | A preset that is used as a base for Jest's configuration. |
prettierPath | string | null | The path to a module that exports an object with a `format` method. |
projects | array<string> | Jest will run tests in all of these specified projects at the same time. |
randomize | boolean | Whether to randomize the order of the tests in a file. default: false |
reporters | array | A list of reporter names (and configuration) that Jest can use. default: ["default"] |
resetMocks | boolean | Automatically reset mock state before every test. default: false |
resetModules | boolean | 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 default: false |
resolver | string | Use a custom resolver. |
restoreMocks | boolean | Automatically restore mock state and implementation before every test. default: false |
rootDir | string | The root directory that Jest should scan for tests and modules within. |
roots | array<string> | A list of paths to directories that Jest should use to search for files in. default: ["<rootDir>"] |
runner | string | The test environment that will be used for testing. default: "jest-runner" |
extraGlobalsdeprecated | any | DEPRECATED. Renamed to `sandboxInjectedGlobals` in Jest 28 |
sandboxInjectedGlobals | array<string> | List of extra properties to be defined in the vm for faster lookups. |
setupFiles | array<string> | A list of paths to modules that run some code to configure or set up the testing environment. default: [] |
setupFilesAfterEnv | array<string> | 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. default: [] |
showSeed | boolean | Whether to print the seed in the test report summary. default: false |
slowTestThreshold | number | The number of seconds after which a test is considered as slow and reported as such in the results. default: 5 |
snapshotFormat | object | Allows overriding specific snapshot formatting options documented in the `pretty-format readme`. default: {"escapeString": false, "printBasicPrototype": false} |
snapshotResolver | string | The path to a module that can resolve test<->snapshot path. This config option lets you customize where Jest stores snapshot files on disk. |
snapshotSerializers | array<string> | A list of paths to snapshot serializer modules Jest should use for snapshot testing. default: [] |
testEnvironment | string | The test environment that will be used for testing. default: "node" |
testEnvironmentOptions | object | Options that will be passed to the `testEnvironment`. default: {} |
testFailureExitCode | number | Exit code of `jest` command if the test run failed. default: 1 |
testMatch | array<string> | The glob patterns Jest uses to detect test files. default: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?… |
testPathIgnorePatterns | array<string> | 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. default: ["/node_modules/"] |
testRegex | string | The pattern or patterns Jest uses to detect test files. default: "(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$" |
testResultsProcessor | string | Use a custom results processor. |
testRunner | string | Use a custom test runner. default: "jest-circus/runner" |
testSequencer | string | Use a custom test sequencer. default: "@jest/test-sequencer" |
testTimeout | number | Default timeout of a test in milliseconds. default: 5000 |
transform | object | A map from regular expressions to paths to transformers. |
transformIgnorePatterns | array<string> | 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. default: ["/node_modules/", "\\.pnp\\.[^\\/]+$"] |
unmockedModulePathPatterns | array<string> | 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 default: [] |
verbose | boolean | Indicates whether each individual test should be reported during the run. All errors will also still be shown on the bottom after execution. |
watchPathIgnorePatterns | array<string> | 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. default: [] |
watchPlugins | array<string> | Enable custom watch plugins default: [] |
watchman | boolean | Whether to use `watchman` for file crawling. default: true |
workerIdleMemoryLimit | number | string | Specifies the memory limit for workers before they are recycled. |
// | string | Comment |
workerThreads | boolean | Whether to use worker threads for parallelization. Child processes are used by default. default: false |
Audit
What we found in this schema
- Declared draft: draft-07
- Validates cleanly against its own meta-schema.
- Uses non-standard keywords that generic validators ignore:
annotations. - 82 properties, 100% carrying a description, max nesting depth 8.
Standards
Specification sections for the keywords in this schema
| Keyword | Document | Section |
|---|---|---|
$id | JSON Schema Core, draft 2020-12 | §8.2.1 — The "$id" Keyword |
$schema | JSON Schema Core, draft 2020-12 | §8.1.1 — "$schema" |
additionalProperties | JSON Schema Core, draft 2020-12 | §10.3.2.3 — "additionalProperties" |
anyOf | JSON Schema Core, draft 2020-12 | §10.2.1.2 — "anyOf" |
default | JSON Schema Validation, draft 2020-12 | §9.2 — "default" |
description | JSON Schema Validation, draft 2020-12 | §9.1 — "title" and "description" |
enum | JSON Schema Validation, draft 2020-12 | §6.1.2 — "enum" |
examples | JSON Schema Validation, draft 2020-12 | §9.5 — "examples" |
items | JSON Schema Core, draft 2020-12 | §10.3.1.2 — "items" |
properties | JSON Schema Core, draft 2020-12 | §10.3.2.1 — "properties" |
type | JSON Schema Validation, draft 2020-12 | §6.1.1 — "type" |
Documents
- JSON Schema Core, draft 2020-12 — JSON Schema: A Media Type for Describing JSON Documents, A. Wright, H. Andrews, B. Hutton, G. Dennis, Eds., 2022. draft-bhutton-json-schema-01. An expired Internet-Draft with no formal standing in the IETF standards process; it is nonetheless the specification of record for JSON Schema 2020-12, published by json-schema.org.
- JSON Schema Validation, draft 2020-12 — JSON Schema Validation: A Vocabulary for Structural Validation of JSON, A. Wright, H. Andrews, B. Hutton, Eds., 2022.
- RFC 8259 (STD 90) — The JavaScript Object Notation (JSON) Data Interchange Format, T. Bray, Ed., 2017. The format a schema describes.
- RFC 6901 — JavaScript Object Notation (JSON) Pointer. Defines the pointer syntax used by $ref fragments and the ~0 / ~1 escapes.
Source
Attribution
This schema comes from SchemaStore, distributed under the Apache License 2.0. Copyright 2015–present Mads Kristensen and contributors. View the original file. The field table and audit on this page are generated by JSONTools.tools; the schema itself is unmodified.