I am trying to introduce e2e code coverage in my react app. I can see hash-file.json
is getting created in .nyc_output
below are my package.json
scripts
{
"start": "npm run clean && cross-env NODE_ENV=test node ./tools/devServer.js",
"e2e": "nyc cypress open",
}
its not updating .nyc_output/out.json
.babelrc
{
"presets": [
"@babel/preset-react"
],
"env": {
"test": {
"plugins": [ "istanbul"], {
"exclude": [
"src/**/*.spec.js",
"src/**/*.test.js",
"e2e-coverage"
],
"include":["src/"]
}]
}
},
"ignore": ["node_modules","build"]
}
What are the above has-file.json, and why it gets created, if i followed correctly instead of this it should write the coverage in out.json ?
I followed the document, but still it looks like there is some issue in instrumenting the code. (what could be the issue ?)
In some of the examples i saw logs with
isInteractive:true
, what is this meant for and where is its configuration handler ?What could be the expected cause for it not getting instrumented
Solution:-
I followed and included the instrumenting process as part of webpack build loader, and it's working fine. But still i am looking answers for by above points.
I was expecting babel-istanbul-plugin
will do it on the fly, no need to do with webpack.
https://webpack.js.org/loaders/istanbul-instrumenter-loader/