From 95670c7b313e51cae99e2437562ef27eb0c3b241 Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Tue, 4 May 2021 06:22:14 -0700 Subject: [PATCH] Also handle exit codes on coverage run --- gulpfile.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) 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); } })