Conversation
Passing a directory to `node --test` (e.g. `node --test tests`) matched the directory itself as a glob pattern and then tried to run it as a test file, failing with MODULE_NOT_FOUND. Before glob patterns were supported, a directory argument was searched for test files within it. Expand a pattern that resolves to a directory into a search for the default test files inside it. Despite the report framing this as Windows-only, it reproduces on every platform: it is a plain regression from when directory arguments stopped being searched. Fixes: nodejs#64555 Signed-off-by: Paul Bouchon <mail@bitpshr.net>
|
Review requested:
|
|
Both CI failures look unrelated to this change. |
|
Just keeping this on the radar. It's been approved for a couple of weeks now, and it's a small test_runner fix (restoring directory arguments to |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64637 +/- ##
=======================================
Coverage 90.13% 90.13%
=======================================
Files 741 741
Lines 242076 242095 +19
Branches 45550 45552 +2
=======================================
+ Hits 218199 218219 +20
+ Misses 15391 15386 -5
- Partials 8486 8490 +4
🚀 New features to boost your workflow:
|
This comment was marked as outdated.
This comment was marked as outdated.
|
Just keeping this on the radar, it has been approved and |
This comment was marked as outdated.
This comment was marked as outdated.
Commit Queue failed- Loading data for nodejs/node/pull/64637 ✔ Done loading data for nodejs/node/pull/64637 ----------------------------------- PR info ------------------------------------ Title test_runner: restore directory search for --test (#64637) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch bitpshr:test-runner/dir-arg-search -> nodejs:main Labels author ready, needs-ci, commit-queue, test_runner Commits 1 - test_runner: restore directory search for --test Committers 1 - Paul Bouchon <mail@bitpshr.net> PR-URL: https://github.com/nodejs/node/pull/64637 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/64637 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> -------------------------------------------------------------------------------- ℹ This PR was created on Tue, 21 Jul 2026 03:18:10 GMT ✔ Approvals: 1 ✔ - Moshe Atlow (@MoLow): https://github.com/nodejs/node/pull/64637#pullrequestreview-4743076856 ✘ GitHub CI is still running ℹ Last Full PR CI on 2026-08-21T15:26:07Z: https://ci.nodejs.org/job/node-test-pull-request/76157/ - Querying data for job/node-test-pull-request/76157/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/32505631714 |
Commit Queue failed- Loading data for nodejs/node/pull/64637 ✔ Done loading data for nodejs/node/pull/64637 ----------------------------------- PR info ------------------------------------ Title test_runner: restore directory search for --test (#64637) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch bitpshr:test-runner/dir-arg-search -> nodejs:main Labels author ready, needs-ci, commit-queue, test_runner Commits 1 - test_runner: restore directory search for --test Committers 1 - Paul Bouchon <mail@bitpshr.net> PR-URL: https://github.com/nodejs/node/pull/64637 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/64637 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> -------------------------------------------------------------------------------- ℹ This PR was created on Tue, 21 Jul 2026 03:18:10 GMT ✔ Approvals: 1 ✔ - Moshe Atlow (@MoLow): https://github.com/nodejs/node/pull/64637#pullrequestreview-4743076856 ✘ GitHub CI is still running ℹ Last Full PR CI on 2026-08-21T17:05:44Z: https://ci.nodejs.org/job/node-test-pull-request/76157/ - Querying data for job/node-test-pull-request/76157/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/32512148725 |
Passing a directory to `node --test` (e.g. `node --test tests`) matched the directory itself as a glob pattern and then tried to run it as a test file, failing with MODULE_NOT_FOUND. Before glob patterns were supported, a directory argument was searched for test files within it. Expand a pattern that resolves to a directory into a search for the default test files inside it. Despite the report framing this as Windows-only, it reproduces on every platform: it is a plain regression from when directory arguments stopped being searched. Fixes: #64555 Signed-off-by: Paul Bouchon <mail@bitpshr.net> PR-URL: #64637 Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
|
Landed in 838a3e9 |
Passing a directory to `node --test` (e.g. `node --test tests`) matched the directory itself as a glob pattern and then tried to run it as a test file, failing with MODULE_NOT_FOUND. Before glob patterns were supported, a directory argument was searched for test files within it. Expand a pattern that resolves to a directory into a search for the default test files inside it. Despite the report framing this as Windows-only, it reproduces on every platform: it is a plain regression from when directory arguments stopped being searched. Fixes: #64555 Signed-off-by: Paul Bouchon <mail@bitpshr.net> PR-URL: #64637 Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Passing a directory to `node --test` (e.g. `node --test tests`) matched the directory itself as a glob pattern and then tried to run it as a test file, failing with MODULE_NOT_FOUND. Before glob patterns were supported, a directory argument was searched for test files within it. Expand a pattern that resolves to a directory into a search for the default test files inside it. Despite the report framing this as Windows-only, it reproduces on every platform: it is a plain regression from when directory arguments stopped being searched. Fixes: #64555 Signed-off-by: Paul Bouchon <mail@bitpshr.net> PR-URL: #64637 Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Node 24.x does not search a directory passed to `--test`: it takes the positional argument as a single test file, spawns a child to load it, and the CJS loader fails with Error: Cannot find module '.../harness-accountant/test' code: 'MODULE_NOT_FOUND' reporting one passing and one failing test. Node 20 still searches and Node 26 restored the search (nodejs/node#64637), so the v1.0.0 release's first hosted run went red on exactly one leg of the two-version matrix while the other stayed green - which is why it survived review, and why the author's own Node 26 could not reproduce it. Reproduced on a downloaded Node v24.21.0: the old command gives tests 1 / pass 0 / fail 1, the new one gives tests 87 / pass 87 / fail 0. Node 20.19.5 and Node 26.10.0 both pass with the new one. The command is now identical in the workflow, the `test` script, README (twice) and THREAT.md, so the documentation cannot drift from CI. The workflow carries the reasoning in a comment, because `node --test test/` looks like the tidier form and would re-break the Node 24 leg.
Fixes #64555. Passing a directory to
node --test(likenode --test tests) matched the directory itself as a glob pattern and then tried to run it as a test file, failing withMODULE_NOT_FOUND.This expands a pattern that resolves to a directory into a search for the default test files inside it, restoring the pre-glob behavior. File paths, real glob patterns, and nonexistent arguments all pass through unchanged.
Note: This isn't Windows-specific despite the report; it reproduces on every platform (on macOS,
node@20searches the directory and passes whilenode@22andnode@24both fail).