Instrumenting the code is dependent on the way you serve the app, but for plain javascript (not bundled) see this blog Code Coverage for End-to-end Tests
The cp command answers your question about how to handle non-js file. Essentially everything ends up (duplicated and instrumented) in build/src
.
package.json
{
"scripts": {
"build": "npm run instrument && npm run cp",
"preinstrument": "npm run clean",
"instrument": "nyc instrument --compact false src build/src",
"cp": "cp src/*.css build/src && cp src/*.png build/src && cp index.html build",
"clean": "rm -rf build .nyc_output || true",
"report:coverage": "nyc report --reporter=html"
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…