-
-
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
Tests from different monorepo package are ignored in coverage #9323
Comments
I've added a link to the repo. Jest 25 -- same behavior. |
Jest 26 doesn't solve the issue: git clone https://github.com/the-spyke/undercut
cd undercut
yarn
yarn test --coverage |
I was able to reproduce in a smaller example here https://github.com/pveyes/jest-multi-project-monorepo-coverage-bug. I found out that using I'm currently working around it by using a combination of |
@pveyes could you share what your workaround with
|
I am having the following monorepo structure
My jest config
but it seems to be skipping bar. The only difference I can spot between bar and others is that it contains ts files only. However the directory structure is as per the glob mentioned above. Can anyone tell me how to troubleshoot this? |
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 30 days. |
This issue was closed because it has been stalled for 30 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. |
🐛 Bug Report
I have a monorepo, and some tests are in a separate package.
I have a root
ject.config.js
with projects set to an array of specific packages as<rootDir>/packages/package-X/
items, and every package has its ownjest.config.js
with some overrides. Tests work from the root and from an individual package.Tests in
packages/tests
import files from another packages by their name likeimport { } from '@user/package-a/src/utils.js';
. Those tests present in Jest output and are green, but missing in coverage output.If I add an explicit
collectCoverageFrom: [ '**/*.js' ]
then I can see those files in coverage having 0%.Changing an import to a path like
import { } from '../../package-a/src/utils.js';
has no effect. Removingnode_modules
fromcoveragePathIgnorePatterns
doesn't help too.When I run tests from the
packages/tests
with--coverage
option, all tests in this package are green, but the coverage table is empty.Adding
<rootDir>
item to theprojects
emits right coverage, but runs tests in some packages that it shouldn't (that why projects have not all packages listed).To Reproduce
Steps to reproduce the behavior:
Run Jest from the root in such monorepo configuration, there will be no coverage.
Expected behavior
Coverage should work as if imports are by path.
Link to repl or repo (highly encouraged)
Repo
Tests from
packages/undercut-tests
don't count for coverage ofpackages/undercut-pull
.envinfo
The text was updated successfully, but these errors were encountered: