diff --git a/packages/react-router/__tests__/data-memory-router-test.tsx b/packages/react-router/__tests__/data-memory-router-test.tsx index f044ba24c9..fed0bbc1e8 100644 --- a/packages/react-router/__tests__/data-memory-router-test.tsx +++ b/packages/react-router/__tests__/data-memory-router-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import "@testing-library/jest-dom"; import { fireEvent, diff --git a/packages/react-router/__tests__/dom/concurrent-mode-navigations-test.tsx b/packages/react-router/__tests__/dom/concurrent-mode-navigations-test.tsx index 6dfc674763..2d20d74eff 100644 --- a/packages/react-router/__tests__/dom/concurrent-mode-navigations-test.tsx +++ b/packages/react-router/__tests__/dom/concurrent-mode-navigations-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import { MemoryRouter, diff --git a/packages/react-router/__tests__/dom/data-browser-router-legacy-formdata-test.tsx b/packages/react-router/__tests__/dom/data-browser-router-legacy-formdata-test.tsx index d0b63a8514..ddbe1b805f 100644 --- a/packages/react-router/__tests__/dom/data-browser-router-legacy-formdata-test.tsx +++ b/packages/react-router/__tests__/dom/data-browser-router-legacy-formdata-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { JSDOM } from "jsdom"; // Drop support for the submitter parameter, as in a legacy browser. This // needs to be done before react-router-dom is required, since it does some diff --git a/packages/react-router/__tests__/dom/data-browser-router-test.tsx b/packages/react-router/__tests__/dom/data-browser-router-test.tsx index c8b9f2e923..c218bc7746 100644 --- a/packages/react-router/__tests__/dom/data-browser-router-test.tsx +++ b/packages/react-router/__tests__/dom/data-browser-router-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import type { ErrorResponse, Fetcher } from "react-router"; import "@testing-library/jest-dom"; import { diff --git a/packages/react-router/__tests__/dom/data-static-router-test.tsx b/packages/react-router/__tests__/dom/data-static-router-test.tsx index 04c31bd47d..4520a8004a 100644 --- a/packages/react-router/__tests__/dom/data-static-router-test.tsx +++ b/packages/react-router/__tests__/dom/data-static-router-test.tsx @@ -1,3 +1,7 @@ +/** + * @jest-environment node + */ + import * as React from "react"; import * as ReactDOMServer from "react-dom/server"; import { json } from "react-router"; diff --git a/packages/react-router/__tests__/dom/flush-sync-navigations-test.tsx b/packages/react-router/__tests__/dom/flush-sync-navigations-test.tsx index b8f18438e3..783f2eb597 100644 --- a/packages/react-router/__tests__/dom/flush-sync-navigations-test.tsx +++ b/packages/react-router/__tests__/dom/flush-sync-navigations-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import { createBrowserRouter, diff --git a/packages/react-router/__tests__/dom/link-click-test.tsx b/packages/react-router/__tests__/dom/link-click-test.tsx index 4a35a92a81..b97088b032 100644 --- a/packages/react-router/__tests__/dom/link-click-test.tsx +++ b/packages/react-router/__tests__/dom/link-click-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import * as ReactDOM from "react-dom/client"; import { act } from "react-dom/test-utils"; diff --git a/packages/react-router/__tests__/dom/link-href-test.tsx b/packages/react-router/__tests__/dom/link-href-test.tsx index 4d6fbec05e..f402bbf264 100644 --- a/packages/react-router/__tests__/dom/link-href-test.tsx +++ b/packages/react-router/__tests__/dom/link-href-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import { BrowserRouter, diff --git a/packages/react-router/__tests__/dom/link-push-test.tsx b/packages/react-router/__tests__/dom/link-push-test.tsx index fb3c9b3897..cf8df91062 100644 --- a/packages/react-router/__tests__/dom/link-push-test.tsx +++ b/packages/react-router/__tests__/dom/link-push-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import * as TestRenderer from "react-test-renderer"; import { diff --git a/packages/react-router/__tests__/dom/nav-link-active-test.tsx b/packages/react-router/__tests__/dom/nav-link-active-test.tsx index a226cc865f..18d077f1bd 100644 --- a/packages/react-router/__tests__/dom/nav-link-active-test.tsx +++ b/packages/react-router/__tests__/dom/nav-link-active-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { render, fireEvent, waitFor, screen } from "@testing-library/react"; import "@testing-library/jest-dom"; import { JSDOM } from "jsdom"; diff --git a/packages/react-router/__tests__/dom/navigate-encode-params-test.tsx b/packages/react-router/__tests__/dom/navigate-encode-params-test.tsx index efae1baafb..c20d1a2f8c 100644 --- a/packages/react-router/__tests__/dom/navigate-encode-params-test.tsx +++ b/packages/react-router/__tests__/dom/navigate-encode-params-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import * as ReactDOM from "react-dom/client"; import { act } from "react-dom/test-utils"; diff --git a/packages/react-router/__tests__/dom/partial-hydration-test.tsx b/packages/react-router/__tests__/dom/partial-hydration-test.tsx index c3dfee0ce1..a18d1324b5 100644 --- a/packages/react-router/__tests__/dom/partial-hydration-test.tsx +++ b/packages/react-router/__tests__/dom/partial-hydration-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import "@testing-library/jest-dom"; import { act, render, screen, waitFor } from "@testing-library/react"; import * as React from "react"; diff --git a/packages/react-router/__tests__/dom/scroll-restoration-test.tsx b/packages/react-router/__tests__/dom/scroll-restoration-test.tsx index 0ea665a25c..8be85e0287 100644 --- a/packages/react-router/__tests__/dom/scroll-restoration-test.tsx +++ b/packages/react-router/__tests__/dom/scroll-restoration-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { JSDOM } from "jsdom"; import * as React from "react"; import { render, fireEvent, screen } from "@testing-library/react"; diff --git a/packages/react-router/__tests__/dom/search-params-test.tsx b/packages/react-router/__tests__/dom/search-params-test.tsx index 0af262731c..7afece9c34 100644 --- a/packages/react-router/__tests__/dom/search-params-test.tsx +++ b/packages/react-router/__tests__/dom/search-params-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import * as ReactDOM from "react-dom/client"; import { act } from "react-dom/test-utils"; diff --git a/packages/react-router/__tests__/dom/special-characters-test.tsx b/packages/react-router/__tests__/dom/special-characters-test.tsx index ed1746893c..67a0cc5cc2 100644 --- a/packages/react-router/__tests__/dom/special-characters-test.tsx +++ b/packages/react-router/__tests__/dom/special-characters-test.tsx @@ -1,6 +1,3 @@ -/** - * @jest-environment jsdom - */ /* eslint-disable jest/expect-expect */ import { JSDOM } from "jsdom"; diff --git a/packages/react-router/__tests__/dom/ssr/components-test.tsx b/packages/react-router/__tests__/dom/ssr/components-test.tsx index effdb92bf8..0f818238f8 100644 --- a/packages/react-router/__tests__/dom/ssr/components-test.tsx +++ b/packages/react-router/__tests__/dom/ssr/components-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { createStaticHandler } from "react-router"; import { act, fireEvent, render } from "@testing-library/react"; import * as React from "react"; diff --git a/packages/react-router/__tests__/dom/ssr/meta-test.tsx b/packages/react-router/__tests__/dom/ssr/meta-test.tsx index d348931739..018dd8a83f 100644 --- a/packages/react-router/__tests__/dom/ssr/meta-test.tsx +++ b/packages/react-router/__tests__/dom/ssr/meta-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { prettyDOM, render, screen } from "@testing-library/react"; import user from "@testing-library/user-event"; import * as React from "react"; diff --git a/packages/react-router/__tests__/dom/stub-test.tsx b/packages/react-router/__tests__/dom/stub-test.tsx index ee5332ab92..b113778b98 100644 --- a/packages/react-router/__tests__/dom/stub-test.tsx +++ b/packages/react-router/__tests__/dom/stub-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import { render, screen, waitFor } from "@testing-library/react"; import user from "@testing-library/user-event"; diff --git a/packages/react-router/__tests__/dom/trailing-slashes-test.tsx b/packages/react-router/__tests__/dom/trailing-slashes-test.tsx index 66184aaf38..8628f00f0e 100644 --- a/packages/react-router/__tests__/dom/trailing-slashes-test.tsx +++ b/packages/react-router/__tests__/dom/trailing-slashes-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { JSDOM } from "jsdom"; import * as React from "react"; import * as ReactDOM from "react-dom/client"; diff --git a/packages/react-router/__tests__/dom/use-blocker-test.tsx b/packages/react-router/__tests__/dom/use-blocker-test.tsx index 4c0de23817..f62481a009 100644 --- a/packages/react-router/__tests__/dom/use-blocker-test.tsx +++ b/packages/react-router/__tests__/dom/use-blocker-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import * as ReactDOM from "react-dom/client"; import { act } from "react-dom/test-utils"; diff --git a/packages/react-router/__tests__/dom/use-prompt-test.tsx b/packages/react-router/__tests__/dom/use-prompt-test.tsx index 7c3ca15049..09f6798967 100644 --- a/packages/react-router/__tests__/dom/use-prompt-test.tsx +++ b/packages/react-router/__tests__/dom/use-prompt-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import { diff --git a/packages/react-router/__tests__/dom/useLinkClickHandler-test.tsx b/packages/react-router/__tests__/dom/useLinkClickHandler-test.tsx index 0ea3ba1bc0..70b0c56821 100644 --- a/packages/react-router/__tests__/dom/useLinkClickHandler-test.tsx +++ b/packages/react-router/__tests__/dom/useLinkClickHandler-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import * as ReactDOM from "react-dom/client"; import { act } from "react-dom/test-utils"; diff --git a/packages/react-router/__tests__/navigate-test.tsx b/packages/react-router/__tests__/navigate-test.tsx index 42128983f8..8ec88ede60 100644 --- a/packages/react-router/__tests__/navigate-test.tsx +++ b/packages/react-router/__tests__/navigate-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import * as TestRenderer from "react-test-renderer"; import { diff --git a/packages/react-router/__tests__/router/browser-test.ts b/packages/react-router/__tests__/router/browser-test.ts index e51b3dbe04..31f3ff6f60 100644 --- a/packages/react-router/__tests__/router/browser-test.ts +++ b/packages/react-router/__tests__/router/browser-test.ts @@ -1,6 +1,3 @@ -/** - * @jest-environment jsdom - */ /* eslint-disable jest/expect-expect */ import { JSDOM } from "jsdom"; diff --git a/packages/react-router/__tests__/router/defer-test.ts b/packages/react-router/__tests__/router/defer-test.ts index e775011a4d..d7a60bb2cb 100644 --- a/packages/react-router/__tests__/router/defer-test.ts +++ b/packages/react-router/__tests__/router/defer-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { createMemoryHistory } from "../../lib/router"; import { createRouter } from "../../lib/router"; import { diff --git a/packages/react-router/__tests__/router/fetchers-test.ts b/packages/react-router/__tests__/router/fetchers-test.ts index a8fd14759b..27372a7b46 100644 --- a/packages/react-router/__tests__/router/fetchers-test.ts +++ b/packages/react-router/__tests__/router/fetchers-test.ts @@ -1,6 +1,3 @@ -/** - * @jest-environment jsdom - */ /* eslint-disable jest/valid-title */ import type { FutureConfig, HydrationState } from "../../lib/router"; diff --git a/packages/react-router/__tests__/router/flush-sync-test.ts b/packages/react-router/__tests__/router/flush-sync-test.ts index 66528606b9..67b7bdead7 100644 --- a/packages/react-router/__tests__/router/flush-sync-test.ts +++ b/packages/react-router/__tests__/router/flush-sync-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { cleanup, setup } from "./utils/data-router-setup"; import { createFormData } from "./utils/utils"; diff --git a/packages/react-router/__tests__/router/hash-base-test.ts b/packages/react-router/__tests__/router/hash-base-test.ts index 65dfb2030e..d93aea2f70 100644 --- a/packages/react-router/__tests__/router/hash-base-test.ts +++ b/packages/react-router/__tests__/router/hash-base-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { JSDOM } from "jsdom"; import type { HashHistory } from "../../lib/router"; diff --git a/packages/react-router/__tests__/router/hash-test.ts b/packages/react-router/__tests__/router/hash-test.ts index 5d09761b2d..c0895823c4 100644 --- a/packages/react-router/__tests__/router/hash-test.ts +++ b/packages/react-router/__tests__/router/hash-test.ts @@ -1,6 +1,3 @@ -/** - * @jest-environment jsdom - */ /* eslint-disable jest/expect-expect */ import { JSDOM } from "jsdom"; diff --git a/packages/react-router/__tests__/router/interruptions-test.ts b/packages/react-router/__tests__/router/interruptions-test.ts index 6765d141a4..26d1fa1db8 100644 --- a/packages/react-router/__tests__/router/interruptions-test.ts +++ b/packages/react-router/__tests__/router/interruptions-test.ts @@ -1,6 +1,3 @@ -/** - * @jest-environment jsdom - */ /* eslint-disable jest/valid-title */ import type { HydrationState } from "../../lib/router"; diff --git a/packages/react-router/__tests__/router/lazy-test.ts b/packages/react-router/__tests__/router/lazy-test.ts index 6e879d1647..6ce0c57b5e 100644 --- a/packages/react-router/__tests__/router/lazy-test.ts +++ b/packages/react-router/__tests__/router/lazy-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { createMemoryHistory, createRouter, diff --git a/packages/react-router/__tests__/router/navigation-blocking-test.ts b/packages/react-router/__tests__/router/navigation-blocking-test.ts index de398f257b..a580aeb0bc 100644 --- a/packages/react-router/__tests__/router/navigation-blocking-test.ts +++ b/packages/react-router/__tests__/router/navigation-blocking-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import type { Router } from "../../lib/router"; import { createMemoryHistory, createRouter } from "../../lib/router"; diff --git a/packages/react-router/__tests__/router/navigation-test.ts b/packages/react-router/__tests__/router/navigation-test.ts index 4ec980f7bf..823e6e5665 100644 --- a/packages/react-router/__tests__/router/navigation-test.ts +++ b/packages/react-router/__tests__/router/navigation-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import type { HydrationState } from "../../lib/router"; import { json } from "../../lib/router"; import { cleanup, setup } from "./utils/data-router-setup"; diff --git a/packages/react-router/__tests__/router/redirects-test.ts b/packages/react-router/__tests__/router/redirects-test.ts index 66c067bbfb..ed7c8f1c5c 100644 --- a/packages/react-router/__tests__/router/redirects-test.ts +++ b/packages/react-router/__tests__/router/redirects-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { IDLE_NAVIGATION } from "../../lib/router"; import type { TestRouteObject } from "./utils/data-router-setup"; import { cleanup, setup } from "./utils/data-router-setup"; diff --git a/packages/react-router/__tests__/router/revalidate-test.ts b/packages/react-router/__tests__/router/revalidate-test.ts index 6a43b0e218..8f15661e36 100644 --- a/packages/react-router/__tests__/router/revalidate-test.ts +++ b/packages/react-router/__tests__/router/revalidate-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { createMemoryRouter } from "../../lib/components"; import { IDLE_NAVIGATION } from "../../lib/router"; import { diff --git a/packages/react-router/__tests__/router/router-memory-test.ts b/packages/react-router/__tests__/router/router-memory-test.ts index 39769bfcce..471e0521b7 100644 --- a/packages/react-router/__tests__/router/router-memory-test.ts +++ b/packages/react-router/__tests__/router/router-memory-test.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment node + */ + import { createMemoryHistory, createRouter } from "../../lib/router"; // This suite of tests specifically runs in the node jest environment to catch diff --git a/packages/react-router/__tests__/router/router-test.ts b/packages/react-router/__tests__/router/router-test.ts index 9c7e5e2e66..929c075460 100644 --- a/packages/react-router/__tests__/router/router-test.ts +++ b/packages/react-router/__tests__/router/router-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import type { HydrationState } from "../../lib/router"; import { createMemoryHistory, diff --git a/packages/react-router/__tests__/router/scroll-restoration-test.ts b/packages/react-router/__tests__/router/scroll-restoration-test.ts index c7b27900f0..933516661f 100644 --- a/packages/react-router/__tests__/router/scroll-restoration-test.ts +++ b/packages/react-router/__tests__/router/scroll-restoration-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import type { TestRouteObject } from "./utils/data-router-setup"; import { cleanup, setup } from "./utils/data-router-setup"; import { createFormData } from "./utils/utils"; diff --git a/packages/react-router/__tests__/router/should-revalidate-test.ts b/packages/react-router/__tests__/router/should-revalidate-test.ts index e27d05274d..f1aebc5f38 100644 --- a/packages/react-router/__tests__/router/should-revalidate-test.ts +++ b/packages/react-router/__tests__/router/should-revalidate-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { createMemoryHistory, createRouter, redirect } from "../../lib/router"; import type { ShouldRevalidateFunctionArgs } from "../../lib/router"; import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "../../lib/router"; diff --git a/packages/react-router/__tests__/router/submission-test.ts b/packages/react-router/__tests__/router/submission-test.ts index 721a5f8808..2f0744b9ac 100644 --- a/packages/react-router/__tests__/router/submission-test.ts +++ b/packages/react-router/__tests__/router/submission-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import type { HydrationState } from "../../lib/router"; import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "../../lib/router"; import { cleanup, setup } from "./utils/data-router-setup"; diff --git a/packages/react-router/__tests__/router/view-transition-test.ts b/packages/react-router/__tests__/router/view-transition-test.ts index 7f3ec884da..32ac8f451e 100644 --- a/packages/react-router/__tests__/router/view-transition-test.ts +++ b/packages/react-router/__tests__/router/view-transition-test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { IDLE_NAVIGATION } from "../../lib/router"; import { cleanup, setup } from "./utils/data-router-setup"; diff --git a/packages/react-router/__tests__/server-runtime/formData-test.ts b/packages/react-router/__tests__/server-runtime/formData-test.ts index f3ff5c8ba6..a7d859f057 100644 --- a/packages/react-router/__tests__/server-runtime/formData-test.ts +++ b/packages/react-router/__tests__/server-runtime/formData-test.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment node + */ + import { parseMultipartFormData } from "../../lib/server-runtime/formData"; declare global { diff --git a/packages/react-router/__tests__/server-runtime/responses-test.ts b/packages/react-router/__tests__/server-runtime/responses-test.ts index 7828854a42..f023d8c065 100644 --- a/packages/react-router/__tests__/server-runtime/responses-test.ts +++ b/packages/react-router/__tests__/server-runtime/responses-test.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment node + */ + import type { TypedResponse } from "../../lib/server-runtime/responses"; import { json, redirect } from "../../lib/server-runtime/responses"; import { isEqual } from "./utils"; diff --git a/packages/react-router/__tests__/server-runtime/server-test.ts b/packages/react-router/__tests__/server-runtime/server-test.ts index 48b3ce5f9f..3382615162 100644 --- a/packages/react-router/__tests__/server-runtime/server-test.ts +++ b/packages/react-router/__tests__/server-runtime/server-test.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment node + */ + import type { StaticHandlerContext } from "react-router"; import { json } from "react-router"; diff --git a/packages/react-router/__tests__/use-revalidator-test.tsx b/packages/react-router/__tests__/use-revalidator-test.tsx index fa83a6a91b..192262d94d 100644 --- a/packages/react-router/__tests__/use-revalidator-test.tsx +++ b/packages/react-router/__tests__/use-revalidator-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import "@testing-library/jest-dom"; import { fireEvent, diff --git a/packages/react-router/__tests__/useResolvedPath-test.tsx b/packages/react-router/__tests__/useResolvedPath-test.tsx index dbe3cbf458..e9ca3ac63e 100644 --- a/packages/react-router/__tests__/useResolvedPath-test.tsx +++ b/packages/react-router/__tests__/useResolvedPath-test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import * as React from "react"; import * as TestRenderer from "react-test-renderer"; import type { Path } from "react-router"; diff --git a/packages/react-router/jest.config.js b/packages/react-router/jest.config.js index 72ddb765df..8408526b8d 100644 --- a/packages/react-router/jest.config.js +++ b/packages/react-router/jest.config.js @@ -2,4 +2,5 @@ module.exports = { ...require("../../jest/jest.config.shared"), setupFilesAfterEnv: ["@testing-library/jest-dom"], + testEnvironment: "jsdom", };