From 54819f08e0c469528901d81a9cee546ea518a5c3 Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Mon, 4 Apr 2022 10:14:49 -0400 Subject: test_runner: support 'only' tests This commit introduces a CLI flag and test runner functionality to support running a subset of tests that are indicated by an 'only' option passed to the test. PR-URL: https://github.com/nodejs/node/pull/42514 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel --- doc/api/cli.md | 10 ++++++++++ doc/api/test.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/node.1 | 4 ++++ 3 files changed, 70 insertions(+) (limited to 'doc') diff --git a/doc/api/cli.md b/doc/api/cli.md index cec177f0410..92acc87e648 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1052,6 +1052,15 @@ minimum allocation from the secure heap. The minimum value is `2`. The maximum value is the lesser of `--secure-heap` or `2147483647`. The value given must be a power of two. +### `--test-only` + + + +Configures the test runner to only execute top level tests that have the `only` +option set. + ### `--throw-deprecation` + +* `shouldRunOnlyTests` {boolean} Whether or not to run `only` tests. + +If `shouldRunOnlyTests` is truthy, the test context will only run tests that +have the `only` option set. Otherwise, all tests are run. If Node.js was not +started with the [`--test-only`][] command-line option, this function is a +no-op. + ### `context.skip([message])`