titel-media / karma-istanbul-threshold

Karma reporter that checks coverage thresholds with coverage data generated by karma-coverage. Because it reads its data from a json file, it can also handle remapped coverage data provided by karma-remap-istanbul to allow source-map support.
10 stars 3 forks source link

Config for watch mode to ignore process.exit(exitCode); #9

Open Ronsku opened 7 years ago

Ronsku commented 7 years ago

Hi,

Could we have a function to run this in watch mode with a configuration watch: true or similar to not have process.exit(exitCode); happening when code coverage is not fulfilled?

This is a very easy change and I can make a PR if needed.

// local - karma.conf.js:
istanbulThresholdReporter: {
  src: 'coverage/coverage-final.json',
  reporters: ['text'],
  watch: true,
  ...
}

// karma-istanbul-threshold - index.js
_.defaults(config.istanbulThresholdReporter, {
  src: null,
  basePath: null,
  watch: false
  ...
}

...

if (exitCode && !config.istanbulThresholdReporter.watch) {
  process.exit(exitCode);
}

Thank you!

vjcagay commented 6 years ago

I would also like this change. I it would be nice if this plugin does not stop Karma in watch mode if thresholds are not fulfilled.

philipptri commented 6 years ago

@vjcagay feel free to make a PR to add this feature. Thanks!