Skip to content

test_runner: latest.js file is included by default #54726

@hyunbinseo

Description

@hyunbinseo

Version

v22.7.0

Platform

No response

Subsystem

No response

What steps will reproduce the bug?

  1. Create an empty latest.js file
  2. Run the Node.js test runner
fnm use 20
# Using Node v20.17.0

node --test
# ℹ tests 0
# ℹ suites 0
# ℹ pass 0
# ℹ fail 0
# ℹ cancelled 0
# ℹ skipped 0
# ℹ todo 0
# ℹ duration_ms 4.365042
fnm use 22
# Using Node v22.7.0

node --test
# ✔ latest.js (43.960958ms)
# ℹ tests 1
# ℹ suites 0
# ℹ pass 1
# ℹ fail 0
# ℹ cancelled 0
# ℹ skipped 0
# ℹ todo 0
# ℹ duration_ms 53.687041

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

By default, Node.js will run all files matching these patterns:

**/*.test.?(c|m)js
**/*-test.?(c|m)js
**/*_test.?(c|m)js
**/test-*.?(c|m)js
**/test.?(c|m)js
**/test/**/*.?(c|m)js

https://nodejs.org/api/test.html#running-tests-from-the-command-line

What do you see instead?

latest.js filename does not match the above patterns, but is included in node --test

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.regressionIssues related to regressions.test_runnerIssues and PRs related to the test runner subsystem.v22.xIssues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions