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 - incorrect lines

See original GitHub issue

The function beginning at line 3 is not covered by my test suite, however the code coverage report gives me seemingly arbitrary line numbers.

1  render() {
2   // TODO: remove copy (for hot reloading)
3    const handleDivClick1 = () => {     // NOT COVERED
4      console.log('click!');
5      this.setState({
6        name: 'John'
7      });
8    };
9    return (
10     // TODO: replace onClick with class member (for hot reloading)
11     <div className={styles.color} onClick={this.handleDivClick}>{`Name: ${this.state.name}`}</div>
12   );
13 }
14}

The coverage report says that lines 10,11 are not covered, though even that changes depending on how many blank lines are included in the component.

Let me know if I can provide further information. Cheers, Tyler

EDIT: The reports with coverage/remapped are correct, it’s just the console output and reports within coverage/lcov-report that are incorrect.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
Aaron2Ticommented, Jan 20, 2017

+1 for this

2reactions
alexjovermcommented, Jan 27, 2017

Guys, not sure if is related but I’m a bit confused:

  • I only get the remapped folder when I’m in watch mode. But, in that case the coverage gets crazy and it gets lowered a lot
  • It works better just by running “jest --no-cache --coverage”, but still the coverage is not correct. It gives me statements and branches not covered (even in comments), and they are.

Coverage: https://coveralls.io/github/coosto/ShortcutJS Tests: https://github.com/coosto/ShortcutJS/tree/master/test

Wanted to open an issue but I think this one is related. Any known workaround in the meanwhile?

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Pytest incorrectly reports missing lines in coverage
I have a pytest suite with several tests. Most of them work just fine - one I just added works, but the coverage...
Read more >
Code coverage report seems incorrect. Why?
The line coverage result is the same as Sonar. My ant build file about Jacoco is: <property name="sonar.dynamicAnalysis" value ...
Read more >
Line coverage calculation seems incorrect? - SonarQube
Hello all, The line coverage (percentage) reported by SonarQube seems off: SonarQube says the Line Coverage is 90.9%, but (25125 - 1119) ...
Read more >
Configuring code coverage in Jest, the right way
I've seen enough misconfigured JavaScript projects where Jest coverage were reported incorrectly. Let's see why this matters.
Read more >
Branch coverage measurement
Statement coverage would show all lines of the function as executed. But the if was never evaluated as false, so line 2 never...
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