From 459527bb420e44278f6da6a5a4e673b802ce8020 Mon Sep 17 00:00:00 2001 From: vgorkavenko Date: Mon, 12 Feb 2024 15:47:15 +0400 Subject: [PATCH] fix: polyfills --- test/jest-e2e.json | 1 + test/jest.polyfills.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/jest-e2e.json b/test/jest-e2e.json index 4fcdc523..8aca6636 100644 --- a/test/jest-e2e.json +++ b/test/jest-e2e.json @@ -10,6 +10,7 @@ "transform": { "^.+\\.(t|j)s$": "ts-jest" }, + "preset": "ts-jest", "testEnvironment": "jest-environment-jsdom", "testEnvironmentOptions": { "customExportConditions": [""] diff --git a/test/jest.polyfills.js b/test/jest.polyfills.js index 28e94531..6e855ce5 100644 --- a/test/jest.polyfills.js +++ b/test/jest.polyfills.js @@ -1,4 +1,3 @@ -// jest.polyfills.js /** * @note The block below contains polyfills for Node.js globals * required for Jest to function when running JSDOM tests. @@ -8,13 +7,15 @@ * Consider migrating to a more modern test runner if * you don't want to deal with this. */ - +const { clearImmediate, setImmediate } = require("node:timers") const { TextDecoder, TextEncoder, ReadableStream } = require("node:util") Object.defineProperties(globalThis, { TextDecoder: { value: TextDecoder }, TextEncoder: { value: TextEncoder }, ReadableStream: { value: ReadableStream }, + clearImmediate: { value: clearImmediate }, + setImmediate: { value: setImmediate }, }) const { Blob, File } = require("node:buffer")