Nerajno / gulp-jest

Gulp plugin for the Jest test lib
MIT License
53 stars 43 forks source link

coverage Threshold failure #33

Closed nishanth83Ya closed 6 years ago

nishanth83Ya commented 7 years ago

When the coverage threshold breaches, I don't see the gulp task failing. Can this be added please? As per the code snippet below only test failures fail the gulp task?

_jestCli2.default.runCLI(options, options.config.rootDir, function (result) { if (result.numFailedTests || result.numFailedTestSuites) { cb(new _gulpUtil2.default.PluginError('gulp-jest', { message: 'Tests Failed' })); } else { cb(); } });

nishanth83Ya commented 7 years ago

It looks like the variable result.success should also be checked. Some something like the following?

_jestCli2.default.runCLI(options, options.config.rootDir, function (result) { if (result.numFailedTests || result.numFailedTestSuites ) { cb(new _gulpUtil2.default.PluginError('gulp-jest', { message: 'Tests Failed' })); } else if(result.success == false) { console.log(result); cb(new _gulpUtil2.default.PluginError('gulp-jest', { message: 'Tests Failed due to coverage threshold breaches' })); } else { cb(); } });

alansouzati commented 7 years ago

Very interesting! Can you work on a pull request for that since you have almost everything there?

maybe ?

else if(!result.success) {
Leaf27 commented 7 years ago

Is there any update on this issue? I also discovered it recently and I'd like to send a pull request to also check result.success in https://github.com/alansouzati/gulp-jest/blob/master/src/index.js#L14

nishanth83Ya commented 7 years ago

I tried to commit so I can raise a pull request but ran into permission issues.

rageycomma commented 6 years ago

Hi guys,

I needed this for my own build pipeline for my own project, so I submitted a pull request to add this feature in. The code above would be a bit unreliable, so I added a check to make sure a coverage threshold was set.

Please see PR here: https://github.com/alansouzati/gulp-jest/pull/44

Cheers,

akougblenou commented 6 years ago

The coverage is still not failing has there been any updates on this ?