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.
would it be possible for you to create a minimal repo that reproduces this issue?
Yep, here it is:
https://github.com/tyleralves/tsJestExample
thanks @tyleralves
I'll try to take a look at this as soon as I find some time!
+1 for this
@tyleralves I was trying this out now and just noticed the edited part of the original issue. I think this is a known issue.
Note that I haven't worked on the coverage part I'm not too familiar with it. I hope @kwonoj can confirm/refute this
I have to admit current coverage ergonomics causes confusions between what to trust / what to not to trust, and also what is not possible.
Console / terminal output summary
: @kulshekhar is correct, it is known issue and cannot have workaround at the moment. refer attached issue comment for detail. (https://github.com/kulshekhar/ts-jest/issues/42#issuecomment-256792842) It may need some documentation / instruction for this.
What coverage report is accurate?
coverage/remapped is one you need look into. reports directly under coverage is original one created via jest, and remapped is actual coverage postprocessed by jest. I've made those orgnization without give much caution by I was too familiar jest generated reports under coverage, and it makes sense to preserve original for anyone need to take look into those. probably remove orignal coverage or support https://github.com/kulshekhar/ts-jest/issues/61 might have less confusion.
https://github.com/kulshekhar/ts-jest/issues/101 is related as well related to console summary.
Guys, not sure if is related but I'm a bit confused:
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?
Closing in favor of #101
The --no-cache option works for me
I do not have the remapped folder inside coverage.
How can I get an accurate/remapped coverage report?
Most helpful comment
I have to admit current coverage ergonomics causes confusions between what to trust / what to not to trust, and also what is not possible.
Console / terminal output summary
: @kulshekhar is correct, it is known issue and cannot have workaround at the moment. refer attached issue comment for detail. (https://github.com/kulshekhar/ts-jest/issues/42#issuecomment-256792842) It may need some documentation / instruction for this.
What coverage report is accurate?
coverage/remappedis one you need look into. reports directly undercoverageis original one created via jest, andremappedis actual coverage postprocessed by jest. I've made those orgnization without give much caution by I was too familiar jest generated reports under coverage, and it makes sense to preserve original for anyone need to take look into those. probably remove orignal coverage or support https://github.com/kulshekhar/ts-jest/issues/61 might have less confusion.