Skip to content

test_runner: restore directory search for --test - #64637

Open
bitpshr wants to merge 1 commit into
nodejs:mainfrom
bitpshr:test-runner/dir-arg-search
Open

test_runner: restore directory search for --test#64637
bitpshr wants to merge 1 commit into
nodejs:mainfrom
bitpshr:test-runner/dir-arg-search

Conversation

@bitpshr

@bitpshr bitpshr commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #64555. Passing a directory to node --test (like 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.

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@20 searches the directory and passes while node@22 and node@24 both fail).

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>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Jul 21, 2026
@bitpshr

bitpshr commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Both CI failures look unrelated to this change. test-macOS failed on test-debugger-probe-script-throws.js in the "unusual chars folder" re-run step, and the aarch64 shared-boringssl build failed on test-repl-context.mjs with ERR_INSPECTOR_COMMAND: Inspector error -32000: Promise was collected (the log shows failed 1 out of 10, so it's flaky). This PR only touches test runner directory handling, and its own test passed. A re-run should clear them.

@bitpshr

bitpshr commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

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 node --test) with a regression test. @MoLow is there anything else needed to get it landed?

@atlowChemi atlowChemi added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 6, 2026
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (6071907) to head (b48ff5b).
⚠️ Report is 262 commits behind head on main.

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     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 94.52% <100.00%> (+0.09%) ⬆️

... and 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 6, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_runner: directory arguments to --test fail with MODULE_NOT_FOUND on Windows (regression since v20)

4 participants