Skip to content

Commit e3e2078

Browse files
authored
Consolidate CI test output into a single string (#8489)
* Consolidate CI test output into a single string Having CI test process stdout and stderr in a single string makes it easier to read when looking through failures, since you can see the test output alongside the error messages. Without this, any stderr output written during a test will be captured seperately from the test output, so when we then log it after a test failure, we can't tell which test logged which errors. * Prefix stdout and stderr output
1 parent 274e9a5 commit e3e2078

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

scripts/run_tests_in_ci.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ const argv = yargs.options({
6161
const dir = path.resolve(myPath);
6262
const { name } = require(`${dir}/package.json`);
6363

64-
let stdout = '';
65-
let stderr = '';
64+
let testProcessOutput = '';
6665
try {
6766
if (process.env?.BROWSERS) {
6867
for (const package in crossBrowserPackages) {
@@ -74,27 +73,26 @@ const argv = yargs.options({
7473
const testProcess = spawn('yarn', ['--cwd', dir, scriptName]);
7574

7675
testProcess.childProcess.stdout.on('data', data => {
77-
stdout += data.toString();
76+
testProcessOutput += '[stdout]' + data.toString();
7877
});
7978
testProcess.childProcess.stderr.on('data', data => {
80-
stderr += data.toString();
79+
testProcessOutput += '[stderr]' + data.toString();
8180
});
8281

8382
await testProcess;
8483
console.log('Success: ' + name);
85-
writeLogs('Success', name, stdout + '\n' + stderr);
84+
writeLogs('Success', name, testProcessOutput);
8685
} catch (e) {
8786
console.error('Failure: ' + name);
88-
console.log(stdout);
89-
console.error(stderr);
87+
console.error(testProcessOutput);
9088

9189
if (process.env.CHROME_VERSION_NOTES) {
9290
console.error();
9391
console.error(process.env.CHROME_VERSION_NOTES);
9492
console.error();
9593
}
9694

97-
writeLogs('Failure', name, stdout + '\n' + stderr);
95+
writeLogs('Failure', name, testProcessOutput);
9896

9997
process.exit(1);
10098
}

0 commit comments

Comments
 (0)