Skip to content

Commit 867b518

Browse files
felipepastorelimajeysal
authored andcommitted
Docs: Fix WatchPlugins jestHooks.shouldRunTestSuite example t… (#8784)
* Update CHANGELOG.md * Fix WatchPlugins jestHooks.shouldRunTestSuite docs * Update CHANGELOG.md
1 parent 9a15d46 commit 867b518

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
- `[docs]` Updated react tutorial to refer to new package of react-testing-library (@testing-library/react) ([#8753](https://github.com/facebook/jest/pull/8753))
5050
- `[docs]` Updated imports of react-testing-library to @testing-library/react in website ([#8757](https://github.com/facebook/jest/pull/8757))
5151
- `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706))
52-
- `[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))
52+
- `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765))
53+
- `[*]` Make sure copyright header comment includes license ([#8783](https://github.com/facebook/jest/pull/8783))
54+
- `[docs]` Fix WatchPlugins `jestHooks.shouldRunTestSuite` example that receives an object ([#8784](https://github.com/facebook/jest/pull/8784))
5355

5456
### Performance
5557

docs/WatchPlugins.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class MyWatchPlugin {
4646

4747
Below are the hooks available in Jest.
4848

49-
#### `jestHooks.shouldRunTestSuite(testPath)`
49+
#### `jestHooks.shouldRunTestSuite(testSuiteInfo)`
5050

5151
Returns a boolean (or `Promise<boolean>` for handling asynchronous operations) to specify if a test should be run or not.
5252

@@ -55,13 +55,13 @@ For example:
5555
```javascript
5656
class MyWatchPlugin {
5757
apply(jestHooks) {
58-
jestHooks.shouldRunTestSuite(testPath => {
59-
return testPath.includes('my-keyword');
58+
jestHooks.shouldRunTestSuite(testSuiteInfo => {
59+
return testSuiteInfo.testPath.includes('my-keyword');
6060
});
6161

6262
// or a promise
63-
jestHooks.shouldRunTestSuite(testPath => {
64-
return Promise.resolve(testPath.includes('my-keyword'));
63+
jestHooks.shouldRunTestSuite(testSuiteInfo => {
64+
return Promise.resolve(testSuiteInfo.testPath.includes('my-keyword'));
6565
});
6666
}
6767
}

website/versioned_docs/version-23.x/WatchPlugins.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class MyWatchPlugin {
4747

4848
Below are the hooks available in Jest.
4949

50-
#### `jestHooks.shouldRunTestSuite(testPath)`
50+
#### `jestHooks.shouldRunTestSuite(testSuiteInfo)`
5151

5252
Returns a boolean (or `Promise<boolean>` for handling asynchronous operations) to specify if a test should be run or not.
5353

@@ -56,13 +56,13 @@ For example:
5656
```javascript
5757
class MyWatchPlugin {
5858
apply(jestHooks) {
59-
jestHooks.shouldRunTestSuite(testPath => {
60-
return testPath.includes('my-keyword');
59+
jestHooks.shouldRunTestSuite(testSuiteInfo => {
60+
return testSuiteInfo.testPath.includes('my-keyword');
6161
});
6262

6363
// or a promise
64-
jestHooks.shouldRunTestSuite(testPath => {
65-
return Promise.resolve(testPath.includes('my-keyword'));
64+
jestHooks.shouldRunTestSuite(testSuiteInfo => {
65+
return Promise.resolve(testSuiteInfo.testPath.includes('my-keyword'));
6666
});
6767
}
6868
}

website/versioned_docs/version-24.0/WatchPlugins.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class MyWatchPlugin {
4747

4848
Below are the hooks available in Jest.
4949

50-
#### `jestHooks.shouldRunTestSuite(testPath)`
50+
#### `jestHooks.shouldRunTestSuite(testSuiteInfo)`
5151

5252
Returns a boolean (or `Promise<boolean>` for handling asynchronous operations) to specify if a test should be run or not.
5353

@@ -56,13 +56,13 @@ For example:
5656
```javascript
5757
class MyWatchPlugin {
5858
apply(jestHooks) {
59-
jestHooks.shouldRunTestSuite(testPath => {
60-
return testPath.includes('my-keyword');
59+
jestHooks.shouldRunTestSuite(testSuiteInfo => {
60+
return testSuiteInfo.testPath.includes('my-keyword');
6161
});
6262

6363
// or a promise
64-
jestHooks.shouldRunTestSuite(testPath => {
65-
return Promise.resolve(testPath.includes('my-keyword'));
64+
jestHooks.shouldRunTestSuite(testSuiteInfo => {
65+
return Promise.resolve(testSuiteInfo.testPath.includes('my-keyword'));
6666
});
6767
}
6868
}

0 commit comments

Comments
 (0)