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.

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)

3 participants