Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Fix WatchPlugins jestHooks.shouldRunTestSuite example that receives an object #8784

Merged
merged 5 commits into from
Aug 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions docs/WatchPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MyWatchPlugin {

Below are the hooks available in Jest.

#### `jestHooks.shouldRunTestSuite(testPath)`
#### `jestHooks.shouldRunTestSuite(testSuiteInfo)`

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

Expand All @@ -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'));
});
}
}
Expand Down
10 changes: 5 additions & 5 deletions website/versioned_docs/version-23.x/WatchPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MyWatchPlugin {

Below are the hooks available in Jest.

#### `jestHooks.shouldRunTestSuite(testPath)`
#### `jestHooks.shouldRunTestSuite(testSuiteInfo)`

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

Expand All @@ -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'));
});
}
}
Expand Down
10 changes: 5 additions & 5 deletions website/versioned_docs/version-24.0/WatchPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MyWatchPlugin {

Below are the hooks available in Jest.

#### `jestHooks.shouldRunTestSuite(testPath)`
#### `jestHooks.shouldRunTestSuite(testSuiteInfo)`

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

Expand All @@ -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'));
});
}
}
Expand Down