coverage report not produced with --passWithNoTests flag and no tests
See original GitHub issue🐛 Bug Report
We use Coveralls to centralize our test coverage on all our services. New services start with no tests and we use the --passWithNoTests
flag for our coverage report step in CircleCI. Which looks like this
jest --coverage --passWithNoTests --runInBand && cat ./coverage/lcov.info | coveralls
We’ve noticed Coveralls failing because the ./coverage/lcov.info
doesn’t get created and coveralls fails to parse
No tests found, exiting with code 0
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 0 | 0 | 0 | 0 | |
----------|----------|----------|----------|----------|-------------------|
[error] "2020-01-09T15:58:11.526Z" 'error from lcovParse: ' 'Failed to parse string'
[error] "2020-01-09T15:58:11.527Z" 'input: ' ''
[error] "2020-01-09T15:58:11.528Z" 'error from convertLcovToCoveralls'
/home/circleci/project/node_modules/coveralls/bin/coveralls.js:19
throw err;
^
Failed to parse string
To Reproduce
Steps to reproduce the behavior:
Run the following
jest --coverage --passWithNoTests --runInBand && cat ./coverage/lcov.info
No /coverage/lcov.info
is produced.
However, with a dummy/stub test it does work and produces the file.
Expected behavior
A valid coverage file would be produced with no tests if the --passWithNoTests
flag is set.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Why is Jest not inferring tests coverage lines correctly?
Focus of the question: understand why Jest is not considering my tests that cover the lines that Jest complains about not being covered....
Read more >Jest CLI Options
The jest command line runner has a number of useful options. You can run jest --help to view all available options. Many of...
Read more >Measuring Typescript Code Coverage with Jest and GitHub ...
As part of the output Jest generates, you'll see not only the test results but also the code coverage report. Since the current...
Read more >Unit Testing - Webpack from Nothing
[boolean] --mapCoverage Maps code coverage reports against original source ... [string] --passWithNoTests Will not fail if no tests are found (for example ...
Read more >Run react-script tests without watch - Marcusoft.net
It's not an error either but just some information. The problem is that no change has been made, and I still want to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Probably. At minimum it shouldn’t say “parse error” it should detect the special case of an empty file. Not sure if it should report to the coveralls server in this case, I’d think yes so that coveralls site can report that no coverage was received rather than just being unaware of that CI run.
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.