|
1 | 1 | import fs from "node:fs";
|
2 | 2 | import path from "node:path";
|
| 3 | +import { PassThrough } from "node:stream"; |
3 | 4 | import { test, expect } from "@playwright/test";
|
4 | 5 |
|
5 | 6 | import {
|
@@ -153,7 +154,9 @@ test.describe("Prerendering", () => {
|
153 | 154 | });
|
154 | 155 |
|
155 | 156 | test("Prerenders known static routes when true is specified", async () => {
|
| 157 | + let buildStdio = new PassThrough(); |
156 | 158 | fixture = await createFixture({
|
| 159 | + buildStdio, |
157 | 160 | prerender: true,
|
158 | 161 | files: {
|
159 | 162 | ...files,
|
@@ -192,6 +195,26 @@ test.describe("Prerendering", () => {
|
192 | 195 | `,
|
193 | 196 | },
|
194 | 197 | });
|
| 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 | + |
195 | 218 | appFixture = await createAppFixture(fixture);
|
196 | 219 |
|
197 | 220 | let clientDir = path.join(fixture.projectDir, "build", "client");
|
|
0 commit comments