-
-
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] findRelatedTests misses tests, especially in multi-project setups #6062
Comments
I'm happy to try to fix this, but not totally sure where to start. It looks like potentially part of Can anyone offer some guidance for getting started? |
Does it make sense to say that tests are dependent across projects? Seems like a per-project thing. If it's an issue within a single project across workspaces, I agree it should be fixed. @cpojer thoughts? |
Yeah it's not perfect. Ideally this will work but not sure how we can do that properly. |
This is cross-project/package. We want to work in a monorepo and be able to test for integration failures on breaking changes without running the entire suite of tests. |
Might be possible to fix by following the symbolic link yarn/lerna puts in |
@SimenB I'm not sure I understand what you're saying. Do you mean that the symbolic link changed? I'm fairly certain that changing a file deep down in a module won't change the stat of the symlink. |
I'll have another go! I meant that when we see a |
That sounds like a workable solution! I have some time next week to look in and attempt this if you're not already planning on it. |
Feel free! |
I'm running into this problem as well with a similar monorepo setup using yarn workspaces – it would be a huge improvement if Jest could discover related tests behind symlinks. This thread comment might be related: Add support for --preserve-symlinks |
I looked into this a bit. I think it would take a major rewrite of the jest-resolver package, since it really doesn't look at "packages" at all, so it would have to read up the tree looking for |
Any progress on this? I'm encountering the exact same issue. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Here's an absolute minimal repo that explains this same test case and can be run directly: https://github.com/paularmstrong/jest-multi-project-example
yarn
to install dependenciesyarn test
to ensure tests runyarn test --findRelatedTests --listTests projects/bar/bar.js
(test
is a package script shortcut tojest
)Expectation
We should expect to see the following files as related in the output:
Actual results
Jest does not appear to resolve related changes across project configurations and we do no receive any listed tests.
Alternatively
If we run
yarn test --findRelatedTests --listTests projects/bar/index.js
, we do receive only the file for the direct project,bar
.Why this is problematic
This is a problem because if we are in a sufficiently large project with many workspaces and many interdependencies, we may make a change to one file in a single workspace and expect to be able to run only the related tests for that change, but none will be run.
We could argue that we should just run all tests, but this can take too long (15+ minutes) to realistically ask people to do every time they make a change.
Environment
The text was updated successfully, but these errors were encountered: