Skip to content

Commit

Permalink
Expose MessagePort class for Undici v7
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuelsmann committed Dec 26, 2024
1 parent 722ff77 commit c58942b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion UI/tests/common/jest-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions UI/tests/common/mocks/server.js
Original file line number Diff line number Diff line change
@@ -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 }
});

0 comments on commit c58942b

Please sign in to comment.