Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

Difficulty setting up code coverage #1299

Closed
sproogen opened this issue Jul 1, 2017 · 4 comments
Closed

Difficulty setting up code coverage #1299

sproogen opened this issue Jul 1, 2017 · 4 comments

Comments

@sproogen
Copy link

sproogen commented Jul 1, 2017

I am trying to implement code coverage into my project that is using this starter kit (v3.0.1).

What was the reason it was removed in v3.0.0 and is there a plan to put it back in?
Or does anyone have code coverage working using this kit?

Thanks

@sproogen sproogen changed the title Code Coverage Difficulty setting up code coverage Jul 1, 2017
@gontard
Copy link

gontard commented Jul 3, 2017

I have added a coverage reporter in karma.conf.js:

const karmaConfig = {
  ...
  coverageReporter: {
    reporters: [
      { type: 'text-summary' },
      { type: 'lcov', dir: 'coverage' }
    ]
  }
  ...
}

and at the end:

const withCoverage = !argv.watch;
if (withCoverage) {
  karmaConfig.reporters.push('coverage');
  const babelLoader = webpackConfig.module.rules[0].use[0];
  babelLoader.query.plugins.push(['istanbul', {
    exclude: [
      `tests/**/*.js`
    ]
  }]);
}

@sproogen
Copy link
Author

sproogen commented Jul 3, 2017

I have managed to figure this out earlier and get code coverage mostly working.

@gontard I have also just tried your solution and it didn't seem to work. I have copied in your config exactly as you said and it just prints out 100% coverage but without finding any of the files.
So it prints out like 100% ( 0/0 )

@stelioschar
Copy link

@sproogen I confirm the same problem with the above solution.
What was your working configuration?

@sproogen
Copy link
Author

sproogen commented Aug 2, 2017

@stelioschar I created this pull request here #1307

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants