-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
testMatch doesn't glob as expected #7108
Comments
Same issue here:
|
Same behaviour here with |
Can you try this with My guess is that it's the relative pathing |
This indeed works, but what if you don't want to match potentially deeper It is still unexpected behaviour that such a simple glob wouldn't work, the workaround isn't really equivalent unfortunately (over-matching). |
Thanks! We can look into why those globs don't work - just wanted to verify that it's the relative pathing |
We're also seeing a similar issue. However, the globbing file expansion is inconsistent between different machines. |
looking back, this bug would've been in jest 23.6.0. today, trying jest again, and the same bug shows up for v24.5.0. the bug seems largely the same, but jest is now at least showing which files are being picked up by which matchers. though it still is reporting that zero tests are found. at first it looked like there was progress here, those tests were originally written for mocha, so jest is technically correct, there are no jest tests in those files. i converted them over, and reran the command, but still ended up with files matching, but no tests found.
|
Jest is using an older version of micromatch; perhaps that could be part of the issue here. See also #8510 |
I too have problems with the Changing the built in: testMatch: [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[tj]s?(x)"
], to testMatch: [
"src/**/__tests__/**/*.[jt]s?(x)",
"src/**/?(*.)+(spec|test).[tj]s?(x)"
], will cause no files to be matches. To resolve this i have to: testMatch: [
path.join(__dirname, 'src/**/__tests__/**/*.[jt]s?(x)'),
path.join(__dirname, 'src/**/?(*.)+(spec|test).[tj]s?(x)'),
], |
I also have to:
instead of
in my package.json scripts |
If Jest upgrades to the latest version of micromatch, it might fix this issue completely. |
It's been over a year since the last activity on this issue. I am still seeing it in Jest 27.1.0. @rickhanlonii could you please upgrade the version of micromatch? |
@ndrewtl we are on the latest version of micromatch, and we've moved to picomatch in some cases. I'm going to close this as it's pretty old and we've changed the dependencies. If you're still having issues, please create a PR with a test. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
i'm setting up jest's testMatch config, but it doesn't glob as expected. my sanity-check command looks into the test folder relative to the project, goes to any depth, and selects any file that ends in .js:
ls ./test/**/*.js | wc -l
running that returns 92. which makes sense, i have 92 files in that directory structure (some tests and some test utils). but when i run jest with the same glob it says there are no tests found:
is this an issue with jest? with micromatch?
The text was updated successfully, but these errors were encountered: