lathonez / clicker

Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
http://lathonez.com/2018/ionic-2-unit-testing/
MIT License
430 stars 137 forks source link

Coverage is not including all files #226

Closed RobertoDebarba closed 7 years ago

RobertoDebarba commented 7 years ago

Hey!

Again, nice work! Now I am having a issue with test coverage. When I run npm test-coverage the report includes only executed files, but it should include the files who ware not executed with 0% coverage.

Example: In providers folder I have 3 files: backend.service.ts, clock.service.ts and date.service.ts. I just have test for backend.service.ts, so the other two files dont appear on coverage report and the percent of coverage turn bigger that it realy are.

lathonez commented 7 years ago

I can't replicate this behaviour. If I do the following in my repo:

rm src/services/clickers.spec.ts
rm -rf coverage
npm run test-coverage

I get this in my coverage report:

screenshot-20170214074655-687x377

lathonez commented 7 years ago

The issue for you is probably that your file isn't being loaded (included at all) by any of the code that your test is running.

Ultimately, this is an upstream issue for ng-cli:

https://github.com/angular/angular-cli/issues/1735

RobertoDebarba commented 7 years ago

Yeah, that's it!

Thanks.