Skip to content

Commit 5c18446

Browse files
committed
chore(react-router): cleanup test setup
1 parent db9cdf9 commit 5c18446

File tree

6 files changed

+21
-64
lines changed

6 files changed

+21
-64
lines changed

integration/form-test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,7 @@ test.describe("Forms", () => {
11021102

11031103
test("empty file inputs resolve to File objects on the server", async ({
11041104
page,
1105-
channel,
11061105
}) => {
1107-
// TODO: Look into this test failing on windows
1108-
test.skip(channel === "msedge", "Fails on windows with undici");
1109-
11101106
let app = new PlaywrightFixture(appFixture, page);
11111107

11121108
await app.goto("/empty-file-upload");

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
"history": "^5.3.0",
9595
"isbot": "^5.1.11",
9696
"jest": "^29.6.4",
97-
"jest-environment-jsdom": "^29.6.2",
9897
"jsonfile": "^6.1.0",
9998
"prettier": "^2.8.8",
10099
"prompts": "^2.4.2",
@@ -109,7 +108,6 @@
109108
"type-fest": "^2.19.0",
110109
"typedoc": "^0.26.11",
111110
"typescript": "^5.4.5",
112-
"undici": "^6.10.1",
113111
"unified": "^10.1.2",
114112
"unist-util-remove": "^3.1.0",
115113
"vite": "^6.1.0",

packages/react-router/__tests__/setup.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,6 @@
11
// https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#configuring-your-testing-environment
22
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
33

4-
if (!globalThis.TextEncoder || !globalThis.TextDecoder) {
5-
const { TextDecoder, TextEncoder } = require("node:util");
6-
globalThis.TextEncoder = TextEncoder;
7-
globalThis.TextDecoder = TextDecoder;
8-
}
9-
10-
if (!globalThis.ReadableStream || !globalThis.WritableStream) {
11-
const { ReadableStream, WritableStream } = require("node:stream/web");
12-
globalThis.ReadableStream = ReadableStream;
13-
globalThis.WritableStream = WritableStream;
14-
}
15-
16-
if (!globalThis.fetch) {
17-
const { fetch, FormData, Request, Response, Headers } = require("undici");
18-
19-
globalThis.fetch = fetch;
20-
globalThis.Request = Request;
21-
globalThis.Response = Response;
22-
globalThis.Headers = Headers;
23-
24-
globalThis.FormData = globalThis.FormData || FormData;
25-
}
26-
27-
if (!globalThis.TextEncoderStream) {
28-
const { TextEncoderStream } = require("node:stream/web");
29-
globalThis.TextEncoderStream = TextEncoderStream;
30-
}
31-
32-
if (!globalThis.TextDecoderStream) {
33-
const { TextDecoderStream } = require("node:stream/web");
34-
globalThis.TextDecoderStream = TextDecoderStream;
35-
}
36-
37-
if (!globalThis.TransformStream) {
38-
const { TransformStream } = require("node:stream/web");
39-
globalThis.TransformStream = TransformStream;
40-
}
41-
424
const consoleError = console.error;
435
console.error = (msg, ...args) => {
446
if (

packages/react-router/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ module.exports = {
33
...require("../../jest/jest.config.shared"),
44
setupFiles: ["<rootDir>/__tests__/setup.ts"],
55
setupFilesAfterEnv: ["@testing-library/jest-dom"],
6-
testEnvironment: "jsdom",
6+
testEnvironment: "jest-fixed-jsdom",
77
};

packages/react-router/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
},
9090
"devDependencies": {
9191
"@types/set-cookie-parser": "^2.4.1",
92+
"jest-environment-jsdom": "^29.6.2",
93+
"jest-fixed-jsdom": "^0.0.9",
9294
"react": "^19.1.0",
9395
"react-dom": "^19.1.0",
9496
"rimraf": "^6.0.1",

pnpm-lock.yaml

Lines changed: 18 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)