You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Closesjestjs#877
Differential Revision: D3165851
fb-gh-sync-id: 84f47776d28499892cc6adb3ee4960604651fd2b
fbshipit-source-id: 84f47776d28499892cc6adb3ee4960604651fd2b
@@ -644,7 +644,7 @@ An array of regexp pattern strings that are matched against all module paths bef
644
644
645
645
A map from regular expressions to module names that allow to stub out resources, like images or styles with a single module.
646
646
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.
648
648
649
649
Additionally, you can substitute captured regex groups using numbered backreferences.
650
650
@@ -669,7 +669,7 @@ The root directory that Jest should scan for tests and modules within. If you pu
669
669
670
670
Oftentimes, you'll want to set this to `'src'` or `'lib'`, corresponding to where in your repository the code is stored.
671
671
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']`.*
673
673
674
674
### `config.scriptPreprocessor`[string]
675
675
(default: `undefined`)
@@ -692,12 +692,12 @@ An array of regexp pattern strings that are matched against all source file path
692
692
693
693
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.
694
694
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).
696
696
697
697
### `config.setupTestFrameworkScriptFile`[string]
698
698
(default: `undefined`)
699
699
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.
701
701
702
702
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.
703
703
@@ -713,7 +713,7 @@ For example, many node projects prefer to put their tests in a `tests` directory
713
713
714
714
An array of file extensions that test files might have. Jest uses this when searching for tests to run.
715
715
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!)
0 commit comments