Skip to content

Conversation

joyeecheung
Copy link
Member

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.

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.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/build
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. doc Issues and PRs related to the documentations. labels Oct 15, 2025
Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the test/ prefix is optional and can be omitted, e.g.

tools/test.py parallel/test-stream-*

works.
(IIRC originally the prefix-less (no test/) syntax was the originally supported syntax, and the ability to include the test/ prefix was added later.)

@legendecas
Copy link
Member

In certain shells, the wildcard should be quoted:

$ tools/test.py 'parallel/test-stream-*'

I use this pattern a lot, without test/ prefix.

@joyeecheung
Copy link
Member Author

In certain shells, the wildcard should be quoted:

Yes, that's mentioned in the examples

@joyeecheung
Copy link
Member Author

(IIRC originally the prefix-less (no test/) syntax was the originally supported syntax, and the ability to include the test/ prefix was added later.)

Added a few more examples without the prefix (I used the one with the prefix a bit more often because I tend to copy the relative path from vscode)

@joyeecheung joyeecheung added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Oct 17, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 17, 2025
@nodejs-github-bot nodejs-github-bot merged commit 8096aea into nodejs:main Oct 17, 2025
22 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 8096aea

```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
Copy link
Contributor

@aduh95 aduh95 Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW that might be a bit misleading. If you don't quote it (and you use a POSIX-complient shell), the shell is going to expand it (i.e. looking for all files that match and pass each as a separate arg); so arguably quotes are always necessary, otherwise you waste a lot of time for on the shell expansion:

$ time tools/test.py test/parallel/test-debug*
[00:05|% 100|+  35|-   0]: Done                                               

All tests passed.
tools/test.py test/parallel/test-debug*  15.09s user 1.94s system 92% cpu 18.477 total
$ time tools/test.py 'test/parallel/test-debug*'
[00:05|% 100|+  35|-   0]: Done                                               

All tests passed.
tools/test.py 'test/parallel/test-debug*'  8.38s user 1.04s system 146% cpu 6.424 total

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to build files or the CI. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.