From 20e8cf53b054796f42bab6616c0e6673d55ebd7b Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 31 Aug 2022 21:33:39 -0400 Subject: [PATCH 1/3] test_runner: add --test-name-pattern CLI flag This commit adds support for running tests that match a regular expression. Fixes: https://github.com/nodejs/node/issues/42984 --- doc/api/cli.md | 11 ++ doc/api/test.md | 37 ++++++ lib/internal/test_runner/test.js | 31 ++++- lib/internal/test_runner/utils.js | 23 +++- src/node_options.cc | 3 + src/node_options.h | 1 + test/message/test_runner_test_name_pattern.js | 47 ++++++++ .../message/test_runner_test_name_pattern.out | 107 ++++++++++++++++++ test/parallel/test-runner-string-to-regexp.js | 20 ++++ 9 files changed, 276 insertions(+), 4 deletions(-) create mode 100644 test/message/test_runner_test_name_pattern.js create mode 100644 test/message/test_runner_test_name_pattern.out create mode 100644 test/parallel/test-runner-string-to-regexp.js diff --git a/doc/api/cli.md b/doc/api/cli.md index 6dbc33ebd07547..09e7854340a770 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1231,6 +1231,16 @@ Starts the Node.js command line test runner. This flag cannot be combined with `--check`, `--eval`, `--interactive`, or the inspector. See the documentation on [running tests from the command line][] for more details. +### `--test-name-pattern` + + + +A regular expression that configures the test runner to only execute tests +whose name matches the provided pattern. See the documentation on +[filtering tests by name][] for more details. + ### `--test-only`