Skip to content

Commit c413a56

Browse files
committed
collect console log in renderer tests
Print the output finally to ease diagnosing
1 parent 6d50f3f commit c413a56

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

script/test

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,21 @@ for (let testFile of testFiles) {
110110
'--resource-path', resourcePath,
111111
'--test', testFile
112112
]
113-
const cp = childProcess.spawn(executablePath, testArguments, {stdio: 'inherit', env: testEnv})
114-
cp.on('error', error => { callback(error) })
115-
cp.on('close', exitCode => { callback(null, {exitCode, step: `core-render-process for ${testFile}.`, testCommand: `You can run the test again using: \n\t ${executablePath} ${testArguments.join(' ')}`}) })
113+
const cp = childProcess.spawn(executablePath, testArguments, { env: testEnv})
114+
let stderrOutput = ''
115+
cp.stderr.on('data', data => { stderrOutput += data })
116+
cp.stdout.on('data', data => { stderrOutput += data })
117+
cp.on('error', error => {
118+
console.log(error, "error")
119+
callback(error)
120+
})
121+
cp.on('close', exitCode => {
122+
if (exitCode !== 0) {
123+
console.log(`##[error] Renderer tests failed for ${testFile}:`.red)
124+
console.log(stderrOutput)
125+
}
126+
callback(null, {exitCode, step: `core-render-process for ${testFile}.`, testCommand: `You can run the test again using: \n\t ${executablePath} ${testArguments.join(' ')}`})
127+
})
116128
})
117129
}
118130

0 commit comments

Comments
 (0)