Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hyunbinseo opened this issue Sep 3, 2024 · 1 comment · Fixed by #54728
Closed

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

hyunbinseo opened this issue Sep 3, 2024 · 1 comment · Fixed by #54728
Labels
confirmed-bug Issues with confirmed bugs. regression Issues related to regressions. test_runner Issues and PRs related to the test runner subsystem. v22.x v22.x Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.

Comments

@hyunbinseo
Copy link

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

@jakecastelli jakecastelli added the test_runner Issues and PRs related to the test runner subsystem. label Sep 3, 2024
@pmarchini
Copy link
Member

Hey @hyunbinseo , I believe this issue is caused by the following regex matching pattern: https://github.com/nodejs/node/blob/main/lib/internal/test_runner/utils.js#L54 -> *[.-_]test

I've created a repro and proposed a possible solution in this pull request: #54728.

@RedYetiDev RedYetiDev added the repro-exists Issues with reproductions. label Sep 3, 2024
@jakecastelli jakecastelli added the regression Issues related to regressions. label Sep 3, 2024
@RedYetiDev RedYetiDev added the v22.x v22.x Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch. label Sep 3, 2024
@RedYetiDev RedYetiDev added confirmed-bug Issues with confirmed bugs. and removed repro-exists Issues with reproductions. labels Sep 10, 2024
RafaelGSS pushed a commit that referenced this issue Sep 16, 2024
PR-URL: #54728
Fixes: #54726
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Jake Yuesong Li <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
RafaelGSS pushed a commit that referenced this issue Sep 16, 2024
PR-URL: #54728
Fixes: #54726
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Jake Yuesong Li <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
RafaelGSS pushed a commit that referenced this issue Sep 17, 2024
PR-URL: #54728
Fixes: #54726
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Jake Yuesong Li <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
louwers pushed a commit to louwers/node that referenced this issue Nov 2, 2024
PR-URL: nodejs#54728
Fixes: nodejs#54726
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Jake Yuesong Li <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. regression Issues related to regressions. test_runner Issues and PRs related to the test runner subsystem. v22.x v22.x Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants