Skip to content

Commit

Permalink
test: trying to another solution - still debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mgordel committed Sep 6, 2024
1 parent 377de8c commit 45d1273
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/examples/examples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down

0 comments on commit 45d1273

Please sign in to comment.