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 cannot find tests in multiple levels when using ** in tha path #50287

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

Comments

@w3nl
Copy link

w3nl commented Oct 19, 2023

Version

20

Platform

Linux tux 6.5.0-9-generic #9-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 7 01:35:40 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

node --test src/**/*.test.js
Only finds tests in all folders in that level, e.g.
src/a/a.test.js and src/b/b.test.js
It cannot find a level deeper, like src/a/b/c.js

It works with node --test src/ in Node 20
But in Node 21 I receive an error, because it thinks that it can test the file src, but src is a folder.

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

Tests in multiple folder levels and usage of /**/ in the cli

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

That /**/ also find tests in multiple levels.

What do you see instead?

That /**/ just check for test files in a single level

Additional information

No response

@w3nl w3nl changed the title Test runner cannot find in multiple levels when using ** Test runner cannot find tests in multiple levels when using ** in tha path Oct 19, 2023
@meyfa
Copy link
Contributor

meyfa commented Oct 19, 2023

Have you tried quoting the path on the command line?

node --test "src/**/*.test.js"

Otherwise your shell may evaluate the glob before Node.js has any chance of processing it.

@tniessen tniessen added the test_runner Issues and PRs related to the test runner subsystem. label Oct 19, 2023
@w3nl
Copy link
Author

w3nl commented Oct 20, 2023

Node 20.8.1:

Could not find '.../src/**/*.test.js'

Node 21:
Works 🎉

@meyfa
Copy link
Contributor

meyfa commented Oct 20, 2023

Oh, I overlooked the Node.js version in your issue. Glob support was only added to v21. Good to hear your problem is solved; I think this can be closed then?

@w3nl
Copy link
Author

w3nl commented Oct 20, 2023

Clear for me.

But then we have a way it works for Node 20
node --test src

And a way it works for Node 21
node --test "src/**/*.test.js"

But the first command doesn't work on Node 21 and the second doesn't work on Node 20.
What is the way it works for both Node versions?

@MoLow
Copy link
Member

MoLow commented Oct 21, 2023

Unfortunately this was a breaking change so it won't work the same in node 21 and node 20.

@MoLow MoLow closed this as completed Oct 21, 2023
robatwilliams added a commit to robatwilliams/es-compat that referenced this issue Jan 30, 2024
robatwilliams added a commit to robatwilliams/es-compat that referenced this issue Jan 30, 2024
* Convert tests to Node test framework

* Make the tests run (despite nodejs/node#50287)

* Remove Jest

* Drop old Node 14
andre-brdoch pushed a commit to andre-brdoch/advent-of-code-2024 that referenced this issue Nov 28, 2024
Finding test files with `**` glob syntax was not working. That feature required node 21: nodejs/node#50287 (comment)
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

4 participants