question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
coreyfarrellcommented, Apr 8, 2020

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.

0reactions
github-actions[bot]commented, May 4, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found