Also handle exit codes on coverage run

This commit is contained in:
Christopher C. Wells 2021-05-04 06:22:14 -07:00
parent c0d20e3a94
commit 95670c7b31
1 changed files with 19 additions and 10 deletions

View File

@ -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) {
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'});
}
// 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);
}
})