Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape angle brackets in configuration #9189

Merged
merged 5 commits into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ Default: `undefined`

The directory where Jest should output its coverage files.

### `coveragePathIgnorePatterns` [array<string>]
### `coveragePathIgnorePatterns` [array\<string>]

Default: `["/node_modules/"]`

An array of regexp pattern strings that are matched against all file paths before executing the test. If the file path matches any of the patterns, coverage information will be skipped.

These pattern strings match against the full path. Use the `<rootDir>` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["<rootDir>/build/", "<rootDir>/node_modules/"]`.

### `coverageReporters` [array<string>]
### `coverageReporters` [array\<string>]

Default: `["json", "lcov", "text", "clover"]`

Expand Down Expand Up @@ -317,7 +317,7 @@ Default: `false`

Make calling deprecated APIs throw helpful error messages. Useful for easing the upgrade process.

### `extraGlobals` [array<string>]
### `extraGlobals` [array\<string>]

Default: `undefined`

Expand All @@ -334,7 +334,7 @@ For example, if your tests call `Math` often, you can pass it by setting `extraG
}
```

### `forceCoverageMatch` [array<string>]
### `forceCoverageMatch` [array\<string>]

Default: `['']`

Expand Down Expand Up @@ -434,21 +434,21 @@ Default: `5`

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.

### `moduleDirectories` [array<string>]
### `moduleDirectories` [array\<string>]

Default: `["node_modules"]`

An array of directory names to be searched recursively up from the requiring module's location. Setting this option will _override_ the default, if you wish to still search `node_modules` for packages include it along with any other options: `["node_modules", "bower_components"]`

### `moduleFileExtensions` [array<string>]
### `moduleFileExtensions` [array\<string>]

Default: `["js", "json", "jsx", "ts", "tsx", "node"]`

An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.

We recommend placing the extensions most commonly used in your project on the left, so if you are using TypeScript, you may want to consider moving "ts" and/or "tsx" to the beginning of the array.

### `moduleNameMapper` [object<string, string>]
### `moduleNameMapper` [object\<string, string>]

Default: `null`

Expand Down Expand Up @@ -476,15 +476,15 @@ The order in which the mappings are defined matters. Patterns are checked one by

_Note: If you provide module name without boundaries `^$` it may cause hard to spot errors. E.g. `relay` will replace all modules which contain `relay` as a substring in its name: `relay`, `react-relay` and `graphql-relay` will all be pointed to your stub._

### `modulePathIgnorePatterns` [array<string>]
### `modulePathIgnorePatterns` [array\<string>]

Default: `[]`

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. If a given module's path matches any of the patterns, it will not be `require()`-able in the test environment.

These pattern strings match against the full path. Use the `<rootDir>` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["<rootDir>/build/"]`.

### `modulePaths` [array<string>]
### `modulePaths` [array\<string>]

Default: `[]`

Expand Down Expand Up @@ -539,7 +539,7 @@ Default: `'prettier'`

Sets the path to the [`prettier`](https://prettier.io/) node module used to update inline snapshots.

### `projects` [array<string | ProjectConfig>]
### `projects` [array\<string | ProjectConfig>]

Default: `undefined`

Expand Down Expand Up @@ -572,7 +572,7 @@ The projects feature can also be used to run multiple configurations or multiple

_Note: When using multi project runner, it's recommended to add a `displayName` for each project. This will show the `displayName` of a project next to its tests._

### `reporters` [array<moduleName | [moduleName, options]>]
### `reporters` [array\<moduleName | [moduleName, options]>]

Default: `undefined`

Expand Down Expand Up @@ -695,7 +695,7 @@ Oftentimes, you'll want to set this to `'src'` or `'lib'`, corresponding to wher

_Note that using `'<rootDir>'` as a string token in any other path-based config settings will refer back to this value. So, for example, if you want your [`setupFiles`](#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"]`._

### `roots` [array<string>]
### `roots` [array\<string>]

Default: `["<rootDir>"]`

Expand Down Expand Up @@ -794,7 +794,7 @@ module.exports = {
};
```

### `snapshotSerializers` [array<string>]
### `snapshotSerializers` [array\<string>]

Default: `[]`

Expand Down Expand Up @@ -942,29 +942,29 @@ Default: `{}`

Test environment options that will be passed to the `testEnvironment`. The relevant options depend on the environment. For example you can override options given to [jsdom](https://github.com/tmpvar/jsdom) such as `{userAgent: "Agent/007"}`.

### `testMatch` [array<string>]
### `testMatch` [array\<string>]

(default: `[ "**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)" ]`)

The glob patterns Jest uses to detect test files. By default it looks for `.js`, `.jsx`, `.ts` and `.tsx` files inside of `__tests__` folders, as well as any files with a suffix of `.test` or `.spec` (e.g. `Component.test.js` or `Component.spec.js`). It will also find files called `test.js` or `spec.js`.

See the [micromatch](https://github.com/jonschlinkert/micromatch) package for details of the patterns you can specify.

See also [`testRegex` [string | array<string>]](#testregex-string-array-string), but note that you cannot specify both options.
See also [`testRegex` [string | array\<string>]](#testregex-string-array-string), but note that you cannot specify both options.

### `testPathIgnorePatterns` [array<string>]
### `testPathIgnorePatterns` [array\<string>]

Default: `["/node_modules/"]`

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.

These pattern strings match against the full path. Use the `<rootDir>` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["<rootDir>/build/", "<rootDir>/node_modules/"]`.

### `testRegex` [string | array<string>]
### `testRegex` [string | array\<string>]

Default: `(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$`

The pattern or patterns Jest uses to detect test files. By default it looks for `.js`, `.jsx`, `.ts` and `.tsx` files inside of `__tests__` folders, as well as any files with a suffix of `.test` or `.spec` (e.g. `Component.test.js` or `Component.spec.js`). It will also find files called `test.js` or `spec.js`. See also [`testMatch` [array<string>]](#testmatch-array-string), but note that you cannot specify both options.
The pattern or patterns Jest uses to detect test files. By default it looks for `.js`, `.jsx`, `.ts` and `.tsx` files inside of `__tests__` folders, as well as any files with a suffix of `.test` or `.spec` (e.g. `Component.test.js` or `Component.spec.js`). It will also find files called `test.js` or `spec.js`. See also [`testMatch` [array\<string>]](#testmatch-array-string), but note that you cannot specify both options.

The following is a visualization of the default regex:

Expand Down Expand Up @@ -1085,7 +1085,7 @@ Default: `real`

Setting this value to `fake` allows the use of fake timers for functions such as `setTimeout`. Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test.

### `transform` [object<string, pathToTransformer | [pathToTransformer, object]>]
### `transform` [object\<string, pathToTransformer | [pathToTransformer, object]>]

Default: `undefined`

Expand All @@ -1099,7 +1099,7 @@ _Note: a transformer is only run once per file unless the file has changed. Duri

_Note: if you are using the `babel-jest` transformer and want to use an additional code preprocessor, keep in mind that when "transform" is overwritten in any way the `babel-jest` is not loaded automatically anymore. If you want to use it to compile JavaScript code it has to be explicitly defined. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_

### `transformIgnorePatterns` [array<string>]
### `transformIgnorePatterns` [array\<string>]

Default: `["/node_modules/"]`

Expand All @@ -1111,7 +1111,7 @@ Example: `["<rootDir>/bower_components/", "<rootDir>/node_modules/"]`.

Sometimes it happens (especially in React Native or TypeScript projects) that 3rd party modules are published as untranspiled. Since all files inside `node_modules` are not transformed by default, Jest will not understand the code in these modules, resulting in syntax errors. To overcome this, you may use `transformIgnorePatterns` to whitelist such modules. You'll find a good example of this use case in [React Native Guide](https://jestjs.io/docs/en/tutorial-react-native#transformignorepatterns-customization).

### `unmockedModulePathPatterns` [array<string>]
### `unmockedModulePathPatterns` [array\<string>]

Default: `[]`

Expand All @@ -1127,15 +1127,15 @@ Default: `false`

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>]
### `watchPathIgnorePatterns` [array\<string>]

Default: `[]`

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.

These patterns match against the full path. Use the `<rootDir>` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["<rootDir>/node_modules/"]`.

### `watchPlugins` [array<string | [string, Object]>]
### `watchPlugins` [array\<string | [string, Object]>]

Default: `[]`

Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"rename-version": "docusaurus-rename-version"
},
"dependencies": {
"docusaurus": "^1.12.0"
"docusaurus": "^1.14.1"
},
"devDependencies": {
"crowdin-cli": "^0.3.0",
Expand Down
38 changes: 19 additions & 19 deletions website/versioned_docs/version-22.x/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ Default: `undefined`

The directory where Jest should output its coverage files.

### `coveragePathIgnorePatterns` [array<string>]
### `coveragePathIgnorePatterns` [array\<string>]

Default: `["/node_modules/"]`

An array of regexp pattern strings that are matched against all file paths before executing the test. If the file path matches any of the patterns, coverage information will be skipped.

These pattern strings match against the full path. Use the `<rootDir>` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["<rootDir>/build/", "<rootDir>/node_modules/"]`.

### `coverageReporters` [array<string>]
### `coverageReporters` [array\<string>]

Default: `["json", "lcov", "text", "clover"]`

Expand Down Expand Up @@ -226,7 +226,7 @@ default: `undefined`

Allows for a label to be printed along side a test while it is running. This becomes more useful in multiproject repositories where there can be many jest configuration files. This visually tells which project a test belongs to.

### `forceCoverageMatch` [array<string>]
### `forceCoverageMatch` [array\<string>]

Default: `['']`

Expand Down Expand Up @@ -292,21 +292,21 @@ Default: `undefined`

This option allows the use of a custom global teardown module which exports an async function that is triggered once after all test suites.

### `moduleFileExtensions` [array<string>]
### `moduleFileExtensions` [array\<string>]

Default: `["js", "json", "jsx", "node"]`

An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.

If you are using TypeScript, you will want to add `"ts"` and/or `"tsx"` to the above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.

### `moduleDirectories` [array<string>]
### `moduleDirectories` [array\<string>]

Default: `["node_modules"]`

An array of directory names to be searched recursively up from the requiring module's location. Setting this option will _override_ the default, if you wish to still search `node_modules` for packages include it along with any other options: `["node_modules", "bower_components"]`

### `moduleNameMapper` [object<string, string>]
### `moduleNameMapper` [object\<string, string>]

Default: `null`

Expand Down Expand Up @@ -334,15 +334,15 @@ The order in which the mappings are defined matters. Patterns are checked one by

_Note: If you provide module name without boundaries `^$` it may cause hard to spot errors. E.g. `relay` will replace all modules which contain `relay` as a substring in its name: `relay`, `react-relay` and `graphql-relay` will all be pointed to your stub._

### `modulePathIgnorePatterns` [array<string>]
### `modulePathIgnorePatterns` [array\<string>]

Default: `[]`

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. If a given module's path matches any of the patterns, it will not be `require()`-able in the test environment.

These pattern strings match against the full path. Use the `<rootDir>` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["<rootDir>/build/"]`.

### `modulePaths` [array<string>]
### `modulePaths` [array\<string>]

Default: `[]`

Expand Down Expand Up @@ -375,7 +375,7 @@ Default: `undefined`

A preset that is used as a base for Jest's configuration. A preset should point to an npm module that exports a `jest-preset.json` module on its top level.

### `projects` [array<string | ProjectConfig>]
### `projects` [array\<string | ProjectConfig>]

Default: `undefined`

Expand Down Expand Up @@ -414,7 +414,7 @@ Default: `false`

Automatically clear mock calls and instances between every test. Equivalent to calling `jest.clearAllMocks()` between each test. This does not remove any mock implementation that may have been provided.

### `reporters` [array<moduleName | [moduleName, options]>]
### `reporters` [array\<moduleName | [moduleName, options]>]

Default: `undefined`

Expand Down Expand Up @@ -533,7 +533,7 @@ Oftentimes, you'll want to set this to `'src'` or `'lib'`, corresponding to wher

_Note that using `'<rootDir>'` as a string token in any other path-based config settings will refer back to this value. So, for example, if you want your [`setupFiles`](#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"]`._

### `roots` [array<string>]
### `roots` [array\<string>]

Default: `["<rootDir>"]`

Expand Down Expand Up @@ -585,7 +585,7 @@ The path to a module that runs some code to configure or set up the testing fram

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.

### `snapshotSerializers` [array<string>]
### `snapshotSerializers` [array\<string>]

Default: `[]`

Expand Down Expand Up @@ -716,7 +716,7 @@ Default: `{}`

Test environment options that will be passed to the `testEnvironment`. The relevant options depend on the environment. For example you can override options given to [jsdom](https://github.com/tmpvar/jsdom) such as `{userAgent: "Agent/007"}`.

### `testMatch` [array<string>]
### `testMatch` [array\<string>]

(default: `[ '**/__tests__/**/*.js?(x)', '**/?(*.)(spec|test).js?(x)' ]`)

Expand All @@ -726,7 +726,7 @@ See the [micromatch](https://github.com/jonschlinkert/micromatch) package for de

See also [`testRegex` [string]](#testregex-string), but note that you cannot specify both options.

### `testPathIgnorePatterns` [array<string>]
### `testPathIgnorePatterns` [array\<string>]

Default: `["/node_modules/"]`

Expand All @@ -738,7 +738,7 @@ These pattern strings match against the full path. Use the `<rootDir>` string to

Default: `(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$`

The pattern Jest uses to detect test files. By default it looks for `.js` and `.jsx` files inside of `__tests__` folders, as well as any files with a suffix of `.test` or `.spec` (e.g. `Component.test.js` or `Component.spec.js`). It will also find files called `test.js` or `spec.js`. See also [`testMatch` [array<string>]](#testmatch-array-string), but note that you cannot specify both options.
The pattern Jest uses to detect test files. By default it looks for `.js` and `.jsx` files inside of `__tests__` folders, as well as any files with a suffix of `.test` or `.spec` (e.g. `Component.test.js` or `Component.spec.js`). It will also find files called `test.js` or `spec.js`. See also [`testMatch` [array\<string>]](#testmatch-array-string), but note that you cannot specify both options.

The following is a visualization of the default regex:

Expand Down Expand Up @@ -830,7 +830,7 @@ Default: `real`

Setting this value to `fake` allows the use of fake timers for functions such as `setTimeout`. Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test.

### `transform` [object<string, string>]
### `transform` [object\<string, string>]

Default: `undefined`

Expand All @@ -842,7 +842,7 @@ _Note: a transformer is only run once per file unless the file has changed. Duri

_Note: if you are using the `babel-jest` transformer and want to use an additional code preprocessor, keep in mind that when "transform" is overwritten in any way the `babel-jest` is not loaded automatically anymore. If you want to use it to compile JavaScript code it has to be explicitly defined. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_

### `transformIgnorePatterns` [array<string>]
### `transformIgnorePatterns` [array\<string>]

Default: `["/node_modules/"]`

Expand All @@ -854,7 +854,7 @@ Example: `["<rootDir>/bower_components/", "<rootDir>/node_modules/"]`.

Sometimes it happens (especially in React Native or TypeScript projects) that 3rd party modules are published as untranspiled. Since all files inside `node_modules` are not transformed by default, Jest will not understand the code in these modules, resulting in syntax errors. To overcome this, you may use `transformIgnorePatterns` to whitelist such modules. You'll find a good example of this use case in [React Native Guide](https://jestjs.io/docs/en/tutorial-react-native.html#transformignorepatterns-customization).

### `unmockedModulePathPatterns` [array<string>]
### `unmockedModulePathPatterns` [array\<string>]

Default: `[]`

Expand All @@ -870,7 +870,7 @@ Default: `false`

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>]
### `watchPathIgnorePatterns` [array\<string>]

Default: `[]`

Expand Down
Loading