From 8ba8478ba778863aceb11931b1e3a5f4e94d4450 Mon Sep 17 00:00:00 2001 From: Dmitriy Vasyura Date: Mon, 2 Mar 2026 01:03:16 -0800 Subject: [PATCH 1/2] Add more logging to sanity test runner --- test/sanity/src/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/sanity/src/index.ts b/test/sanity/src/index.ts index a251128892529..a9fcfb1fc8943 100644 --- a/test/sanity/src/index.ts +++ b/test/sanity/src/index.ts @@ -52,8 +52,16 @@ if (testResults) { const mocha = new Mocha(mochaOptions); mocha.addFile(fileURLToPath(new URL('./main.js', import.meta.url))); await mocha.loadFilesAsync(); -mocha.run(failures => { +const runner = mocha.run(failures => { + console.log(`Mocha test run finished: ${failures} failure(s)`); process.exitCode = failures > 0 ? 1 : 0; // Force exit to prevent hanging on open handles (background processes, timers, etc.) - setTimeout(() => process.exit(process.exitCode), 1000); + setTimeout(() => { + console.log(`Exiting with code ${process.exitCode}`); + process.exit(process.exitCode); + }, 1000); }); + +runner.on('test', (test) => console.log(`Starting: ${test.fullTitle()}`)); +runner.on('pass', (test) => console.log(`Passed: ${test.fullTitle()}`)); +runner.on('fail', (test, err) => console.log(`Failed: ${test.fullTitle()} - ${err.message}`)); From 6078d7dcfd58da2875ed675d41abae3f021405b8 Mon Sep 17 00:00:00 2001 From: Dmitriy Vasyura Date: Mon, 2 Mar 2026 01:10:52 -0800 Subject: [PATCH 2/2] PR feedback --- test/sanity/src/index.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/sanity/src/index.ts b/test/sanity/src/index.ts index a9fcfb1fc8943..60fc2cab5a0ed 100644 --- a/test/sanity/src/index.ts +++ b/test/sanity/src/index.ts @@ -53,15 +53,21 @@ const mocha = new Mocha(mochaOptions); mocha.addFile(fileURLToPath(new URL('./main.js', import.meta.url))); await mocha.loadFilesAsync(); const runner = mocha.run(failures => { - console.log(`Mocha test run finished: ${failures} failure(s)`); + if (options.verbose) { + console.log(`Mocha test run finished: ${failures} failure(s)`); + } process.exitCode = failures > 0 ? 1 : 0; // Force exit to prevent hanging on open handles (background processes, timers, etc.) setTimeout(() => { - console.log(`Exiting with code ${process.exitCode}`); + if (options.verbose) { + console.log(`Exiting with code ${process.exitCode}`); + } process.exit(process.exitCode); }, 1000); }); -runner.on('test', (test) => console.log(`Starting: ${test.fullTitle()}`)); -runner.on('pass', (test) => console.log(`Passed: ${test.fullTitle()}`)); -runner.on('fail', (test, err) => console.log(`Failed: ${test.fullTitle()} - ${err.message}`)); +if (options.verbose) { + runner.on('test', (test) => console.log(`Starting: ${test.fullTitle()}`)); + runner.on('pass', (test) => console.log(`Passed: ${test.fullTitle()}`)); + runner.on('fail', (test, err) => console.log(`Failed: ${test.fullTitle()} - ${err.message}`)); +}