Code coverage comments like `/* istanbul ignore file */` are ignored for jsx files
See original GitHub issueIs this a bug report?
Yes
Did you try recovering your dependencies?
Yes - I have a minimum repo to reproduce.
Which terms did you search for in User Guide?
istanbul comment coverage comment
Environment
System: OS: Windows 10 CPU: x64 Intel® Core™ i7-8550U CPU @ 1.80GHz Binaries: Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: 42.17134.1.0 Internet Explorer: 11.0.17134.1 npmPackages: react: ^16.7.0 => 16.7.0 react-dom: ^16.7.0 => 16.7.0 react-scripts: 2.1.2 => 2.1.2 npmGlobalPackages: create-react-app: Not Found
Steps to Reproduce
Code coverage comments like /* istanbul ignore file */
are ignored for jsx files. When you set up a new app, adding this line to index.js
doesn’t work. This seems to be related to the Babel config as pure JS files work fine.
Here’s an example repo:
- Clone https://github.com/dbartholomae/coverage-bug
- Run
npm test
(note that the command is modified in package.json and includes the coverage flag)
This could be related to #5756
Expected Behavior
Neither index.js
nor index-no-jsx.js
should show up in the coverage-report.
Actual Behavior
index.js
shows up in the coverage-report.
Reproducible Demo
See “Steps to Reproduce”
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:13 (7 by maintainers)
Top GitHub Comments
FWIW, for me the file was was only ignored if I placed this comment at the top of the file and had a newline between it and the next block:
WORKS
DOES NOT WORK
@mrmckeb may you guys add some label to prevent this from getting auto-closed by the stale bot? This is a verified issue, there’s no reason to close it automatically just because you guys are busy working on other things.