diff --git a/CHANGELOG.md b/CHANGELOG.md index 0703930b8a15..c9490142c8dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - `[docs]` Updated docs to indicate that `jest-environment-jsdom` is a separate package [#12828](https://github.com/facebook/jest/issues/12828) - `[jest-haste-map]` Bump `walker` version ([#12324](https://github.com/facebook/jest/pull/12324)) +- `[docs]` Document the comments used by coverage providers [#12835](https://github.com/facebook/jest/issues/12835) ### Performance diff --git a/docs/Configuration.md b/docs/Configuration.md index e621ac7eaf42..7d19328833d9 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -158,6 +158,14 @@ Default: `false` Indicates whether the coverage information should be collected while executing the test. Because this retrofits all executed files with coverage collection statements, it may significantly slow down your tests. +Jest ships with two coverage providers: `babel` (default) and `v8`. See the [`coverageProvider`](#coverageprovider-string) option for more details. + +:::note + +The `babel` and `v8` coverage providers use `/* istanbul ignore next */` and `/* c8 ignore next */` comments to exclude lines from coverage reports, respectively. For more information, you can view the [`istanbuljs` documentation](https://github.com/istanbuljs/nyc#parsing-hints-ignoring-lines) and the [`c8` documentation](https://github.com/bcoe/c8#ignoring-uncovered-lines-functions-and-blocks). + +::: + ### `collectCoverageFrom` \[array] Default: `undefined` diff --git a/website/versioned_docs/version-25.x/Configuration.md b/website/versioned_docs/version-25.x/Configuration.md index 546b74d6ebac..30146135d932 100644 --- a/website/versioned_docs/version-25.x/Configuration.md +++ b/website/versioned_docs/version-25.x/Configuration.md @@ -141,6 +141,14 @@ Default: `false` Indicates whether the coverage information should be collected while executing the test. Because this retrofits all executed files with coverage collection statements, it may significantly slow down your tests. +Jest ships with two coverage providers: `babel` (default) and `v8`. See the [`coverageProvider`](#coverageprovider-string) option for more details. + +:::note + +The `babel` and `v8` coverage providers use `/* istanbul ignore next */` and `/* c8 ignore next */` comments to exclude lines from coverage reports, respectively. For more information, you can view the [`istanbuljs` documentation](https://github.com/istanbuljs/nyc#parsing-hints-ignoring-lines) and the [`c8` documentation](https://github.com/bcoe/c8#ignoring-uncovered-lines-functions-and-blocks). + +::: + ### `collectCoverageFrom` \[array] Default: `undefined` diff --git a/website/versioned_docs/version-26.x/Configuration.md b/website/versioned_docs/version-26.x/Configuration.md index b3e3fa0a8551..cf20a5ae01ee 100644 --- a/website/versioned_docs/version-26.x/Configuration.md +++ b/website/versioned_docs/version-26.x/Configuration.md @@ -154,6 +154,14 @@ Default: `false` Indicates whether the coverage information should be collected while executing the test. Because this retrofits all executed files with coverage collection statements, it may significantly slow down your tests. +Jest ships with two coverage providers: `babel` (default) and `v8`. See the [`coverageProvider`](#coverageprovider-string) option for more details. + +:::note + +The `babel` and `v8` coverage providers use `/* istanbul ignore next */` and `/* c8 ignore next */` comments to exclude lines from coverage reports, respectively. For more information, you can view the [`istanbuljs` documentation](https://github.com/istanbuljs/nyc#parsing-hints-ignoring-lines) and the [`c8` documentation](https://github.com/bcoe/c8#ignoring-uncovered-lines-functions-and-blocks). + +::: + ### `collectCoverageFrom` \[array] Default: `undefined` diff --git a/website/versioned_docs/version-27.x/Configuration.md b/website/versioned_docs/version-27.x/Configuration.md index 87d27057f420..6f193a1120b9 100644 --- a/website/versioned_docs/version-27.x/Configuration.md +++ b/website/versioned_docs/version-27.x/Configuration.md @@ -154,6 +154,14 @@ Default: `false` Indicates whether the coverage information should be collected while executing the test. Because this retrofits all executed files with coverage collection statements, it may significantly slow down your tests. +Jest ships with two coverage providers: `babel` (default) and `v8`. See the [`coverageProvider`](#coverageprovider-string) option for more details. + +:::note + +The `babel` and `v8` coverage providers use `/* istanbul ignore next */` and `/* c8 ignore next */` comments to exclude lines from coverage reports, respectively. For more information, you can view the [`istanbuljs` documentation](https://github.com/istanbuljs/nyc#parsing-hints-ignoring-lines) and the [`c8` documentation](https://github.com/bcoe/c8#ignoring-uncovered-lines-functions-and-blocks). + +::: + ### `collectCoverageFrom` \[array] Default: `undefined` diff --git a/website/versioned_docs/version-28.0/Configuration.md b/website/versioned_docs/version-28.0/Configuration.md index 549cdae15fb3..eefccaab7fac 100644 --- a/website/versioned_docs/version-28.0/Configuration.md +++ b/website/versioned_docs/version-28.0/Configuration.md @@ -158,6 +158,14 @@ Default: `false` Indicates whether the coverage information should be collected while executing the test. Because this retrofits all executed files with coverage collection statements, it may significantly slow down your tests. +Jest ships with two coverage providers: `babel` (default) and `v8`. See the [`coverageProvider`](#coverageprovider-string) option for more details. + +:::note + +The `babel` and `v8` coverage providers use `/* istanbul ignore next */` and `/* c8 ignore next */` comments to exclude lines from coverage reports, respectively. For more information, you can view the [`istanbuljs` documentation](https://github.com/istanbuljs/nyc#parsing-hints-ignoring-lines) and the [`c8` documentation](https://github.com/bcoe/c8#ignoring-uncovered-lines-functions-and-blocks). + +::: + ### `collectCoverageFrom` \[array] Default: `undefined` diff --git a/website/versioned_docs/version-28.1/Configuration.md b/website/versioned_docs/version-28.1/Configuration.md index e621ac7eaf42..7d19328833d9 100644 --- a/website/versioned_docs/version-28.1/Configuration.md +++ b/website/versioned_docs/version-28.1/Configuration.md @@ -158,6 +158,14 @@ Default: `false` Indicates whether the coverage information should be collected while executing the test. Because this retrofits all executed files with coverage collection statements, it may significantly slow down your tests. +Jest ships with two coverage providers: `babel` (default) and `v8`. See the [`coverageProvider`](#coverageprovider-string) option for more details. + +:::note + +The `babel` and `v8` coverage providers use `/* istanbul ignore next */` and `/* c8 ignore next */` comments to exclude lines from coverage reports, respectively. For more information, you can view the [`istanbuljs` documentation](https://github.com/istanbuljs/nyc#parsing-hints-ignoring-lines) and the [`c8` documentation](https://github.com/bcoe/c8#ignoring-uncovered-lines-functions-and-blocks). + +::: + ### `collectCoverageFrom` \[array] Default: `undefined`