mirror of
https://github.com/yeslayla/run-gut-tests-action.git
synced 2025-01-14 04:53:40 +01:00
Test error checking
This commit is contained in:
parent
f5803293ea
commit
c272420f05
25
dist/index.js
vendored
25
dist/index.js
vendored
@ -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
25
main.js
@ -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)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user