API: make ns.atExit add the callback to an array instead of setting it (#1059)

This commit is contained in:
Shy
2024-03-06 01:22:45 +01:00
committed by GitHub
parent 4f4c6fe7e5
commit 4aaf845fca
7 changed files with 38 additions and 22 deletions

View File

@@ -105,7 +105,10 @@ test.each([
// await script death.
const ws = workerScripts.get(pid);
expect(ws).toBeDefined();
const result = await Promise.race([alerted, new Promise((resolve) => (ws.atExit = resolve))]);
const result = await Promise.race([
alerted,
new Promise<void>((resolve) => (ws!.atExit = new Map([["default", resolve]]))),
]);
// If an error alert was thrown, we catch it here.
expect(result).not.toBeDefined();
expect(runningScript.logs).toEqual(expectedLog);