Skip to content

Commit 8b3a83a

Browse files
committed
handle test failures
1 parent 94e5a07 commit 8b3a83a

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

package-lock.json

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/run-shell.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ function log(...args) {
8282
console.log(styleText("yellow", text))
8383
}
8484

85+
function logError(...args) {
86+
const text = args.join(" ")
87+
if (GITHUB_ACTIONS_OUTPUT)
88+
core.error(styleText("red", text))
89+
else
90+
console.error(styleText("red", text))
91+
}
92+
8593
function logGroup(name, body) {
8694
if (GITHUB_ACTIONS_OUTPUT) {
8795
core.startGroup(name);
@@ -113,7 +121,7 @@ function sh(binary, args) {
113121
try {
114122
const result = spawnSync(binary, args, SPAWN_OPTIONS);
115123
if (result.status || result.error) {
116-
console.error(result.error);
124+
logError(result.error);
117125
throw new Error(`Shell CMD failed: ${binary} ${args.join(" ")}`);
118126
}
119127
} finally {
@@ -131,7 +139,6 @@ async function runTests() {
131139
sh(shellBinary, singleTestArgs);
132140
});
133141
if (!success) {
134-
console.error("TEST FAILURES")
135142
process.exit(1)
136143
}
137144
}
@@ -173,7 +180,7 @@ function runTest(testName, test) {
173180
try {
174181
logGroup(testName, test)
175182
} catch(e) {
176-
console.error("TEST FAILED")
183+
logError("TEST FAILED")
177184
return false
178185
}
179186
return true

0 commit comments

Comments
 (0)