Skip to content

Commit 36aab2b

Browse files
committed
Finalize in the end (not between retry attempts)
don't finalize until the end which the test fails or passes.
1 parent 62867d5 commit 36aab2b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

script/test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ function spawnTest(executablePath, testArguments, options, callback, testName, f
102102

103103
// on close
104104
cp.on('close', exitCode => {
105-
if (finalize) { finalize() } // if finalizer provided
106105
if (exitCode !== 0) {
107106
retryOrFailTest(stderrOutput, exitCode, executablePath, testArguments, options, callback, testName, finalize)
108107
} else {
108+
// successful test
109+
if (finalize) { finalize() } // if finalizer provided
109110
callback(null, {
110111
exitCode,
111112
step: testName,
@@ -130,6 +131,7 @@ function retryOrFailTest(stderrOutput, exitCode, executablePath, testArguments,
130131
spawnTest(executablePath, testArguments, options, callback, testName, finalize)
131132
} else {
132133
// fail the test
134+
if (finalize) { finalize() } // if finalizer provided
133135
console.log(`##[error] Tests for ${testName} failed.`.red)
134136
console.log(stderrOutput)
135137
callback(null, {

0 commit comments

Comments
 (0)