Skip to content
Permalink
Browse files

fix(jest task): Return error when tests fail

Callback always resolved successfully even when test failed
Incorrect data was accessed in result data to determine failure

Closes #1052
  • Loading branch information...
michaelw85 committed Feb 18, 2019
1 parent 1455a35 commit bfbe072a50c53ceb4921450b3c95c7f622e17954
Showing with 6 additions and 6 deletions.
  1. +3 −3 lib/resources/tasks/jest.js
  2. +3 −3 lib/resources/tasks/jest.ts
@@ -13,9 +13,9 @@ export default (cb) => {

process.env.BABEL_TARGET = 'node';

jest.runCLI(options, [path.resolve(__dirname, '../../')]).then((result) => {
if (result.numFailedTests || result.numFailedTestSuites) {
cb(new PluginError('gulp-jest', { message: 'Tests Failed' }));
jest.runCLI(options, [path.resolve(__dirname, '../../')]).then(({ results }) => {
if (results.numFailedTests || results.numFailedTestSuites) {
cb(new PluginError('jest-cli', { message: 'Tests Failed' }));
} else {
cb();
}
@@ -12,9 +12,9 @@ export default (cb) => {
Object.assign(options, { watch: true});
}

jest.runCLI(options, [path.resolve(__dirname, '../../')]).then((result) => {
if(result.numFailedTests || result.numFailedTestSuites) {
cb(new PluginError('gulp-jest', { message: 'Tests Failed' }));
jest.runCLI(options, [path.resolve(__dirname, '../../')]).then(({ results }) => {
if (results.numFailedTests || results.numFailedTestSuites) {
cb(new PluginError('jest-cli', { message: 'Tests Failed' }));
} else {
cb();
}

0 comments on commit bfbe072

Please sign in to comment.
You can’t perform that action at this time.