Skip to content

Commit e6b7aad

Browse files
committed
Assert build warning during e2e test
1 parent 325d660 commit e6b7aad

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

integration/vite-prerender-test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from "node:fs";
22
import path from "node:path";
3+
import { PassThrough } from "node:stream";
34
import { test, expect } from "@playwright/test";
45

56
import {
@@ -153,7 +154,9 @@ test.describe("Prerendering", () => {
153154
});
154155

155156
test("Prerenders known static routes when true is specified", async () => {
157+
let buildStdio = new PassThrough();
156158
fixture = await createFixture({
159+
buildStdio,
157160
prerender: true,
158161
files: {
159162
...files,
@@ -192,6 +195,26 @@ test.describe("Prerendering", () => {
192195
`,
193196
},
194197
});
198+
199+
let buildOutput: string;
200+
let chunks: Buffer[] = [];
201+
buildOutput = await new Promise<string>((resolve, reject) => {
202+
buildStdio.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
203+
buildStdio.on("error", (err) => reject(err));
204+
buildStdio.on("end", () =>
205+
resolve(Buffer.concat(chunks).toString("utf8"))
206+
);
207+
});
208+
209+
expect(buildOutput).toContain(
210+
[
211+
"⚠️ Paths with dynamic/splat params cannot be prerendered when using `prerender: true`.",
212+
"You may want to use the `prerender()` API to prerender the following paths:",
213+
" - :slug",
214+
" - *",
215+
].join("\n")
216+
);
217+
195218
appFixture = await createAppFixture(fixture);
196219

197220
let clientDir = path.join(fixture.projectDir, "build", "client");

0 commit comments

Comments
 (0)