ng test runs the test suites and prints the code coverage report to the console.
ng test runs the test suites.
On a newly-created workspace, neither ng test nor ng test --code-coverage prints out the code coverage report to the console. Further, Jest commands cannot be appended to ng test to remediate, nor can ng test be easily substituted for jest.
Additionally, adding codeCoverage: true to the app's test options configuration in the angular.json does not resolve the issue. The issue also persists when adding collectCoverageFrom: ['**/*.{js,jsx}', '!**/node_modules/**', '!**/vendor/**'] to the jest.config.js module.exports.
Please provide detailed steps for reproducing the issue.
yarn create nx-workspace myworkspace);cd myworkspace);ng test);I used the instructions listed on the Getting Started page. Attempted with workspaces that included Angular, React, and Angular and React applications.
To confirm that this wasn't an issue with the latest version of Jest, I followed Jest's Getting Started instructions and ran jest --coverage, which successfully printed the code coverage report.
N/A
Thanks, in advance, for your help :)
It's not enabled by default but you can have it print to console if you add 'text' to the root jest.config.js's coverageReporters option. Feel free to make the change in your repo.
Closing this issue for now. Please reopen if you have any other issues.
You're a hero. Thanks, @FrozenPandaz!
It's not enabled by default but you can have it print to console if you add
'text'to the rootjest.config.js'scoverageReportersoption. Feel free to make the change in your repo.Closing this issue for now. Please reopen if you have any other issues.
Hi @FrozenPandaz ,
I have a nx project with Angular + Jest, how do I obtain a global (unique) coverage summaries? I'm currently using the Jest's 'text-summary' as coverageReporters but it promps as many abstracts as libraries... Any idea?
Thanks in advance.
Regards,
Romain.
Most helpful comment
It's not enabled by default but you can have it print to console if you add
'text'to the rootjest.config.js'scoverageReportersoption. Feel free to make the change in your repo.Closing this issue for now. Please reopen if you have any other issues.