diff --git a/UI/tests/common/jest-setup.js b/UI/tests/common/jest-setup.js index e9abf7514e..3304da72e0 100644 --- a/UI/tests/common/jest-setup.js +++ b/UI/tests/common/jest-setup.js @@ -8,10 +8,10 @@ import { afterEach } from "@jest/globals"; import "core-js"; +import { server } from "./mocks/server.js"; import { setGlobalOrigin } from "undici"; import "./mocks/lsmb_elements"; -import { server } from "./mocks/server.js"; Object.defineProperty(window, "lsmbConfig", { writable: true, diff --git a/UI/tests/common/mocks/server.js b/UI/tests/common/mocks/server.js index 428359a091..774bcdd56f 100644 --- a/UI/tests/common/mocks/server.js +++ b/UI/tests/common/mocks/server.js @@ -1,7 +1,14 @@ /** @format */ +/* global globalThis */ import { setupServer } from "msw/node"; import { handlers } from "./handlers"; +const { MessageChannel, MessagePort } = require("node:worker_threads"); // This configures a Service Server with the given request handlers. export const server = setupServer(...handlers); + +Object.defineProperties(globalThis, { + MessageChannel: { value: MessageChannel }, + MessagePort: { value: MessagePort } +});