Test error checking

This commit is contained in:
Layla 2020-10-18 22:16:23 -04:00
parent f5803293ea
commit c272420f05
2 changed files with 48 additions and 2 deletions

25
dist/index.js vendored
View File

@ -12197,9 +12197,21 @@ try {
process.chdir(work_dir);
}
let script_errors = [];
// Test handler stream
var test_handler = new stream.Writable({
write: function(chunk, encoding, next) {
console.log("LINE: " + chunk.toString());
// Check for script errors
let re = new RegExp("SCRIPT ERROR: ?([^']+)'?:", "i")
var match = re.exec(chunk.toString());
if (match) {
script_errors.push(match[0]);
}
// Print to stdout
console.log(chunk.toString());
next();
}
});
@ -12232,6 +12244,17 @@ try {
if( data.StatusCode != "0" )
{
core.setFailed("GUT tests failed!");
} else if (script_errors.length > 0) // Check for script errors
{
// Fail action
core.setFailed(script_errors.length.toString() + " script errors were found!");
// Log script errors
console.log("The following scripts had script errors:")
script_errors.forEach(error => {
console.log(error)
});
}
})

25
main.js
View File

@ -18,9 +18,21 @@ try {
process.chdir(work_dir);
}
let script_errors = [];
// Test handler stream
var test_handler = new stream.Writable({
write: function(chunk, encoding, next) {
console.log("LINE: " + chunk.toString());
// Check for script errors
let re = new RegExp("SCRIPT ERROR: ?([^']+)'?:", "i")
var match = re.exec(chunk.toString());
if (match) {
script_errors.push(match[0]);
}
// Print to stdout
console.log(chunk.toString());
next();
}
});
@ -53,6 +65,17 @@ try {
if( data.StatusCode != "0" )
{
core.setFailed("GUT tests failed!");
} else if (script_errors.length > 0) // Check for script errors
{
// Fail action
core.setFailed(script_errors.length.toString() + " script errors were found!");
// Log script errors
console.log("The following scripts had script errors:")
script_errors.forEach(error => {
console.log(error)
});
}
})