Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration/client-data-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ test.describe("Client Data", () => {
templateName,
files: {
"react-router.config.ts": reactRouterConfig({
v8_splitRouteModules,
future: { v8_splitRouteModules },
}),
"app/root.tsx": js`
import { Form, Outlet, Scripts } from "react-router"
Expand Down
36 changes: 1 addition & 35 deletions integration/helpers/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,7 @@ const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const root = path.resolve(__dirname, "../..");
const TMP_DIR = path.join(root, ".tmp/integration");

export const reactRouterConfig = ({
ssr,
basename,
prerender,
appDirectory,
v8_middleware,
v8_splitRouteModules,
v8_viteEnvironmentApi,
unstable_subResourceIntegrity,
routeDiscovery,
}: {
ssr?: boolean;
basename?: string;
prerender?: boolean | string[];
appDirectory?: string;
v8_middleware?: boolean;
v8_splitRouteModules?: NonNullable<Config["future"]>["v8_splitRouteModules"];
v8_viteEnvironmentApi?: boolean;
unstable_subResourceIntegrity?: boolean;
routeDiscovery?: Config["routeDiscovery"];
}) => {
let config: Config = {
ssr,
basename,
prerender,
appDirectory,
routeDiscovery,
future: {
v8_middleware,
v8_splitRouteModules,
v8_viteEnvironmentApi,
unstable_subResourceIntegrity,
},
};

export const reactRouterConfig = (config: Partial<Config>) => {
return dedent`
import type { Config } from "@react-router/dev/config";

Expand Down
20 changes: 10 additions & 10 deletions integration/middleware-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test.describe("Middleware", () => {
// ...existing code...
"react-router.config.ts": reactRouterConfig({
ssr: false,
v8_middleware: true,
future: { v8_middleware: true },
}),
"vite.config.ts": js`
import { defineConfig } from "vite";
Expand Down Expand Up @@ -368,8 +368,7 @@ test.describe("Middleware", () => {
files: {
"react-router.config.ts": reactRouterConfig({
ssr: false,
v8_middleware: true,
v8_splitRouteModules: true,
future: { v8_middleware: true, v8_splitRouteModules: true },
}),
"vite.config.ts": js`
import { defineConfig } from "vite";
Expand Down Expand Up @@ -466,7 +465,7 @@ test.describe("Middleware", () => {
fixture = await createFixture({
files: {
"react-router.config.ts": reactRouterConfig({
v8_middleware: true,
future: { v8_middleware: true },
}),
"vite.config.ts": js`
import { defineConfig } from "vite";
Expand Down Expand Up @@ -773,7 +772,7 @@ test.describe("Middleware", () => {
let fixture = await createFixture({
files: {
"react-router.config.ts": reactRouterConfig({
v8_middleware: true,
future: { v8_middleware: true },
}),
"vite.config.ts": js`
import { defineConfig } from "vite";
Expand Down Expand Up @@ -895,7 +894,7 @@ test.describe("Middleware", () => {
let fixture = await createFixture({
files: {
"react-router.config.ts": reactRouterConfig({
v8_middleware: true,
future: { v8_middleware: true },
}),
"vite.config.ts": js`
import { defineConfig } from "vite";
Expand Down Expand Up @@ -1060,8 +1059,7 @@ test.describe("Middleware", () => {
fixture = await createFixture({
files: {
"react-router.config.ts": reactRouterConfig({
v8_middleware: true,
v8_splitRouteModules: true,
future: { v8_middleware: true, v8_splitRouteModules: true },
}),
"vite.config.ts": js`
import { defineConfig } from "vite";
Expand Down Expand Up @@ -1156,7 +1154,9 @@ test.describe("Middleware", () => {
test.beforeAll(async () => {
fixture = await createFixture({
files: {
"react-router.config.ts": reactRouterConfig({ v8_middleware: true }),
"react-router.config.ts": reactRouterConfig({
future: { v8_middleware: true },
}),
"vite.config.ts": js`
import { defineConfig } from "vite";
import { reactRouter } from "@react-router/dev/vite";
Expand Down Expand Up @@ -1983,7 +1983,7 @@ test.describe("Middleware", () => {
{
files: {
"react-router.config.ts": reactRouterConfig({
v8_middleware: true,
future: { v8_middleware: true },
}),
"vite.config.ts": js`
import { defineConfig } from "vite";
Expand Down
12 changes: 6 additions & 6 deletions integration/split-route-modules-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ test.describe("Split route modules", async () => {
port = await getPort();
cwd = await createProject({
"react-router.config.ts": reactRouterConfig({
v8_splitRouteModules,
future: { v8_splitRouteModules },
}),
"vite.config.js": await viteConfig.basic({ port }),
...files,
Expand Down Expand Up @@ -366,7 +366,7 @@ test.describe("Split route modules", async () => {
port = await getPort();
cwd = await createProject({
"react-router.config.ts": reactRouterConfig({
v8_splitRouteModules,
future: { v8_splitRouteModules },
}),
"vite.config.js": await viteConfig.basic({ port }),
...files,
Expand Down Expand Up @@ -457,7 +457,7 @@ test.describe("Split route modules", async () => {
port = await getPort();
cwd = await createProject({
"react-router.config.ts": reactRouterConfig({
v8_splitRouteModules,
future: { v8_splitRouteModules },
}),
"vite.config.js": await viteConfig.basic({ port }),
// Make unsplittable routes valid so the build can pass
Expand All @@ -477,7 +477,7 @@ test.describe("Split route modules", async () => {
port = await getPort();
cwd = await createProject({
"react-router.config.ts": reactRouterConfig({
v8_splitRouteModules,
future: { v8_splitRouteModules },
}),
"vite.config.js": await viteConfig.basic({ port }),
"app/root.tsx": js`
Expand Down Expand Up @@ -505,7 +505,7 @@ test.describe("Split route modules", async () => {
port = await getPort();
cwd = await createProject({
"react-router.config.ts": reactRouterConfig({
v8_splitRouteModules,
future: { v8_splitRouteModules },
}),
"vite.config.js": await viteConfig.basic({ port }),
"app/root.tsx": js`
Expand Down Expand Up @@ -534,7 +534,7 @@ test.describe("Split route modules", async () => {
port = await getPort();
cwd = await createProject({
"react-router.config.ts": reactRouterConfig({
v8_splitRouteModules,
future: { v8_splitRouteModules },
}),
"vite.config.js": await viteConfig.basic({ port }),
...files,
Expand Down
2 changes: 1 addition & 1 deletion integration/sri-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test.describe("CSub-Resource Integrity", () => {
fixture = await createFixture({
files: {
"react-router.config.ts": reactRouterConfig({
unstable_subResourceIntegrity: true,
future: { unstable_subResourceIntegrity: true },
}),
"app/root.tsx": js`
import { Links, Meta, Outlet, Scripts } from "react-router";
Expand Down
2 changes: 1 addition & 1 deletion integration/vite-build-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.describe("Build", () => {
ENV_VAR_FROM_DOTENV_FILE=true
`,
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi,
future: { v8_viteEnvironmentApi },
}),
"vite.config.ts": js`
import { defineConfig } from "vite";
Expand Down
4 changes: 3 additions & 1 deletion integration/vite-cloudflare-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ function getFiles({
v8_viteEnvironmentApi: boolean;
}): Files {
return async ({ port }) => ({
"react-router.config.ts": reactRouterConfig({ v8_viteEnvironmentApi }),
"react-router.config.ts": reactRouterConfig({
future: { v8_viteEnvironmentApi },
}),
"vite.config.ts": `
import { reactRouter } from "@react-router/dev/vite";
import { cloudflareDevProxy } from "@react-router/dev/vite/cloudflare";
Expand Down
20 changes: 15 additions & 5 deletions integration/vite-css-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ test.describe("Vite CSS", () => {
cwd = await createProject(
{
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: templateName !== "vite-5-template",
future: {
v8_viteEnvironmentApi: templateName !== "vite-5-template",
},
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down Expand Up @@ -258,7 +260,9 @@ test.describe("Vite CSS", () => {
cwd = await createProject(
{
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: templateName !== "vite-5-template",
future: {
v8_viteEnvironmentApi: templateName !== "vite-5-template",
},
basename: base,
}),
"vite.config.ts": await viteConfig.basic({
Expand Down Expand Up @@ -301,7 +305,9 @@ test.describe("Vite CSS", () => {
cwd = await createProject(
{
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: templateName !== "vite-5-template",
future: {
v8_viteEnvironmentApi: templateName !== "vite-5-template",
},
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down Expand Up @@ -343,7 +349,9 @@ test.describe("Vite CSS", () => {
cwd = await createProject(
{
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: templateName !== "vite-5-template",
future: {
v8_viteEnvironmentApi: templateName !== "vite-5-template",
},
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down Expand Up @@ -414,7 +422,9 @@ test.describe("Vite CSS", () => {
cwd = await createProject(
{
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: templateName !== "vite-5-template",
future: {
v8_viteEnvironmentApi: templateName !== "vite-5-template",
},
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down
2 changes: 1 addition & 1 deletion integration/vite-dev-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test.describe("Vite dev", () => {
test.describe(`template: ${templateName} viteEnvironmentApi: ${v8_viteEnvironmentApi}`, () => {
const files: Files = async ({ port }) => ({
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi,
future: { v8_viteEnvironmentApi },
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down
4 changes: 2 additions & 2 deletions integration/vite-plugin-order-validation-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test.describe("Vite plugin order validation", () => {
});
`,
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: true,
future: { v8_viteEnvironmentApi: true },
}),
},
"rsc-vite-framework",
Expand Down Expand Up @@ -72,7 +72,7 @@ test.describe("Vite plugin order validation", () => {
});
`,
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: true,
future: { v8_viteEnvironmentApi: true },
}),
},
"rsc-vite-framework",
Expand Down
10 changes: 5 additions & 5 deletions integration/vite-preview-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test.describe("Vite preview", () => {
test("serves built app with vite preview", async ({ vitePreview, page }) => {
const files: Files = async ({ port }) => ({
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: true,
future: { v8_viteEnvironmentApi: true },
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down Expand Up @@ -97,7 +97,7 @@ test.describe("Vite preview", () => {
test("handles navigation between routes", async ({ vitePreview, page }) => {
const files: Files = async ({ port }) => ({
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: true,
future: { v8_viteEnvironmentApi: true },
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down Expand Up @@ -173,7 +173,7 @@ test.describe("Vite preview", () => {
test("handles loader data correctly", async ({ vitePreview, page }) => {
const files: Files = async ({ port }) => ({
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: true,
future: { v8_viteEnvironmentApi: true },
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down Expand Up @@ -247,7 +247,7 @@ test.describe("Vite preview", () => {
}) => {
const files: Files = async ({ port }) => ({
"react-router.config.ts": reactRouterConfig({
v8_viteEnvironmentApi: true,
future: { v8_viteEnvironmentApi: true },
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down Expand Up @@ -322,7 +322,7 @@ test.describe("Vite preview", () => {
const files: Files = async ({ port }) => ({
"react-router.config.ts": reactRouterConfig({
ssr: false,
v8_viteEnvironmentApi: true,
future: { v8_viteEnvironmentApi: true },
}),
"vite.config.ts": await viteConfig.basic({
port,
Expand Down
Loading