From 64d5983d20a628d68644a3a4cd0f510dc304805a Mon Sep 17 00:00:00 2001
From: Daniel Tschinder <231804+danez@users.noreply.github.com>
Date: Mon, 26 Apr 2021 07:50:11 +0200
Subject: [PATCH] docs: Add Note about order of glob patterns and fix link to
micromatch (#11341)
---
docs/Configuration.md | 10 +++++++---
website/versioned_docs/version-25.x/Configuration.md | 10 +++++++---
website/versioned_docs/version-26.x/Configuration.md | 10 +++++++---
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/docs/Configuration.md b/docs/Configuration.md
index 320f26fbd89e..4ab9ccc08358 100644
--- a/docs/Configuration.md
+++ b/docs/Configuration.md
@@ -159,7 +159,7 @@ Indicates whether the coverage information should be collected while executing t
Default: `undefined`
-An array of [glob patterns](https://github.com/jonschlinkert/micromatch) indicating a set of files for which coverage information should be collected. If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist for this file and it's never required in the test suite.
+An array of [glob patterns](https://github.com/micromatch/micromatch) indicating a set of files for which coverage information should be collected. If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist for this file and it's never required in the test suite.
Example:
@@ -175,6 +175,8 @@ Example:
This will collect coverage information for all the files inside the project's `rootDir`, except the ones that match `**/node_modules/**` or `**/vendor/**`.
+_Note: Each glob pattern is applied in the order they are specified in the config. (For example `["!**/__tests__/**", "**/*.js"]` will not exclude `__tests__` because the negation is overwritten with the second pattern. In order to make the negated glob work in this example it has to come after `**/*.js`.)_
+
_Note: This option requires `collectCoverage` to be set to true or Jest to be invoked with `--coverage`._
@@ -191,7 +193,7 @@ Lines : Unknown% ( 0/0 )
Jest: Coverage data for global was not found.
```
-Most likely your glob patterns are not matching any files. Refer to the [micromatch](https://github.com/jonschlinkert/micromatch) documentation to ensure your globs are compatible.
+Most likely your glob patterns are not matching any files. Refer to the [micromatch](https://github.com/micromatch/micromatch) documentation to ensure your globs are compatible.
@@ -1138,10 +1140,12 @@ _Note: This does not change the exit code in the case of Jest errors (e.g. inval
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 the [micromatch](https://github.com/micromatch/micromatch) package for details of the patterns you can specify.
See also [`testRegex` [string | array<string>]](#testregex-string--arraystring), but note that you cannot specify both options.
+_Note: Each glob pattern is applied in the order they are specified in the config. (For example `["!**/__fixtures__/**", "**/__tests__/**/*.js"]` will not exclude `__fixtures__` because the negation is overwritten with the second pattern. In order to make the negated glob work in this example it has to come after `**/__tests__/**/*.js`.)_
+
### `testPathIgnorePatterns` \[array<string>]
Default: `["/node_modules/"]`
diff --git a/website/versioned_docs/version-25.x/Configuration.md b/website/versioned_docs/version-25.x/Configuration.md
index 521d0d9fc4bd..fe65a7d1ffcf 100644
--- a/website/versioned_docs/version-25.x/Configuration.md
+++ b/website/versioned_docs/version-25.x/Configuration.md
@@ -137,7 +137,7 @@ Indicates whether the coverage information should be collected while executing t
Default: `undefined`
-An array of [glob patterns](https://github.com/jonschlinkert/micromatch) indicating a set of files for which coverage information should be collected. If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist for this file and it's never required in the test suite.
+An array of [glob patterns](https://github.com/micromatch/micromatch) indicating a set of files for which coverage information should be collected. If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist for this file and it's never required in the test suite.
Example:
@@ -153,6 +153,8 @@ Example:
This will collect coverage information for all the files inside the project's `rootDir`, except the ones that match `**/node_modules/**` or `**/vendor/**`.
+_Note: Each glob pattern is applied in the order they are specified in the config. (For example `["!**/__tests__/**", "**/*.js"]` will not exclude `__tests__` because the negation is overwritten with the second pattern. In order to make the negated glob work in this example it has to come after `**/*.js`.)_
+
_Note: This option requires `collectCoverage` to be set to true or Jest to be invoked with `--coverage`._
@@ -169,7 +171,7 @@ Lines : Unknown% ( 0/0 )
Jest: Coverage data for global was not found.
```
-Most likely your glob patterns are not matching any files. Refer to the [micromatch](https://github.com/jonschlinkert/micromatch) documentation to ensure your globs are compatible.
+Most likely your glob patterns are not matching any files. Refer to the [micromatch](https://github.com/micromatch/micromatch) documentation to ensure your globs are compatible.
@@ -1023,10 +1025,12 @@ _Note: This does not change the exit code in the case of Jest errors (e.g. inval
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 the [micromatch](https://github.com/micromatch/micromatch) package for details of the patterns you can specify.
See also [`testRegex` [string | array<string>]](#testregex-string--arraystring), but note that you cannot specify both options.
+_Note: Each glob pattern is applied in the order they are specified in the config. (For example `["!**/__fixtures__/**", "**/__tests__/**/*.js"]` will not exclude `__fixtures__` because the negation is overwritten with the second pattern. In order to make the negated glob work in this example it has to come after `**/__tests__/**/*.js`.)_
+
### `testPathIgnorePatterns` \[array<string>]
Default: `["/node_modules/"]`
diff --git a/website/versioned_docs/version-26.x/Configuration.md b/website/versioned_docs/version-26.x/Configuration.md
index 7ccb93d90f1e..d4bd733c199d 100644
--- a/website/versioned_docs/version-26.x/Configuration.md
+++ b/website/versioned_docs/version-26.x/Configuration.md
@@ -159,7 +159,7 @@ Indicates whether the coverage information should be collected while executing t
Default: `undefined`
-An array of [glob patterns](https://github.com/jonschlinkert/micromatch) indicating a set of files for which coverage information should be collected. If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist for this file and it's never required in the test suite.
+An array of [glob patterns](https://github.com/micromatch/micromatch) indicating a set of files for which coverage information should be collected. If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist for this file and it's never required in the test suite.
Example:
@@ -175,6 +175,8 @@ Example:
This will collect coverage information for all the files inside the project's `rootDir`, except the ones that match `**/node_modules/**` or `**/vendor/**`.
+_Note: Each glob pattern is applied in the order they are specified in the config. (For example `["!**/__tests__/**", "**/*.js"]` will not exclude `__tests__` because the negation is overwritten with the second pattern. In order to make the negated glob work in this example it has to come after `**/*.js`.)_
+
_Note: This option requires `collectCoverage` to be set to true or Jest to be invoked with `--coverage`._
@@ -191,7 +193,7 @@ Lines : Unknown% ( 0/0 )
Jest: Coverage data for global was not found.
```
-Most likely your glob patterns are not matching any files. Refer to the [micromatch](https://github.com/jonschlinkert/micromatch) documentation to ensure your globs are compatible.
+Most likely your glob patterns are not matching any files. Refer to the [micromatch](https://github.com/micromatch/micromatch) documentation to ensure your globs are compatible.
@@ -1113,10 +1115,12 @@ _Note: This does not change the exit code in the case of Jest errors (e.g. inval
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 the [micromatch](https://github.com/micromatch/micromatch) package for details of the patterns you can specify.
See also [`testRegex` [string | array<string>]](#testregex-string--arraystring), but note that you cannot specify both options.
+_Note: Each glob pattern is applied in the order they are specified in the config. (For example `["!**/__fixtures__/**", "**/__tests__/**/*.js"]` will not exclude `__fixtures__` because the negation is overwritten with the second pattern. In order to make the negated glob work in this example it has to come after `**/__tests__/**/*.js`.)_
+
### `testPathIgnorePatterns` \[array<string>]
Default: `["/node_modules/"]`