Skip to content

Commit

Permalink
chore(e2e-tests): bring back test shell output printing on failure (#…
Browse files Browse the repository at this point in the history
…2204)

This was one of the most helpful debugging features when investigating
CI failures, but got a bit lost in the refactor in 40d6f41.
Let's bring it back!
  • Loading branch information
addaleax authored Oct 9, 2024
1 parent 4830599 commit 664380b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/e2e-tests/test/test-shell-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,21 @@ export function ensureTestShellAfterHook(
// Store the set of shells to kill afterwards
const shells = new Set<TestShell>();
suite[symbol] = shells;
suite[hookName](async () => {
suite[hookName](async function () {
const shellsToKill = [...shells];
shells.clear();

if (this.currentTest?.state === 'failed') {
for (const shell of shellsToKill) {
console.error(shell.debugInformation());
}
}

await Promise.all(
shellsToKill.map((shell) => {
// TODO: Consider if it's okay to kill those that are already killed?
shell.kill();
if (shell.process.exitCode === null) {
shell.kill();
}
return shell.waitForExit();
})
);
Expand Down

0 comments on commit 664380b

Please sign in to comment.