karma-coverage icon indicating copy to clipboard operation
karma-coverage copied to clipboard

Infinite loop when adding reporters type `html`

Open cvlos opened this issue 6 years ago • 2 comments

Issue:

I wanted to get a report on both the console and in an output folder. However, when I add type: 'html', the tests goes into infinite loop.

Karma.config.js:

files: [
      {pattern: 'karma/karma.entry.js', watched: false},
],
reporters: ['progress', 'coverage', 'remap-coverage'],
remapCoverageReporter: {
      'text-summary': null,
},
coverageReporter: {
      dir: './coverage',
      reporters: [
        {type: 'text'},
        {type: 'html', subdir: 'html'},
      ],
},
plugins: [
      istanbul-instrumenter-loader',
      'karma-chrome-launcher',
      'karma-coverage',
      'karma-jasmine',
      'karma-sourcemap-loader',
      'karma-webpack',
      'karma-remap-coverage',
]
...

Any ideas?

cvlos avatar Mar 29 '18 16:03 cvlos

same here. in fact if you set your coverage output directory to somewhere outside your 'watch files directory', you will fix it.

weibinzhu avatar Sep 02 '19 01:09 weibinzhu

I finally figure it out. It's because I used webpack's require.context in my 'karma.entry.js' files. every time a new coverage html report is generated, webpack will detect some files are created or deleted and trigger a 'recompile'

weibinzhu avatar Sep 02 '19 02:09 weibinzhu