From 51b10eaf5aa88892bd1f77eb3f2ee3d7254d4268 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 15 Oct 2025 13:58:43 +0200 Subject: [PATCH 1/2] doc: document wildcard supported by tools/test.py This seems to be a underdocumented but useful trick that only very few people know about. Also add a pointer to the test running guide in the test writing guide. --- BUILDING.md | 19 +++++++++++++++++++ doc/contributing/writing-tests.md | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index 84182f8fa05793..a2cc289a2ff509 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -352,6 +352,25 @@ You can also execute the tests in a test suite directory tools/test.py test/message ``` +You can execute tests that match a specific naming pattern using the wildcard +`*`. For example, to run all tests under `test/parallel` with a name that starts +with `test-stream-`: + +```bash +tools/test.py test/parallel/test-stream-* +# In some shell environments, you may need to quote the pattern +tools/test.py "test/parallel/test-stream-*" +``` + +The whildcard `*` can be used in any part of the path. For example, to run all tests +with a name that starts with `test-inspector-`, regardless of the directory they are in: + +```bash +# Matches test/sequential/test-inspector-*, test/parallel/test-inspector-*, +# test/known_issues/test-inspector-*, etc. +tools/test.py test/*/test-inspector-* +``` + If you want to check the other options, please refer to the help by using the `--help` option: diff --git a/doc/contributing/writing-tests.md b/doc/contributing/writing-tests.md index 7830bb3847184a..eb4e91b491eb9a 100644 --- a/doc/contributing/writing-tests.md +++ b/doc/contributing/writing-tests.md @@ -485,6 +485,11 @@ To generate a test coverage report, see the Nightly coverage reports for the Node.js `main` branch are available at . +## Running tests + +See the [Building guide](../../BUILDING.md#running-tests) for details on how to +run tests. + [ASCII]: https://man7.org/linux/man-pages/man7/ascii.7.html [Google Test]: https://github.com/google/googletest [Test Coverage section of the Building guide]: https://github.com/nodejs/node/blob/HEAD/BUILDING.md#running-coverage From 95f5b9349fc462d1021fdb73d994b8f622a9a72b Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 15 Oct 2025 15:56:59 +0200 Subject: [PATCH 2/2] fixup! doc: document wildcard supported by tools/test.py --- BUILDING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BUILDING.md b/BUILDING.md index a2cc289a2ff509..29b57085916acc 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -358,6 +358,7 @@ with `test-stream-`: ```bash tools/test.py test/parallel/test-stream-* +tools/test.py parallel/test-stream-* # The test/ prefix can be omitted # In some shell environments, you may need to quote the pattern tools/test.py "test/parallel/test-stream-*" ``` @@ -368,7 +369,8 @@ with a name that starts with `test-inspector-`, regardless of the directory they ```bash # Matches test/sequential/test-inspector-*, test/parallel/test-inspector-*, # test/known_issues/test-inspector-*, etc. -tools/test.py test/*/test-inspector-* +tools/test.py "test/*/test-inspector-*" +tools/test.py "*/test-inspector-*" # The test/ prefix can be omitted ``` If you want to check the other options, please refer to the help by using