From bcf649f38e7115466d02d4f748d11f26e1716aec Mon Sep 17 00:00:00 2001 From: Bruno Farias Date: Wed, 28 Sep 2022 08:26:28 +0100 Subject: [PATCH 1/3] Update filter CLI option docs to match code implementation. Related to issue #13222 --- docs/CLI.md | 6 ++++-- website/versioned_docs/version-28.x/CLI.md | 6 ++++-- website/versioned_docs/version-29.0/CLI.md | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/CLI.md b/docs/CLI.md index dde424ed1acd..1fb5c14de929 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -202,11 +202,13 @@ 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..2b7952842847 100644 --- a/website/versioned_docs/version-28.x/CLI.md +++ b/website/versioned_docs/version-28.x/CLI.md @@ -208,11 +208,13 @@ 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..cce1410b0dcc 100644 --- a/website/versioned_docs/version-29.0/CLI.md +++ b/website/versioned_docs/version-29.0/CLI.md @@ -202,11 +202,13 @@ 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, }; From d4aacac1f94f37e456972ae9861d1974493d6460 Mon Sep 17 00:00:00 2001 From: Bruno Farias Date: Wed, 28 Sep 2022 10:10:03 +0100 Subject: [PATCH 2/3] Update filter CLI option docs (v29.1). Related to issue #13222 --- website/versioned_docs/version-29.1/CLI.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/website/versioned_docs/version-29.1/CLI.md b/website/versioned_docs/version-29.1/CLI.md index dde424ed1acd..c686f1e6b626 100644 --- a/website/versioned_docs/version-29.1/CLI.md +++ b/website/versioned_docs/version-29.1/CLI.md @@ -202,11 +202,13 @@ 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, }; From 3e23c13463b2c9a15bb574a06ccd4b74d2760df5 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 28 Sep 2022 11:19:32 +0200 Subject: [PATCH 3/3] prettier --- docs/CLI.md | 7 ++++--- website/versioned_docs/version-28.x/CLI.md | 5 +++-- website/versioned_docs/version-29.0/CLI.md | 5 +++-- website/versioned_docs/version-29.1/CLI.md | 5 +++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/CLI.md b/docs/CLI.md index 1fb5c14de929..75eaa78a052f 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -206,9 +206,10 @@ Path to a module exporting a filtering function. This asynchronous function rece ```js title="my-filter.js" module.exports = testPaths => { - const allowedPaths = testPaths.filter(filteringFunction) - .map(test => ({ test })); // [{ test: "path1.spec.js" }, { test: "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 2b7952842847..b884b753234b 100644 --- a/website/versioned_docs/version-28.x/CLI.md +++ b/website/versioned_docs/version-28.x/CLI.md @@ -212,8 +212,9 @@ Path to a module exporting a filtering function. This asynchronous function rece ```js title="my-filter.js" module.exports = testPaths => { - const allowedPaths = testPaths.filter(filteringFunction) - .map(test => ({ test })); // [{ test: "path1.spec.js" }, { test: "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 cce1410b0dcc..53b740953c14 100644 --- a/website/versioned_docs/version-29.0/CLI.md +++ b/website/versioned_docs/version-29.0/CLI.md @@ -206,8 +206,9 @@ Path to a module exporting a filtering function. This asynchronous function rece ```js title="my-filter.js" module.exports = testPaths => { - const allowedPaths = testPaths.filter(filteringFunction) - .map(test => ({ test })); // [{ test: "path1.spec.js" }, { test: "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 c686f1e6b626..75eaa78a052f 100644 --- a/website/versioned_docs/version-29.1/CLI.md +++ b/website/versioned_docs/version-29.1/CLI.md @@ -206,8 +206,9 @@ Path to a module exporting a filtering function. This asynchronous function rece ```js title="my-filter.js" module.exports = testPaths => { - const allowedPaths = testPaths.filter(filteringFunction) - .map(test => ({ test })); // [{ test: "path1.spec.js" }, { test: "path2.spec.js" }, etc] + const allowedPaths = testPaths + .filter(filteringFunction) + .map(test => ({test})); // [{ test: "path1.spec.js" }, { test: "path2.spec.js" }, etc] return { filtered: allowedPaths,