Skip to content

Commit bcf649f

Browse files
committed
Update filter CLI option docs to match code implementation. Related to issue #13222
1 parent fd9cd90 commit bcf649f

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

docs/CLI.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,13 @@ Alias: `-e`. Use this flag to show full diffs and errors instead of a patch.
202202

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

205-
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.
205+
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 shape `{ filtered: Array<{ test: string }> }`. Especially useful when used in conjunction with a testing infrastructure to filter known broken tests, e.g.
206206

207207
```js title="my-filter.js"
208208
module.exports = testPaths => {
209-
const allowedPaths = testPaths.filter(filteringFunction); // ["path1.spec.js", "path2.spec.js", etc]
209+
const allowedPaths = testPaths.filter(filteringFunction)
210+
.map(test => ({ test })); // [{ test: "path1.spec.js" }, { test: "path2.spec.js" }, etc]
211+
210212
return {
211213
filtered: allowedPaths,
212214
};

website/versioned_docs/version-28.x/CLI.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,13 @@ Alias: `-e`. Use this flag to show full diffs and errors instead of a patch.
208208

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

211-
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.
211+
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 shape `{ filtered: Array<{ test: string }> }`. Especially useful when used in conjunction with a testing infrastructure to filter known broken tests, e.g.
212212

213213
```js title="my-filter.js"
214214
module.exports = testPaths => {
215-
const allowedPaths = testPaths.filter(filteringFunction); // ["path1.spec.js", "path2.spec.js", etc]
215+
const allowedPaths = testPaths.filter(filteringFunction)
216+
.map(test => ({ test })); // [{ test: "path1.spec.js" }, { test: "path2.spec.js" }, etc]
217+
216218
return {
217219
filtered: allowedPaths,
218220
};

website/versioned_docs/version-29.0/CLI.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,13 @@ Alias: `-e`. Use this flag to show full diffs and errors instead of a patch.
202202

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

205-
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.
205+
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 shape `{ filtered: Array<{ test: string }> }`. Especially useful when used in conjunction with a testing infrastructure to filter known broken tests, e.g.
206206

207207
```js title="my-filter.js"
208208
module.exports = testPaths => {
209-
const allowedPaths = testPaths.filter(filteringFunction); // ["path1.spec.js", "path2.spec.js", etc]
209+
const allowedPaths = testPaths.filter(filteringFunction)
210+
.map(test => ({ test })); // [{ test: "path1.spec.js" }, { test: "path2.spec.js" }, etc]
211+
210212
return {
211213
filtered: allowedPaths,
212214
};

0 commit comments

Comments
 (0)