Skip to content

Commit b375915

Browse files
committed
test(build): bound the command contract
1 parent 5563775 commit b375915

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/vite-command-contract.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default defineConfig({
6969
"pages/legacy.tsx",
7070
`declare const __CONFIG_ONLY_MARKER__: string;
7171
export default function LegacyPage() {
72-
return <p>{__CONFIG_ONLY_MARKER__}</p>;
72+
return <p>{[__CONFIG_ONLY_MARKER__, process.env.NODE_ENV === "production" ? "vinext-pages-production-marker" : "vinext-pages-development-marker"].join(":")}</p>;
7373
}
7474
`,
7575
);
@@ -90,6 +90,7 @@ describe("configured vinext build contract", () => {
9090
cwd: root,
9191
env: { ...process.env, NODE_ENV: "development" },
9292
stdio: "pipe",
93+
timeout: 120_000,
9394
});
9495

9596
expect(fs.existsSync(path.join(root, "custom/server/index.js"))).toBe(true);
@@ -98,6 +99,8 @@ describe("configured vinext build contract", () => {
9899

99100
const pagesEntry = fs.readFileSync(path.join(root, "dist/server/entry.js"), "utf-8");
100101
expect(pagesEntry).toContain("config-only-plugin-ran");
102+
expect(pagesEntry).toContain("vinext-pages-production-marker");
103+
expect(pagesEntry).not.toContain("vinext-pages-development-marker");
101104
expect(pagesEntry).not.toContain("__CONFIG_ONLY_MARKER__");
102105

103106
const appOutput = fs

0 commit comments

Comments
 (0)