From 454912f33c3a4ad622af74d31e96437059b98ae0 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Mon, 9 Sep 2024 11:32:21 -0400 Subject: [PATCH 1/2] 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. --- 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..caac5652cee 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 += data.toString(); }); testProcess.childProcess.stderr.on('data', data => { - stderr += data.toString(); + testProcessOutput += 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); } From 137254e83f5eb2448dcb8d1084b0b9a80d156e7a Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 25 Sep 2024 10:57:39 -0400 Subject: [PATCH 2/2] Prefix stdout and stderr output --- scripts/run_tests_in_ci.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run_tests_in_ci.js b/scripts/run_tests_in_ci.js index caac5652cee..0cf6a7f5d3c 100644 --- a/scripts/run_tests_in_ci.js +++ b/scripts/run_tests_in_ci.js @@ -73,10 +73,10 @@ const argv = yargs.options({ const testProcess = spawn('yarn', ['--cwd', dir, scriptName]); testProcess.childProcess.stdout.on('data', data => { - testProcessOutput += data.toString(); + testProcessOutput += '[stdout]' + data.toString(); }); testProcess.childProcess.stderr.on('data', data => { - testProcessOutput += data.toString(); + testProcessOutput += '[stderr]' + data.toString(); }); await testProcess;