From 510ec21d182c8ba2d0d03bde8b251fabaa05d84e Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Sun, 20 Oct 2024 20:57:47 +0700 Subject: [PATCH] fix: tests failing in node 20 --- setupJest.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setupJest.ts b/setupJest.ts index 45a75ae..4edaa7c 100644 --- a/setupJest.ts +++ b/setupJest.ts @@ -1,6 +1,8 @@ import * as crypto from "crypto"; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -globalThis.crypto = crypto as any; +if (!globalThis.crypto) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + globalThis.crypto = crypto as any; +} import jestFetchMock from "jest-fetch-mock";