You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
http-server to easily show the generated html files. Running npm run coverage is easier than navigating to the root html file of the code coverage result.
karma-remap-istanbul to generate the report.
sourcemap-istanbul-instrumenter-loader to show original TypeScript files, not the transpiled ones.
1.2) Add the scripts to show the code coverage (the report is generated when you run the tests).
You might want to consider adding code coverage to the Angular 2 scaffold.
Here's how I did it:
1) Modify
package.json
1.1) Add the following to devDependencies:
http-server
to easily show the generated html files. Runningnpm run coverage
is easier than navigating to the root html file of the code coverage result.karma-remap-istanbul
to generate the report.sourcemap-istanbul-instrumenter-loader
to show original TypeScript files, not the transpiled ones.1.2) Add the scripts to show the code coverage (the report is generated when you run the tests).
2) Modify
ClientApp/test/boot-tests.ts
to load all.ts
files, othewise it will only show the code coverage for the components touched by test files.3) Modify
ClientApp/test/karma.conf.js
to generate the code coverage:3.1) Update webpack config to use
sourcemap-istanbul-instrumenter-loader
:3.2) Add the reporter and use our modified webpack config:
4) Update
.gitignore
so it ignores the coverage results:Result:
Sample repo:
https://github.com/ManuelDeLeon/jss-angular-code-coverage
Hope it helps.
The text was updated successfully, but these errors were encountered: