From 98c29661bb72d40656d27b7d8a64ad03e8e1809f Mon Sep 17 00:00:00 2001 From: "jakub.jedlikowski" Date: Mon, 30 Sep 2024 13:56:49 +0200 Subject: [PATCH] chore: don't overwrite module-scoped constant --- test/fn.spec.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/fn.spec.ts b/test/fn.spec.ts index 30d20ca43..d0f139deb 100644 --- a/test/fn.spec.ts +++ b/test/fn.spec.ts @@ -105,19 +105,17 @@ test('timeout', async () => { }) test('subsequent executions after timeout', async () => { - const SYNCKIT_TIMEOUT = 30 - process.env.SYNCKIT_TIMEOUT = SYNCKIT_TIMEOUT.toString() + const executionTimeout = 30 + process.env.SYNCKIT_TIMEOUT = executionTimeout.toString() const { createSyncFn } = await import('synckit') const syncFn = createSyncFn(workerCjsPath) // start an execution in worker that will definitely time out - expect(() => syncFn(1, SYNCKIT_TIMEOUT * 3)).toThrow( - 'Internal error: Atomics.wait() failed: timed-out', - ) + expect(() => syncFn(1, executionTimeout * 3)).toThrow() // wait for timed out execution to finish inside worker - await new Promise(resolve => setTimeout(resolve, SYNCKIT_TIMEOUT * 3)) + await new Promise(resolve => setTimeout(resolve, executionTimeout * 3)) // subsequent executions should work correctly expect(syncFn(2, 1)).toBe(2)