Skip to content

Commit 664380b

Browse files
authored
chore(e2e-tests): bring back test shell output printing on failure (#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!
1 parent 4830599 commit 664380b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/e2e-tests/test/test-shell-context.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,21 @@ export function ensureTestShellAfterHook(
4545
// Store the set of shells to kill afterwards
4646
const shells = new Set<TestShell>();
4747
suite[symbol] = shells;
48-
suite[hookName](async () => {
48+
suite[hookName](async function () {
4949
const shellsToKill = [...shells];
5050
shells.clear();
51+
52+
if (this.currentTest?.state === 'failed') {
53+
for (const shell of shellsToKill) {
54+
console.error(shell.debugInformation());
55+
}
56+
}
57+
5158
await Promise.all(
5259
shellsToKill.map((shell) => {
53-
// TODO: Consider if it's okay to kill those that are already killed?
54-
shell.kill();
60+
if (shell.process.exitCode === null) {
61+
shell.kill();
62+
}
5563
return shell.waitForExit();
5664
})
5765
);

0 commit comments

Comments
 (0)