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.

@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 labels Sep 10, 2024
RafaelGSS pushed a commit that referenced this issue Sep 16, 2024
PR-URL: #54728
Fixes: #54726
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
RafaelGSS pushed a commit that referenced this issue Sep 16, 2024
PR-URL: #54728
Fixes: #54726
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
RafaelGSS pushed a commit that referenced this issue Sep 17, 2024
PR-URL: #54728
Fixes: #54726
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
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 <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
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