-
-
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
[Bug]: v30 alpha: testPathPatterns
that worked in the past not working any more.
#14726
Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Do you have a full reproduction? |
@SimenB I would assume that this literally happens in every project using jest - it's just a completely different file name matching logic than before now. But if this is actually some edge case and not intended to happen, I can create a branch of the Apollo Client repo with jest 30 after the new year; it definitely happened there, but I rolled back without creating a commit/branch, because it was completely unusable. |
I'll try to reproduce it once I'm back at the job :) |
Cool 👍 Enjoy your vacation! Ideally the reproduction is not the entire |
execute ```sh node --expose-gc ./node_modules/jest/bin/jest.js --config ./config/jest.config.js useSuspense ```
So the easy (for me) reproduction is unfortunately Check out and run npm i
node --expose-gc ./node_modules/jest/bin/jest.js --config ./config/jest.config.js useSuspense which will error with (I ran it with
The test setup here contains three projects, and the third one should match the file I'll try if I can distill this down to a smaller reproduction, but already wanted to post this here :) |
See next post. |
Follow-up:
So I switched it over to
and it's failing to find the tests again. So this might actually not be resolved? Do any alarm bells ring for you in combination with |
This seems to be caused by the test path pattern being generated from the global config, not the project config In our case and with that knowledge, I can work around this by adding a global module.exports = {
rootDir: `../src`,
projects: [tsStandardConfig, standardReact17Config, standardReact18Config],
}; But I assume it might be generally not correct to create the |
We looked at global config's root dir in v29 as well (have done for years). However, I do agree that seems odd 🤔 @brandon-leapyear thoughts on this one? |
FYI In the future, can you ping @brandonchinn178 instead? That account was my account for a company I worked at that has been acquired. Thanks! Ah yes, so the test pattern logic used to not care about a root directory at all, it just searched the whole test file path. Now, the test pattern is actually sensitive on the root directory, and I just used the I think the best fix would be to change |
Is there a reason to include a directory at all? From looking through the code with the debugger, it seems to me like these tests will only be applied to files that have been found within a project's |
Correct, but the pattern needs to only match the relative path of the files, while the list of files is stored as a list of absolute paths. So we need to apply the pattern to only the relative part of the path, however we define what "relative" means. So the two options are:
I chose to do the first way, but the second is equally valid. But either way, you need to define the directory the paths should be considered relative against. To reiterate the motivation for the PR, I was trying to run tests in my project named |
I honestly don't really understand why we have |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Re: stale. |
I did start messing around with removing a bunch of config from For |
@brandonchinn178 would you be able to send that PR? 🙂 |
@SimenB PR submitted! |
@phryneas sorry about the delay - can you give https://github.com/jestjs/jest/releases/tag/v30.0.0-alpha.5 a whirl? |
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. |
Version
30.0.0-alpha.2
Steps to reproduce
Expected behavior
Jest finds the matching file
src/react/hooks/__tests__/useLoadableQuery.test.tsx
and executes itActual behavior
No tests found, exiting with code 1
Additional context
I understand that jest 30 had a change (in #12519) from a
[TestPathPattern]
option to[TestPathPatterns]
, but honestly, I'm failing to get anything to match this new option, even specifying the full path to the test doesn't work.From the issue, it seems like this doesn't accept a RegEx anymore, but an array of patterns - but I'm not sure how to write those patterns. I'm getting errors like
Invalid testPattern **/useLoadableQuery.* supplied. Running all tests instead.
.This might be user error, but this change is very unexpected, and will probably seriously impact the workflows of most jest users and a ton of CI scripts, so I thought I'd open an issue to bring this to your attention.
Environment
The text was updated successfully, but these errors were encountered: