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

No coverage table by npm run karma #115

Closed mbakker96 closed 8 years ago

mbakker96 commented 8 years ago

Hi,

I don't get a coverage table after running npm run karma in the clicker app and my own project.

SUMMARY:
✔ 27 tests completed
----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
----------|----------|----------|----------|----------|----------------|
All files |      100 |      100 |      100 |      100 |                |
----------|----------|----------|----------|----------|----------------|

I'm trying to solve this problem by reading the coverage documentation and look for difference in the code and the docs.

Martijn

lathonez commented 8 years ago

I also get no coverage from npm run karma.

I wouldn't put too much time into it, it's a debug mode anyway so you're not going to be looking there for coverage. If anything coverage data is going to just get in the way when we're trying to debug.

We could disable coverage in debug mode:

x220:~/code/clicker$ git diff test/gulpfile.ts
diff --git a/test/gulpfile.ts b/test/gulpfile.ts
index 85a6a37..fc4b19d 100644
--- a/test/gulpfile.ts
+++ b/test/gulpfile.ts
@@ -71,6 +71,7 @@ gulp.task('karma-debug', (done: Function) => {
     configFile: join(process.cwd(), config.testDir, 'karma.config.js'),
     singleRun: false,
     browsers: ['Chrome'],
+    reporters: ['mocha'],
   };
mbakker96 commented 8 years ago

Good plan!

The coverage/ folder works good when running karma. (Maybe good to know)

lathonez commented 8 years ago

The coverage/ folder works good when running karma. (Maybe good to know)

@mbakker96 What do you mean, sorry?

lathonez commented 8 years ago

Leaving open to track the above change

mbakker96 commented 8 years ago

When you run npm run karma the coverage website is created without any errors

lathonez commented 8 years ago

Interesting, thanks.