question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Karma coverage does not show any data when using webpack + ES6

See original GitHub issue

Hi

My config

module.exports = function(config) {
  config.set({
    browsers: ["ChromeCanary"],
    coverageReporter: {
      type: "html",
      dir : "./docs/js-coverage"
    },
    files: [{
        pattern: "test.bundle.js",
        watched: false
      }],
    frameworks: ["jasmine"],
    preprocessors: {
        "src/main/webapp/**/*.js": "coverage",
        "test.bundle.js": ["webpack"]
    },
    reporters: ["coverage", "dots"],
    singleRun: false,
    webpack: {
        module: {
            loaders: [{
                  test: /\.js/,
                  exclude: /node_modules/,
                  loader: "babel-loader?cacheDirectory&optional[]=runtime"
                }]
        },
        watch: true
    },
    webpackServer: {
        noInfo: true
    }
  });
};

test.bundle.js

var context = require.context("./src/main/webapp", true, /.+\.test\.js$/);
context.keys().forEach(context);

Tests run fine, HTML report is generated, but it contains no files in the list.

Thanks.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:10
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
florin05commented, Nov 30, 2017

Was not able to get coverage information with webpack (2) and karma-coverage. Had to use both “istanbul-instrumenter-loader” as a webpack file loader for test run and “karma-coverage-istanbul-reporter” as coverage reporter and after couple of days of struggles it worked.

3reactions
songguangyucommented, Nov 26, 2017

coverage sourcemap not work. only index.js. image image

no filelists, can you help me?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Karma Coverage not picking up everything using Webpack
The problem is I have other files inside of the src/ folder that it doesn't seem to be detecting. For example I have...
Read more >
ES6, Webpack, Karma, and Code Coverage - YouTube
These days it's best to just use Jest and be done with it...**I gave this talk at UtahJS June 16th, ...
Read more >
ES6, Webpack, Karma, and Code Coverage by Kent C. Dodds
Setting up test coverage reporting with ES6 and Karma. ... Kent will show you what you can do to stay in front of...
Read more >
Natively Unit-Testing ES6 Modules in Browser Including ...
You can control this when invoking karma using option --single-run or --no-single-run. preprocessors usually integrate transpilers. Code ...
Read more >
istanbul-instrumenter-loader - webpack - JS.ORG
karma-webpack · karma-coverage-istanbul-reporter ... create a code coverage report for all components (even for those for which you have no ... with Babel....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found