diff --git a/config/jest.config.js b/config/jest.config.js index 29323d3da7..1e0d714b4a 100644 --- a/config/jest.config.js +++ b/config/jest.config.js @@ -29,10 +29,7 @@ const defaults = { const ignoreTSFiles = ".ts$"; const ignoreTSXFiles = ".tsx$"; -const react19TestFileIgnoreList = [ - ignoreTSFiles, - "src/react/ssr/__tests__/getDataFromTree.test.tsx", -]; +const react19TestFileIgnoreList = [ignoreTSFiles]; const react17TestFileIgnoreList = [ ignoreTSFiles, diff --git a/src/react/ssr/__tests__/getDataFromTree.test.tsx b/src/react/ssr/__tests__/getDataFromTree.test.tsx index 54bc53b4ac..0d2f8e2936 100644 --- a/src/react/ssr/__tests__/getDataFromTree.test.tsx +++ b/src/react/ssr/__tests__/getDataFromTree.test.tsx @@ -1,4 +1,19 @@ import React from "react"; + +if (React.version.startsWith("19")) { + // react-dom/server uses MessageChannel in React 19 + window.MessageChannel = jest.fn().mockImplementation(() => { + return { + port1: { + set onmessage(_cb: unknown) {}, + }, + port2: { + postMessage(_data: unknown) {}, + }, + }; + }); +} + import gql from "graphql-tag"; import { DocumentNode } from "graphql";