Skip to content

Commit 0eecf27

Browse files
timReynoldsFacebook Github Bot 7
authored andcommitted
Added brief discription about how config is passed to jest
Summary:Added a description to the API docs about how configuration is passed to jest, issue jestjs#876. Closes jestjs#877 Differential Revision: D3165851 fb-gh-sync-id: 84f47776d28499892cc6adb3ee4960604651fd2b fbshipit-source-id: 84f47776d28499892cc6adb3ee4960604651fd2b
1 parent 64b0edd commit 0eecf27

File tree

5 files changed

+121
-98
lines changed

5 files changed

+121
-98
lines changed

README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -271,33 +271,33 @@ Jest uses Jasmine 2 by default. An introduction to Jasmine 2 can be found
271271

272272
#### Config options
273273

274-
- [`config.automock` [boolean]](https://facebook.github.io/jest/docs/api.html#config-automock-boolean)
275-
- [`config.bail` [boolean]](https://facebook.github.io/jest/docs/api.html#config-bail-boolean)
276-
- [`config.cache` [boolean]](https://facebook.github.io/jest/docs/api.html#config-cache-boolean)
277-
- [`config.cacheDirectory` [string]](https://facebook.github.io/jest/docs/api.html#config-cachedirectory-string)
278-
- [`config.collectCoverage` [boolean]](https://facebook.github.io/jest/docs/api.html#config-collectcoverage-boolean)
279-
- [`config.collectCoverageOnlyFrom` [object]](https://facebook.github.io/jest/docs/api.html#config-collectcoverageonlyfrom-object)
280-
- [`config.globals` [object]](https://facebook.github.io/jest/docs/api.html#config-globals-object)
281-
- [`config.mocksPattern` [string]](https://facebook.github.io/jest/docs/api.html#config-mockspattern-string)
282-
- [`config.moduleFileExtensions` [array<string>]](https://facebook.github.io/jest/docs/api.html#config-modulefileextensions-array-string)
283-
- [`config.moduleNameMapper` [object<string, string>]](https://facebook.github.io/jest/docs/api.html#config-modulenamemapper-object-string-string)
284-
- [`config.modulePathIgnorePatterns` [array<string>]](https://facebook.github.io/jest/docs/api.html#config-modulepathignorepatterns-array-string)
285-
- [`config.preprocessCachingDisabled` [boolean]](https://facebook.github.io/jest/docs/api.html#config-preprocesscachingdisabled-boolean)
286-
- [`config.preprocessorIgnorePatterns` [array<string>]](https://facebook.github.io/jest/docs/api.html#config-preprocessorignorepatterns-array-string)
287-
- [`config.rootDir` [string]](https://facebook.github.io/jest/docs/api.html#config-rootdir-string)
288-
- [`config.scriptPreprocessor` [string]](https://facebook.github.io/jest/docs/api.html#config-scriptpreprocessor-string)
289-
- [`config.setupFiles` [array]](https://facebook.github.io/jest/docs/api.html#config-setupfiles-array)
290-
- [`config.setupTestFrameworkScriptFile` [string]](https://facebook.github.io/jest/docs/api.html#config-setuptestframeworkscriptfile-string)
291-
- [`config.testDirectoryName` [string]](https://facebook.github.io/jest/docs/api.html#config-testdirectoryname-string)
292-
- [`config.testFileExtensions` [array<string>]](https://facebook.github.io/jest/docs/api.html#config-testfileextensions-array-string)
293-
- [`config.testPathDirs` [array<string>]](https://facebook.github.io/jest/docs/api.html#config-testpathdirs-array-string)
294-
- [`config.testPathIgnorePatterns` [array<string>]](https://facebook.github.io/jest/docs/api.html#config-testpathignorepatterns-array-string)
295-
- [`config.testPathPattern` [string]](https://facebook.github.io/jest/docs/api.html#config-testpathpattern-string)
296-
- [`config.testResultsProcessor` [string]](https://facebook.github.io/jest/docs/api.html#config-testresultsprocessor-string)
297-
- [`config.testRunner` [string]](https://facebook.github.io/jest/docs/api.html#config-testrunner-string)
298-
- [`config.unmockedModulePathPatterns` [array<string>]](https://facebook.github.io/jest/docs/api.html#config-unmockedmodulepathpatterns-array-string)
299-
- [`config.verbose` [boolean]](https://facebook.github.io/jest/docs/api.html#config-verbose-boolean)
300-
- [`config.watchman` [boolean]](https://facebook.github.io/jest/docs/api.html#config-watchman-boolean)
274+
- [`config.automock` [boolean]](https://facebook.github.io/jest/docs/api.html#automock-boolean)
275+
- [`config.bail` [boolean]](https://facebook.github.io/jest/docs/api.html#bail-boolean)
276+
- [`config.cache` [boolean]](https://facebook.github.io/jest/docs/api.html#cache-boolean)
277+
- [`config.cacheDirectory` [string]](https://facebook.github.io/jest/docs/api.html#cachedirectory-string)
278+
- [`config.collectCoverage` [boolean]](https://facebook.github.io/jest/docs/api.html#collectcoverage-boolean)
279+
- [`config.collectCoverageOnlyFrom` [object]](https://facebook.github.io/jest/docs/api.html#collectcoverageonlyfrom-object)
280+
- [`config.globals` [object]](https://facebook.github.io/jest/docs/api.html#globals-object)
281+
- [`config.mocksPattern` [string]](https://facebook.github.io/jest/docs/api.html#mockspattern-string)
282+
- [`config.moduleFileExtensions` [array<string>]](https://facebook.github.io/jest/docs/api.html#modulefileextensions-array-string)
283+
- [`config.moduleNameMapper` [object<string, string>]](https://facebook.github.io/jest/docs/api.html#modulenamemapper-object-string-string)
284+
- [`config.modulePathIgnorePatterns` [array<string>]](https://facebook.github.io/jest/docs/api.html#modulepathignorepatterns-array-string)
285+
- [`config.preprocessCachingDisabled` [boolean]](https://facebook.github.io/jest/docs/api.html#preprocesscachingdisabled-boolean)
286+
- [`config.preprocessorIgnorePatterns` [array<string>]](https://facebook.github.io/jest/docs/api.html#preprocessorignorepatterns-array-string)
287+
- [`config.rootDir` [string]](https://facebook.github.io/jest/docs/api.html#rootdir-string)
288+
- [`config.scriptPreprocessor` [string]](https://facebook.github.io/jest/docs/api.html#scriptpreprocessor-string)
289+
- [`config.setupFiles` [array]](https://facebook.github.io/jest/docs/api.html#setupfiles-array)
290+
- [`config.setupTestFrameworkScriptFile` [string]](https://facebook.github.io/jest/docs/api.html#setuptestframeworkscriptfile-string)
291+
- [`config.testDirectoryName` [string]](https://facebook.github.io/jest/docs/api.html#testdirectoryname-string)
292+
- [`config.testFileExtensions` [array<string>]](https://facebook.github.io/jest/docs/api.html#testfileextensions-array-string)
293+
- [`config.testPathDirs` [array<string>]](https://facebook.github.io/jest/docs/api.html#testpathdirs-array-string)
294+
- [`config.testPathIgnorePatterns` [array<string>]](https://facebook.github.io/jest/docs/api.html#testpathignorepatterns-array-string)
295+
- [`config.testPathPattern` [string]](https://facebook.github.io/jest/docs/api.html#testpathpattern-string)
296+
- [`config.testResultsProcessor` [string]](https://facebook.github.io/jest/docs/api.html#testresultsprocessor-string)
297+
- [`config.testRunner` [string]](https://facebook.github.io/jest/docs/api.html#testrunner-string)
298+
- [`config.unmockedModulePathPatterns` [array<string>]](https://facebook.github.io/jest/docs/api.html#unmockedmodulepathpatterns-array-string)
299+
- [`config.verbose` [boolean]](https://facebook.github.io/jest/docs/api.html#verbose-boolean)
300+
- [`config.watchman` [boolean]](https://facebook.github.io/jest/docs/api.html#watchman-boolean)
301301

302302
#### Globally injected variables
303303

@@ -644,7 +644,7 @@ An array of regexp pattern strings that are matched against all module paths bef
644644

645645
A map from regular expressions to module names that allow to stub out resources, like images or styles with a single module.
646646

647-
Use `<rootDir>` string token to refer to [`config.rootDir`](https://facebook.github.io/jest/docs/api.html#config-rootdir-string) value if you want to use file paths.
647+
Use `<rootDir>` string token to refer to [`config.rootDir`](https://facebook.github.io/jest/docs/api.html#rootdir-string) value if you want to use file paths.
648648

649649
Additionally, you can substitute captured regex groups using numbered backreferences.
650650

@@ -669,7 +669,7 @@ The root directory that Jest should scan for tests and modules within. If you pu
669669

670670
Oftentimes, you'll want to set this to `'src'` or `'lib'`, corresponding to where in your repository the code is stored.
671671

672-
*Note that using `'<rootDir>'` as a string token in any other path-based config settings to refer back to this value. So, for example, if you want your [`config.setupFiles`](https://facebook.github.io/jest/docs/api.html#config-setupfiles-array) config entry to point at the `env-setup.js` file at the root of your project, you could set its value to `['<rootDir>/env-setup.js']`.*
672+
*Note that using `'<rootDir>'` as a string token in any other path-based config settings to refer back to this value. So, for example, if you want your [`config.setupFiles`](https://facebook.github.io/jest/docs/api.html#setupfiles-array) config entry to point at the `env-setup.js` file at the root of your project, you could set its value to `['<rootDir>/env-setup.js']`.*
673673

674674
### `config.scriptPreprocessor` [string]
675675
(default: `undefined`)
@@ -692,12 +692,12 @@ An array of regexp pattern strings that are matched against all source file path
692692

693693
The paths to modules that run some code to configure or set up the testing environment before each test. Since every test runs in it's own environment, these scripts will be executed in the testing environment immediately before executing the test code itself.
694694

695-
It's worth noting that this code will execute *before* [`config.setupTestFrameworkScriptFile`](https://facebook.github.io/jest/docs/api.html#config-setuptestframeworkscriptfile-string).
695+
It's worth noting that this code will execute *before* [`config.setupTestFrameworkScriptFile`](https://facebook.github.io/jest/docs/api.html#setuptestframeworkscriptfile-string).
696696

697697
### `config.setupTestFrameworkScriptFile` [string]
698698
(default: `undefined`)
699699

700-
The path to a module that runs some code to configure or set up the testing framework before each test. Since [`config.setupFiles`](https://facebook.github.io/jest/docs/api.html#config-setupfiles-array) executes before the test framework is installed in the environment, this script file presents you the opportunity of running some code immediately after the test framework has been installed in the environment.
700+
The path to a module that runs some code to configure or set up the testing framework before each test. Since [`config.setupFiles`](https://facebook.github.io/jest/docs/api.html#setupfiles-array) executes before the test framework is installed in the environment, this script file presents you the opportunity of running some code immediately after the test framework has been installed in the environment.
701701

702702
For example, Jest ships with several plug-ins to `jasmine` that work by monkey-patching the jasmine API. If you wanted to add even more jasmine plugins to the mix (or if you wanted some custom, project-wide matchers for example), you could do so in this module.
703703

@@ -713,7 +713,7 @@ For example, many node projects prefer to put their tests in a `tests` directory
713713

714714
An array of file extensions that test files might have. Jest uses this when searching for tests to run.
715715

716-
This is useful if, for example, you are writting test files using TypeScript with a `.ts` file extension. In such a scenario, Use `['js', 'ts']` to make Jest find files that end in both `.js` and `.ts`. (Don't forget to set up a TypeScript pre-processor using [`config.scriptPreprocessor`](https://facebook.github.io/jest/docs/api.html#config-scriptpreprocessor-string) too!)
716+
This is useful if, for example, you are writting test files using TypeScript with a `.ts` file extension. In such a scenario, Use `['js', 'ts']` to make Jest find files that end in both `.js` and `.ts`. (Don't forget to set up a TypeScript pre-processor using [`config.scriptPreprocessor`](https://facebook.github.io/jest/docs/api.html#scriptpreprocessor-string) too!)
717717

718718
### `config.testPathDirs` [array<string>]
719719
(default: `['<rootDir>']`)

0 commit comments

Comments
 (0)