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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting "coverageReporters" : ["json"] causes code coverage to not run #8563

Closed
n8ores opened this issue Jun 13, 2019 · 8 comments
Closed

Setting "coverageReporters" : ["json"] causes code coverage to not run #8563

n8ores opened this issue Jun 13, 2019 · 8 comments

Comments

@n8ores
Copy link

n8ores commented Jun 13, 2019

馃悰 Bug Report

Setting "coverageReporters" : ["json"] in the package.json file causes the code coverage to partially run.

  1. No code coverage output will be generated in the console.
  2. The coverage directory is created successfully with the coverage_report.json inside it, however, this report contains a blank object {}.

To Reproduce

Setup any vanilla nodejs installation with the below JEST configuration in your packages.json file.

"jest": { "collectCoverage": true, "coverageDirectory": "../coverage", "testPathIgnorePatterns": [ "/node_modules/" ], "coverageReporters" : ["json"], "verbose": true, "coverageThreshold": { "global": { "branches": 50, "functions": 50, "lines": 50, "statements": 50 } } },

Expected behavior

The coverage report file should contain the code coverage values and the code coverage results should still be outputted to the console as occurs when "coverageReporters" is omitted.

@kirintwn
Copy link

According to the official docs:

Add "text" or "text-summary" to see a coverage summary in the console output.

e.g. coverageReporters: ['json', 'text'],

As for the blank output in json file, the problem might be no test matching the pattern with testMatch default pattern.

@tiendq
Copy link
Contributor

tiendq commented Jun 15, 2019

If no test matched then coverage is empty (contains {}), no matter I set coverageReporters or not.

@yadavadarsh

This comment has been minimized.

@ThePeach
Copy link

at all related to #9319 ?

@JamesXiaoFF
Copy link

How to translate : coverageReporters: ['json', { file: 'xxx.json' }]
in package.json scripts

@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale label May 12, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 11, 2023
@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants