From e7252935867d310bc5ab6a9e23827a913a74792b Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Mon, 31 Oct 2022 12:45:18 -0700 Subject: [PATCH] test: print stdout/stderr in signals.spec (#18456) --- tests/library/signals.spec.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/library/signals.spec.ts b/tests/library/signals.spec.ts index 96c520ab95..62294915fd 100644 --- a/tests/library/signals.spec.ts +++ b/tests/library/signals.spec.ts @@ -23,10 +23,19 @@ test.slow(); test('should close the browser when the node process closes', async ({ startRemoteServer, isWindows, server }) => { const remoteServer = await startRemoteServer({ url: server.EMPTY_PAGE }); - if (isWindows) - execSync(`taskkill /pid ${remoteServer.child().pid} /T /F`, { stdio: 'ignore' }); - else - process.kill(remoteServer.child().pid); + try { + if (isWindows) + execSync(`taskkill /pid ${remoteServer.child().pid} /T /F`, { stdio: 'ignore' }); + else + process.kill(remoteServer.child().pid); + } catch (error) { + console.log(error); + if (error.stdout) + console.log('--- stdout ---\n', error.stdout); + if (error.stderr) + console.log('--- stderr ---\n', error.stderr); + throw error; + } // We might not get browser exitCode in time when killing the parent node process, // so we don't check it here. expect(await remoteServer.childExitCode()).toBe(isWindows ? 1 : 0);