Please provide us with the following information:
Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 10
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:
angular-cli: 1.0.0-beta.19-3
node: 5.10.1
os: win32 x64
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
N/A
Normally this include a stack trace and some more information.
N/A
Is there any way to exclude files/folders from test coverage (other than naming them .spec.ts)?
For example if I wanted to put some reusable bits of test code in src/app/common/testing/* I wouldn't want files included in this directory to be reported on.
Thanks!
Thanks! We'll be in touch soon.
Just wanted to make sure you all know that upgrading your project to karma-remap-istanbul:^0.3.0 will allow you to use their exclude property.
marcules/karma-remap-istanbul#26
I just tried installing karma-remap-istanbul:^0.3.0 and karma-remap-istanbul:^0.4.0 with no luck at all.
Excluded path includiing '/data/' still in reports.
karma.conf.js:
remapIstanbulReporter: {
remapOptions: {
exclude: '/data/',
},
reports: {
html: 'coverage',
lcovonly: './coverage/coverage.lcov'
}
},
Versions:
angular-cli: 1.0.0-beta.24
Thanks in advance for any ideas or help?
@nestor forgive me but I just want to be sure that you:
Not totally sure myself how the string implementation works but if everything else checks maybe switch to regex?
HTH
Hi, @dpmorrow, answers follow:
After some research look like istanbul generate the LCOV file depending on the platform which add a platfom dependen matching which a worked around using a regexp accepting slash and backslash as separator.
Will need some time to fork istanbul repo and test it under windows locally.
When RC is released you will be able to configure the following section in the .angular-cli.json file:
"test": {
"codeCoverage": {
"exclude": ["glob/to/ignore"]
},
...
}
Fixed in master by #4966
With the latest CLI 6+ add excluded files or paths to angular.json -> test -> options like so:
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "./karma.conf.js",
"codeCoverageExclude": ["src/testing/**/*"],
I should add, this addition was found by going through the schema
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
With the latest CLI 6+ add excluded files or paths to angular.json -> test -> options like so:
I should add, this addition was found by going through the schema