I am running the following command to unit test and generate code code coverage report.
ng test --code-coverage
It is writing code coverage re
1) in ./src/test.ts set / Then we find all the tests.
const context = require.context(‘./app/’, true, /\.ts/);
instead of standart 2) update src/tsconfig.spec.json with
“include”: [
“**/*.ts”
3) in angular.json set
“test”: {
“builder”: “@angular-devkit/build-angular:karma”,
“options”: {
“codeCoverage”: true,
“main”: “src/test.ts”,
“polyfills”: “src/polyfills.ts”,
“tsConfig”: “src/tsconfig.spec.json”,
“karmaConfig”: “src/karma.conf.js”,
“styles”: [
“src/styles.scss”
],
“scripts”: [],
“assets”: [
“src/favicon.ico”,
“src/assets”,
“src/config”,
“src/manifest.json”
]
}
}
I mean add this param “codeCoverage”: true
And for me it includes all files
I mean add this param “codeCoverage”: true
And for me it includes all files