From ac8ee61c82b673313fd17b029ace62daf31582fd Mon Sep 17 00:00:00 2001 From: Tom Mrazauskas Date: Mon, 21 Aug 2023 21:25:27 +0300 Subject: [PATCH] docs: all hooks are optional in the `Reporter` interface (#14435) --- docs/Configuration.md | 8 +++++++- website/versioned_docs/version-29.4/Configuration.md | 8 +++++++- website/versioned_docs/version-29.5/Configuration.md | 8 +++++++- website/versioned_docs/version-29.6/Configuration.md | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index 4e23e314b103..1a50070df269 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -1401,7 +1401,7 @@ Hungry for reporters? Take a look at long list of [awesome reporters](https://gi ::: -Custom reporter module must export a class that takes [`globalConfig`](https://github.com/jestjs/jest/blob/v29.2.1/packages/jest-types/src/Config.ts#L358-L422), `reporterOptions` and `reporterContext` as constructor arguments and implements at least `onRunComplete()` method (for the full list of methods and argument types see `Reporter` interface in [packages/jest-reporters/src/types.ts](https://github.com/jestjs/jest/blob/main/packages/jest-reporters/src/types.ts)): +Custom reporter module must export a class that takes [`globalConfig`](https://github.com/jestjs/jest/blob/v29.2.1/packages/jest-types/src/Config.ts#L358-L422), `reporterOptions` and `reporterContext` as constructor arguments: ```js title="custom-reporter.js" class CustomReporter { @@ -1430,6 +1430,12 @@ class CustomReporter { module.exports = CustomReporter; ``` +:::note + +For the full list of hooks and argument types see the `Reporter` interface in [packages/jest-reporters/src/types.ts](https://github.com/jestjs/jest/blob/main/packages/jest-reporters/src/types.ts). + +::: + ### `resetMocks` \[boolean] Default: `false` diff --git a/website/versioned_docs/version-29.4/Configuration.md b/website/versioned_docs/version-29.4/Configuration.md index ed92e8e2bef9..c4676dd7bfe8 100644 --- a/website/versioned_docs/version-29.4/Configuration.md +++ b/website/versioned_docs/version-29.4/Configuration.md @@ -1330,7 +1330,7 @@ Hungry for reporters? Take a look at long list of [awesome reporters](https://gi ::: -Custom reporter module must export a class that takes [`globalConfig`](https://github.com/jestjs/jest/blob/v29.2.1/packages/jest-types/src/Config.ts#L358-L422), `reporterOptions` and `reporterContext` as constructor arguments and implements at least `onRunComplete()` method (for the full list of methods and argument types see `Reporter` interface in [packages/jest-reporters/src/types.ts](https://github.com/jestjs/jest/blob/main/packages/jest-reporters/src/types.ts)): +Custom reporter module must export a class that takes [`globalConfig`](https://github.com/jestjs/jest/blob/v29.2.1/packages/jest-types/src/Config.ts#L358-L422), `reporterOptions` and `reporterContext` as constructor arguments: ```js title="custom-reporter.js" class CustomReporter { @@ -1359,6 +1359,12 @@ class CustomReporter { module.exports = CustomReporter; ``` +:::note + +For the full list of hooks and argument types see the `Reporter` interface in [packages/jest-reporters/src/types.ts](https://github.com/jestjs/jest/blob/main/packages/jest-reporters/src/types.ts). + +::: + ### `resetMocks` \[boolean] Default: `false` diff --git a/website/versioned_docs/version-29.5/Configuration.md b/website/versioned_docs/version-29.5/Configuration.md index 0604ca6f965a..1c638f727250 100644 --- a/website/versioned_docs/version-29.5/Configuration.md +++ b/website/versioned_docs/version-29.5/Configuration.md @@ -1365,7 +1365,7 @@ Hungry for reporters? Take a look at long list of [awesome reporters](https://gi ::: -Custom reporter module must export a class that takes [`globalConfig`](https://github.com/jestjs/jest/blob/v29.2.1/packages/jest-types/src/Config.ts#L358-L422), `reporterOptions` and `reporterContext` as constructor arguments and implements at least `onRunComplete()` method (for the full list of methods and argument types see `Reporter` interface in [packages/jest-reporters/src/types.ts](https://github.com/jestjs/jest/blob/main/packages/jest-reporters/src/types.ts)): +Custom reporter module must export a class that takes [`globalConfig`](https://github.com/jestjs/jest/blob/v29.2.1/packages/jest-types/src/Config.ts#L358-L422), `reporterOptions` and `reporterContext` as constructor arguments: ```js title="custom-reporter.js" class CustomReporter { @@ -1394,6 +1394,12 @@ class CustomReporter { module.exports = CustomReporter; ``` +:::note + +For the full list of hooks and argument types see the `Reporter` interface in [packages/jest-reporters/src/types.ts](https://github.com/jestjs/jest/blob/main/packages/jest-reporters/src/types.ts). + +::: + ### `resetMocks` \[boolean] Default: `false` diff --git a/website/versioned_docs/version-29.6/Configuration.md b/website/versioned_docs/version-29.6/Configuration.md index 4e23e314b103..1a50070df269 100644 --- a/website/versioned_docs/version-29.6/Configuration.md +++ b/website/versioned_docs/version-29.6/Configuration.md @@ -1401,7 +1401,7 @@ Hungry for reporters? Take a look at long list of [awesome reporters](https://gi ::: -Custom reporter module must export a class that takes [`globalConfig`](https://github.com/jestjs/jest/blob/v29.2.1/packages/jest-types/src/Config.ts#L358-L422), `reporterOptions` and `reporterContext` as constructor arguments and implements at least `onRunComplete()` method (for the full list of methods and argument types see `Reporter` interface in [packages/jest-reporters/src/types.ts](https://github.com/jestjs/jest/blob/main/packages/jest-reporters/src/types.ts)): +Custom reporter module must export a class that takes [`globalConfig`](https://github.com/jestjs/jest/blob/v29.2.1/packages/jest-types/src/Config.ts#L358-L422), `reporterOptions` and `reporterContext` as constructor arguments: ```js title="custom-reporter.js" class CustomReporter { @@ -1430,6 +1430,12 @@ class CustomReporter { module.exports = CustomReporter; ``` +:::note + +For the full list of hooks and argument types see the `Reporter` interface in [packages/jest-reporters/src/types.ts](https://github.com/jestjs/jest/blob/main/packages/jest-reporters/src/types.ts). + +::: + ### `resetMocks` \[boolean] Default: `false`