Skip to content

Commit

Permalink
Fix output and exit code for java tests
Browse files Browse the repository at this point in the history
Before this change, run_java_unit_tests.js would always have an exit
code of 0 thus never failing the npm tests.
Furthermore, "Tests completed successfully" would even be printed after
failing to create the Gradle wrapper.
  • Loading branch information
raphinesse committed May 19, 2018
1 parent 59e3b90 commit a070215
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/run_java_unit_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ if (!needs_gradlew_built) {
}

needs_gradlew_built.then(function () {
return superspawn.spawn(path.join(__dirname, 'gradlew'), ['test'], {stdio: 'inherit'});
return superspawn.spawn(path.join(__dirname, 'gradlew'), ['test'], {stdio: 'inherit'})
.then(function () {
console.log('Tests completed successfully.');
}, function (err) {
console.error('Tests failed!', err);
process.exitCode = 1;
});
}, function (err) {
console.error('There was an error building the gradlew file:', err);
}).then(function () {
console.log('Tests completed successfully.');
}).fail(function (err) {
console.error('Tests failed!', err);
process.exitCode = 1;
});

0 comments on commit a070215

Please sign in to comment.