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

Unexpected breaking change in Test Runner in v21 #50219

Closed
egoroof opened this issue Oct 17, 2023 · 5 comments
Closed

Unexpected breaking change in Test Runner in v21 #50219

egoroof opened this issue Oct 17, 2023 · 5 comments
Labels
test_runner Issues and PRs related to the test runner subsystem.

Comments

@egoroof
Copy link

egoroof commented Oct 17, 2023

Version

v21.0.0

Platform

windows 11

Subsystem

No response

What steps will reproduce the bug?

As from official v20 documentation (Running tests from the command line) it was allowed to run tests in following command:

node --test custom_test_dir/

The test runner will recursively search the custom_test_dir/ directory for test files to execute.

But in v21 it is not working anymore:
image

Why is it a breaking change for stable API ?

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

No response

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

Stable API from official documentation should not be changed in every major version

What do you see instead?

see "What steps will reproduce the bug" chapter

Additional information

No response

@meyfa
Copy link
Contributor

meyfa commented Oct 17, 2023

I warned about this exact behavior change in the original PR: #47653 (comment)

The reasoning seems to be that performance would be impacted and it would be hard to understand which files are selected by a glob and which aren't.

While I think the breaking change is unfortunate, I think it's somewhat reasonable because with a glob you can specify file extensions properly, for example, while the v20 test runner only ever loads files with very specific names.

@mertcanaltin mertcanaltin added the test_runner Issues and PRs related to the test runner subsystem. label Oct 19, 2023
@cjihrig
Copy link
Contributor

cjihrig commented Oct 21, 2023

@MoLow is this expected behavior with the new glob support?

@MoLow
Copy link
Member

MoLow commented Oct 21, 2023

Yes, node --test directory should be replaced with node --test directory/**/*.test.?(c|m)js or a similar pattern
this is part of why adding glob was a breaking change

@MrHBS
Copy link

MrHBS commented Nov 2, 2023

I suppose this can be closed then?

@cjihrig cjihrig closed this as completed Nov 16, 2023
@Pyrolistical
Copy link

Also, it seems like if you don't specify a directory the default glob works. So for some people replacing node --test directory with node --test works if all the tests happen to be in directory anyways

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

No branches or pull requests

7 participants