From 45d1273993780ae21f85f690db85c0a0f9162568 Mon Sep 17 00:00:00 2001 From: Marcin Gordel Date: Fri, 6 Sep 2024 14:24:28 +0200 Subject: [PATCH] test: trying to another solution - still debugging --- tests/examples/examples.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/examples/examples.test.ts b/tests/examples/examples.test.ts index 72182cd84..92f0fd601 100644 --- a/tests/examples/examples.test.ts +++ b/tests/examples/examples.test.ts @@ -49,11 +49,15 @@ async function test(cmd: string, path: string, args: string[] = [], timeout = 36 spawnedExample.stderr?.on("data", assertLogs); let isFinishing = false; const finishTest = (code?: number, signal?: string) => { + console.log("FINISH TEST", { isFinishing, code, signal, error }); if (isFinishing) { console.log("Test finishing has already been triggered by another event"); return; } isFinishing = true; + spawnedExample.removeAllListeners(); + spawnedExample.stdout.removeAllListeners(); + spawnedExample.stderr.removeAllListeners(); clearTimeout(timeoutId); if (!error && !code) return res(true); rej(`Test example "${file}" failed. Exited with code ${code} by signal ${signal}. ${error}`);