Skip to content

Commit

Permalink
Update documentation (see jestjs#12260)
Browse files Browse the repository at this point in the history
This PR specifies how to use the filtering function CLI option.
  • Loading branch information
gramsco authored May 3, 2022
1 parent 585854f commit 613f25b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion website/versioned_docs/version-28.0/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,18 @@ Alias: `-e`. Use this flag to show full diffs and errors instead of a patch.

### `--filter=<file>`

Path to a module exporting a filtering function. This method receives a list of tests which can be manipulated to exclude tests from running. Especially useful when used in conjunction with a testing infrastructure to filter known broken.
Path to a module exporting a filtering function. This asynchronous function receives a list of test paths which can be manipulated to exclude tests from running by returning an object with the "filtered" property. Especially useful when used in conjunction with a testing infrastructure to filter known broken, e.g.

```javascript
// my-filter.js
module.exports = (testPaths) => {
const allowedPaths = testPaths.filter(filteringFunction) // ["path1.spec.js", "path2.spec.js", etc]
return {
filtered : allowedPaths,
}
}
```


### `--findRelatedTests <spaceSeparatedListOfSourceFiles>`

Expand Down

0 comments on commit 613f25b

Please sign in to comment.