nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.29k stars 2.32k forks source link

Jest coverage report does not print to console with 7.8.5 #1337

Closed zachnewburgh closed 5 years ago

zachnewburgh commented 5 years ago

Prerequisites

Expected Behavior

ng test runs the test suites and prints the code coverage report to the console.

Current Behavior

ng test runs the test suites.

Failure Information (for bugs)

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.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Create a new workspace (yarn create nx-workspace myworkspace);
  2. Move into the new workspace (cd myworkspace);
  3. Run the tests (ng test);
  4. Notice that the tests run successfully and the coverage directory is created.

Context

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.

Failure Logs

N/A

Other

Thanks, in advance, for your help :)

FrozenPandaz commented 5 years ago

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.

zachnewburgh commented 5 years ago

You're a hero. Thanks, @FrozenPandaz!

RoRoche commented 3 years ago

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.

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.

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.