diff --git a/gulpfile.js b/gulpfile.js index 214beaa6..3d5944b7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -53,20 +53,28 @@ function coverage(cb) { { stdio: 'inherit' } - ).on('exit', function() { + ).on('exit', function(code) { // Run isolated tests with coverage. - config.testsConfig.isolated.forEach(function(test_name) { - es( - 'pipenv run coverage run manage.py test ' + test_name, - {stdio: 'inherit'} - ); - }) + if (code === 0) { + try { + config.testsConfig.isolated.forEach(function (test_name) { + es( + 'pipenv run coverage run manage.py test ' + test_name, + {stdio: 'inherit'} + ); + }) + } catch (error) { + console.error(error); + cb(); + process.exit(1); + } - // Combine coverage results. - es('pipenv run coverage combine', {stdio: 'inherit'}); + // Combine coverage results. + es('pipenv run coverage combine', {stdio: 'inherit'}); + } - // Execute callback. cb(); + process.exit(code) }); } @@ -205,6 +213,7 @@ function test(cb) { es('pipenv run python manage.py test ' + test_name, {stdio: 'inherit'}); } catch (error) { console.error(error); + cb(); process.exit(1); } })