diff --git a/CHANGELOG.md b/CHANGELOG.md index 119fa802697d..6e6072e0ac8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,9 @@ - `[docs]` Updated react tutorial to refer to new package of react-testing-library (@testing-library/react) ([#8753](https://github.com/facebook/jest/pull/8753)) - `[docs]` Updated imports of react-testing-library to @testing-library/react in website ([#8757](https://github.com/facebook/jest/pull/8757)) - `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706)) -- `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765)) `[*]` Make sure copyright header comment includes license ([#8783](https://github.com/facebook/jest/pull/8783)) +- `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765)) +- `[*]` Make sure copyright header comment includes license ([#8783](https://github.com/facebook/jest/pull/8783)) +- `[docs]` Fix WatchPlugins `jestHooks.shouldRunTestSuite` example that receives an object ([#8784](https://github.com/facebook/jest/pull/8784)) ### Performance diff --git a/docs/WatchPlugins.md b/docs/WatchPlugins.md index 6047382eefc0..abf4ad118d28 100644 --- a/docs/WatchPlugins.md +++ b/docs/WatchPlugins.md @@ -46,7 +46,7 @@ class MyWatchPlugin { Below are the hooks available in Jest. -#### `jestHooks.shouldRunTestSuite(testPath)` +#### `jestHooks.shouldRunTestSuite(testSuiteInfo)` Returns a boolean (or `Promise` for handling asynchronous operations) to specify if a test should be run or not. @@ -55,13 +55,13 @@ For example: ```javascript class MyWatchPlugin { apply(jestHooks) { - jestHooks.shouldRunTestSuite(testPath => { - return testPath.includes('my-keyword'); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return testSuiteInfo.testPath.includes('my-keyword'); }); // or a promise - jestHooks.shouldRunTestSuite(testPath => { - return Promise.resolve(testPath.includes('my-keyword')); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return Promise.resolve(testSuiteInfo.testPath.includes('my-keyword')); }); } } diff --git a/website/versioned_docs/version-23.x/WatchPlugins.md b/website/versioned_docs/version-23.x/WatchPlugins.md index 56a2208d2e59..529a6f5977eb 100644 --- a/website/versioned_docs/version-23.x/WatchPlugins.md +++ b/website/versioned_docs/version-23.x/WatchPlugins.md @@ -47,7 +47,7 @@ class MyWatchPlugin { Below are the hooks available in Jest. -#### `jestHooks.shouldRunTestSuite(testPath)` +#### `jestHooks.shouldRunTestSuite(testSuiteInfo)` Returns a boolean (or `Promise` for handling asynchronous operations) to specify if a test should be run or not. @@ -56,13 +56,13 @@ For example: ```javascript class MyWatchPlugin { apply(jestHooks) { - jestHooks.shouldRunTestSuite(testPath => { - return testPath.includes('my-keyword'); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return testSuiteInfo.testPath.includes('my-keyword'); }); // or a promise - jestHooks.shouldRunTestSuite(testPath => { - return Promise.resolve(testPath.includes('my-keyword')); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return Promise.resolve(testSuiteInfo.testPath.includes('my-keyword')); }); } } diff --git a/website/versioned_docs/version-24.0/WatchPlugins.md b/website/versioned_docs/version-24.0/WatchPlugins.md index 8b6acd192ed7..d43935a82c04 100644 --- a/website/versioned_docs/version-24.0/WatchPlugins.md +++ b/website/versioned_docs/version-24.0/WatchPlugins.md @@ -47,7 +47,7 @@ class MyWatchPlugin { Below are the hooks available in Jest. -#### `jestHooks.shouldRunTestSuite(testPath)` +#### `jestHooks.shouldRunTestSuite(testSuiteInfo)` Returns a boolean (or `Promise` for handling asynchronous operations) to specify if a test should be run or not. @@ -56,13 +56,13 @@ For example: ```javascript class MyWatchPlugin { apply(jestHooks) { - jestHooks.shouldRunTestSuite(testPath => { - return testPath.includes('my-keyword'); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return testSuiteInfo.testPath.includes('my-keyword'); }); // or a promise - jestHooks.shouldRunTestSuite(testPath => { - return Promise.resolve(testPath.includes('my-keyword')); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return Promise.resolve(testSuiteInfo.testPath.includes('my-keyword')); }); } }