From e21c5aba950f6019bbfde2f8233ac96d1fcaef42 Mon Sep 17 00:00:00 2001 From: Bruno Farias Date: Wed, 28 Sep 2022 06:24:40 -0300 Subject: [PATCH] docs: update `--filter` to match code implementation (#13329) --- docs/CLI.md | 7 +++++-- website/versioned_docs/version-28.x/CLI.md | 7 +++++-- website/versioned_docs/version-29.0/CLI.md | 7 +++++-- website/versioned_docs/version-29.1/CLI.md | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/CLI.md b/docs/CLI.md index dde424ed1acd..75eaa78a052f 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -202,11 +202,14 @@ Alias: `-e`. Use this flag to show full diffs and errors instead of a patch. ### `--filter=` -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. +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. ```js title="my-filter.js" module.exports = testPaths => { - const allowedPaths = testPaths.filter(filteringFunction); // ["path1.spec.js", "path2.spec.js", etc] + const allowedPaths = testPaths + .filter(filteringFunction) + .map(test => ({test})); // [{ test: "path1.spec.js" }, { test: "path2.spec.js" }, etc] + return { filtered: allowedPaths, }; diff --git a/website/versioned_docs/version-28.x/CLI.md b/website/versioned_docs/version-28.x/CLI.md index 26c6928cac19..b884b753234b 100644 --- a/website/versioned_docs/version-28.x/CLI.md +++ b/website/versioned_docs/version-28.x/CLI.md @@ -208,11 +208,14 @@ Alias: `-e`. Use this flag to show full diffs and errors instead of a patch. ### `--filter=` -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. +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. ```js title="my-filter.js" module.exports = testPaths => { - const allowedPaths = testPaths.filter(filteringFunction); // ["path1.spec.js", "path2.spec.js", etc] + const allowedPaths = testPaths + .filter(filteringFunction) + .map(test => ({test})); // [{ test: "path1.spec.js" }, { test: "path2.spec.js" }, etc] + return { filtered: allowedPaths, }; diff --git a/website/versioned_docs/version-29.0/CLI.md b/website/versioned_docs/version-29.0/CLI.md index 8f039a3ad281..53b740953c14 100644 --- a/website/versioned_docs/version-29.0/CLI.md +++ b/website/versioned_docs/version-29.0/CLI.md @@ -202,11 +202,14 @@ Alias: `-e`. Use this flag to show full diffs and errors instead of a patch. ### `--filter=` -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. +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. ```js title="my-filter.js" module.exports = testPaths => { - const allowedPaths = testPaths.filter(filteringFunction); // ["path1.spec.js", "path2.spec.js", etc] + const allowedPaths = testPaths + .filter(filteringFunction) + .map(test => ({test})); // [{ test: "path1.spec.js" }, { test: "path2.spec.js" }, etc] + return { filtered: allowedPaths, }; diff --git a/website/versioned_docs/version-29.1/CLI.md b/website/versioned_docs/version-29.1/CLI.md index dde424ed1acd..75eaa78a052f 100644 --- a/website/versioned_docs/version-29.1/CLI.md +++ b/website/versioned_docs/version-29.1/CLI.md @@ -202,11 +202,14 @@ Alias: `-e`. Use this flag to show full diffs and errors instead of a patch. ### `--filter=` -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. +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. ```js title="my-filter.js" module.exports = testPaths => { - const allowedPaths = testPaths.filter(filteringFunction); // ["path1.spec.js", "path2.spec.js", etc] + const allowedPaths = testPaths + .filter(filteringFunction) + .map(test => ({test})); // [{ test: "path1.spec.js" }, { test: "path2.spec.js" }, etc] + return { filtered: allowedPaths, };