Closed FJLopezGarcia closed 7 years ago
I am AFK this weekend. I don't know if there is a better way than modifying the regexp in src/test.ts (const context).
You could ask on the Ng-cli repo. On Fri, 3 Feb 2017 at 23:00, Javi notifications@github.com wrote:
Hi guys, Do you know how to Exclude some folder with TypeScripts from karma & coverage?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lathonez/clicker/issues/221, or mute the thread https://github.com/notifications/unsubscribe-auth/AG5tSG8i_Z9t--R6zfNysZDgkO-B9mgXks5rYxbZgaJpZM4L2P95 .
I added this inside remapIstanbulReporter
in karma.conf.js
to exclude set up files from test coverage
remapIstanbulReporter: {
remapOptions: {
exclude: /src\/(mocks.ts|test.ts|polyfills.ts)/
}
},
You can modify the regex to match the path of the folders you want to exclude.
thanks a lot @lathonez and @emmanuelroussel.
Do you know how to exclude two different paths with regex ?? I need to exclude /src\/(mocks.ts|test.ts|polyfills.ts)/ and two new files (api.ts and CompanyApi.ts) from src/app/common/api/ path.
Thanks a lot for your help!!
I think you can simply add the rest of the path of api.ts
and CompanyApi.ts
to the regex like this
/src/(mocks.ts|test.ts|polyfills.ts|app/common/api/api.ts|app/common/api/CompanyApi.ts)/
It gets a bit ugly, but it should work.
@lathonez would like me to make a PR to exclude test config files from test coverage by default?
@emmanuelroussel - I would, but it should be a PR to ng-cli not to us:
@filipesilva provided a new syntax for the .angular-cli.json
file
"test": {
"codeCoverage": {
"exclude": [
"src/polyfills.ts",
"**/test.ts"
]
},
"karma": {
"config": "./karma.conf.js"
}
},
@1M0reBug awesome, thanks for the reference.
Reopening to track merging the upstream change.
Hi, do you know how to Exclude a folder that contains TypeScripts from karma coverage?