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
[Docs]: Mention "rootDir" points to a different directory when using "projects" #12691
Comments
A mention like this in the docs would be extremely helpful:
There's certainly a more straightforward explanation than this. |
PR very much welcome! |
Hey, @SimenB. Awesome! I'll open a pull request as soon as I have a minute. |
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. |
I've opened a pull request that addresses this change to the documentation. Would appreciate a review! |
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. |
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. |
The pull request is opened since a few months back: #12871 |
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. |
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
27.0.6
Steps to reproduce
Consider the following root-level configuration:
Expected behavior
This needs to be mentioned in the documentation for
projects
. I've spent two days trying to understand why Jest doesn't pick up correct glob patterns incollectCoverageFrom
just to find out thatrootDir
doesn't mean what I expect it to mean.I've checked both projects and collectCoverageFrom sections of the documentation and found no mention whatsoever that would've helped me save time debugging.
Actual behavior
The values of
rootDir
in those two configuration options point to different paths:projects
therootDir
points to CWD, effectively.collectCoverageFrom
therootDir
points to each project's root directory.This is confusing because the same placeholder is written in the same module but means different things.
Why this happens
This happens because when using
projects
Jest appends configurations likecollectCoverageFrom
to each individual project's configuration. In other words, therootDir
incollectCoverageFrom
gets evaluated on each individual project's run, while therootDir
inprojects
is evaluated when the root-level config is parsed.Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: