Skip to content
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

jest works fine, but with the coverage flag many tests fail #151

Open
ctsstc opened this issue Jul 14, 2023 · 1 comment
Open

jest works fine, but with the coverage flag many tests fail #151

ctsstc opened this issue Jul 14, 2023 · 1 comment

Comments

@ctsstc
Copy link

ctsstc commented Jul 14, 2023

It seems when I just run npx jest everything runs just fine, all the tests pass in record time.

As soon as I try to pass the coverage flag over I get many failures ie: npx jest --coverage.

If I run the test suite that is failing in isolation everything seems to run fine ie: npx jest src/app.module.spec.ts --coverage --collectCoverageFrom=src/app.module.ts

If I remove the collectCoverageFrom flag then it proceeds to fail again ie: npx jest src/app.module.spec.ts --coverage

It seems as if many of the dependencies that are mocked out in a test are not being mocked. If I isolate the coverage collection it seems to be fine, but then it seems that when all the files are gathered for coverage it's causing issues. Is it trying to run the code crawling through the AST instead of through the spec implementation that mocks things out?

@ctsstc
Copy link
Author

ctsstc commented Jul 14, 2023

I just deleted: node_modules, coverage, build.

Ran: npm i, npx jest --clearCache, now for whatever reason it seems I'm able to run npx jest --coverage without issue 🤷😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant