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: not execute the glob pattern of files correctly #52191

Closed
ramonpaolo opened this issue Mar 23, 2024 · 2 comments
Closed

test runner: not execute the glob pattern of files correctly #52191

ramonpaolo opened this issue Mar 23, 2024 · 2 comments

Comments

@ramonpaolo
Copy link

Version

v20.11.0

Platform

Darwin 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:43 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6000 arm64

Subsystem

test

What steps will reproduce the bug?

example.zip

Download the zip

# install libs(express)
$ yarn

# execute the tests
$ yarn test

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

This happen every time

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

I expected to run all tests inside folder __tests__ that end with .test.js

This is my expectation, because the glob pattern __tests__/**/*.test.js need to match with all files inside __tests__ that have the end of name of file with .test.js

References
The documentation of test runner in the site: Link

What do you see instead?

This only run the files that match *.test.js and that is only child of e2e, integration and unit folders!

Additional information

(sorry english)

@meyfa
Copy link
Contributor

meyfa commented Mar 23, 2024

Please put the glob in quotes like so:

  "scripts": {
    "test": "node --test --test-timeout 200 \"./__tests__/**/*.test.js\""
  },

(Has to be double quotes, single quotes won't work properly.)

Otherwise your shell performs the globbing and not Node.js, which is not portable between different computers and causes problems as you've discovered.

This is IMHO a mistake in the Node.js documentation.

@ramonpaolo
Copy link
Author

Put in double quotes works for me!!

I think that is a bug, because I use zsh and the glob pattern works normally! But the problem is the quotes!

Thanks @meyfa !

nodejs-github-bot pushed a commit that referenced this issue Mar 26, 2024
Refs: #52191
PR-URL: #52201
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
rdw-msft pushed a commit to rdw-msft/node that referenced this issue Mar 26, 2024
Refs: nodejs#52191
PR-URL: nodejs#52201
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants