diff --git a/BUILDING.md b/BUILDING.md index 84182f8fa05793..29b57085916acc 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -352,6 +352,27 @@ 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-* +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-*" +``` + +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-*" +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 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