From e3e20784503347ba5cab1ead3a7b73df87125cb4 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 6 Nov 2024 09:57:57 -0500 Subject: [PATCH] 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 --- scripts/run_tests_in_ci.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/run_tests_in_ci.js b/scripts/run_tests_in_ci.js index 96f85979165..0cf6a7f5d3c 100644 --- a/scripts/run_tests_in_ci.js +++ b/scripts/run_tests_in_ci.js @@ -61,8 +61,7 @@ const argv = yargs.options({ const dir = path.resolve(myPath); const { name } = require(`${dir}/package.json`); - let stdout = ''; - let stderr = ''; + let testProcessOutput = ''; try { if (process.env?.BROWSERS) { for (const package in crossBrowserPackages) { @@ -74,19 +73,18 @@ const argv = yargs.options({ const testProcess = spawn('yarn', ['--cwd', dir, scriptName]); testProcess.childProcess.stdout.on('data', data => { - stdout += data.toString(); + testProcessOutput += '[stdout]' + data.toString(); }); testProcess.childProcess.stderr.on('data', data => { - stderr += data.toString(); + testProcessOutput += '[stderr]' + data.toString(); }); await testProcess; console.log('Success: ' + name); - writeLogs('Success', name, stdout + '\n' + stderr); + writeLogs('Success', name, testProcessOutput); } catch (e) { console.error('Failure: ' + name); - console.log(stdout); - console.error(stderr); + console.error(testProcessOutput); if (process.env.CHROME_VERSION_NOTES) { console.error(); @@ -94,7 +92,7 @@ const argv = yargs.options({ console.error(); } - writeLogs('Failure', name, stdout + '\n' + stderr); + writeLogs('Failure', name, testProcessOutput); process.exit(1); }