test_runner: expand directory arguments to find test files - #64824
test_runner: expand directory arguments to find test files#64824aalhadxx wants to merge 1 commit into
Conversation
When a directory is passed as an argument to node --test, the test runner treats it as a file pattern. Node.js internal Glob matches the directory itself, causing MODULE_NOT_FOUND when the runner tries to import the directory as a module. This restores the pre-v21 behavior by detecting directory arguments and expanding them to search for default test file patterns within them. Fixes: nodejs#64555
|
Review requested:
|
|
Why do we want this though instead of |
|
Hi @atlowChemi, thanks for the question.
Prior to v21, passing a directory to This change restores the pre-v21 behavior: when an argument resolves to a directory, append the default test pattern so the runner searches inside it. Users who want explicit glob control can still pass |
When a directory is passed as an argument to
node --test, the test runner treats it as a file pattern. Node.js internal Glob matches the directory itself, causing MODULE_NOT_FOUND when the runner tries to import the directory as a module.This restores the pre-v21 behavior by detecting directory arguments and expanding them to search for default test file patterns within them.
Fixes: #64555