forked from github/cordova-android
Fix output and exit code for Java tests
This fixes the following issues: * run_java_unit_tests.js always has exit code of 0 thus never failing the npm tests. * "Tests completed successfully" is printed after failing to create the Gradle wrapper and never running the tests. * Gradle errors are printed twice
This commit is contained in:
parent
bf29fe0e10
commit
0d4b9f4ba6
@ -37,11 +37,15 @@ if (!needs_gradlew_built) {
|
||||
}
|
||||
|
||||
needs_gradlew_built.then(function () {
|
||||
console.log('Gradle wrapper is ready. Running tests now.');
|
||||
return superspawn.spawn(path.join(__dirname, 'gradlew'), ['test'], {stdio: 'inherit'});
|
||||
}, 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.on('unhandledRejection', err => {
|
||||
// If err has a stderr property, we have seen the message already
|
||||
if (!('stderr' in err)) console.error(err.message);
|
||||
console.error('JAVA UNIT TESTS FAILED!');
|
||||
process.exitCode = err.code || 1;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user