Docs: Fix WatchPlugins jestHooks.shouldRunTestSuite example t… (#8784)

* Update CHANGELOG.md

* Fix WatchPlugins jestHooks.shouldRunTestSuite docs

* Update CHANGELOG.md
This commit is contained in:
Felipe Lima
2019-08-11 19:01:45 +02:00
committed by Tim Seckinger
parent 83ac594013
commit a0cdb68911
4 changed files with 18 additions and 16 deletions
+3 -1
View File
@@ -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
+5 -5
View File
@@ -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.
@@ -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'));
});
}
}
@@ -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.
@@ -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'));
});
}
}
@@ -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.
@@ -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'));
});
}
}