istanbul-ignore-file comments getting ignored
See original GitHub issueIssue :
When using babel, istanbul-ignore-file comments are ignored and the files are included in coverage. setting useBabelrc: false
gives the desired outcome.
The repo I’m providing tests both .ts
and .js
because I wasn’t sure if the issue was ts-jest or some other factor. For the js files I was able to get jest to respect the istanbul comments by trying a different preset: @babel/preset-env
instead of the metro-react-native-babel-preset
I need for react native. For the ts files the istanbul comments are ignored regardless. I wonder if there’s some common reason?
Expected behavior :
Files with /* istanbul ignore file */
should be omitted from coverage reports.
Minimal repo :
https://github.com/donovanhiland/ignoring-istanbul-ignore-file
Possibly related issue opened here: https://github.com/facebook/metro/issues/360
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:6
Top GitHub Comments
Reproducible on
ts-jest
25.2.1
andjest
25.1.0
Update: This doesn’t seem to be a
ts-jest
problem, or at least, I can no longer reproduce this issue with the above versions. The problem apparently was that an empty line is needed below this comment at the top of the file. This is poorly documented byistanbul
, butts-jest
should be good here. It should be safe to close this issue nowIn my case the pragmas wouldn’t work unless I had:
coverageProvider: ‘babel’
in my jest.config.js