Skip to content

Commit b08373e

Browse files
Relax the timeout on vite-plugin playground test boot up (#11145)
Some of the vite-plugin playground tests really do take a few seconds to boot up. For example the Prisma one takes over 5 secs on my local machine. This occasionally leads to CI jobs (especially on Windows) timing out.
1 parent bb00f9d commit b08373e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/vite-plugin-cloudflare/playground/vitest-setup.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,14 @@ beforeAll(async (s) => {
9999
throw new Error("wsEndpoint not found");
100100
}
101101

102+
const logLabel = "bootup: " + testName;
103+
104+
console.time(logLabel);
105+
console.timeLog(logLabel, "Starting browser connect to", wsEndpoint);
102106
browser = await chromium.connect(wsEndpoint);
103107
// `@vitejs/plugin-basic-ssl` requires a manual confirmation step in the browser so we enable `ignoreHTTPSErrors` to bypass this
104108
page = await browser.newPage({ ignoreHTTPSErrors: true });
109+
console.timeLog(logLabel, `Browser connected`);
105110

106111
const globalConsole = console;
107112
const warn = globalConsole.warn;
@@ -112,6 +117,7 @@ beforeAll(async (s) => {
112117

113118
try {
114119
page.on("console", (msg) => {
120+
console.timeLog(logLabel, `BROWSER LOG [${msg.type()}]: ${msg.text()}`);
115121
// ignore favicon requests in headed browser
116122
if (
117123
process.env.VITE_DEBUG_SERVE &&
@@ -123,6 +129,7 @@ beforeAll(async (s) => {
123129
browserLogs.push(msg.text());
124130
});
125131
page.on("pageerror", (error) => {
132+
console.timeLog(logLabel, `BROWSER ERROR: ${error.message}`);
126133
browserErrors.push(error);
127134
});
128135

@@ -147,6 +154,7 @@ beforeAll(async (s) => {
147154
path.resolve(path.dirname(testPath), "serve.js"),
148155
].find((i) => fs.existsSync(i));
149156

157+
console.timeLog(logLabel, "Starting test server...");
150158
if (testCustomServe) {
151159
// test has custom server configuration.
152160
const mod = await import(testCustomServe);
@@ -163,6 +171,8 @@ beforeAll(async (s) => {
163171
} else {
164172
server = await startDefaultServe();
165173
}
174+
console.timeLog(logLabel, "Started test server...");
175+
console.timeEnd(logLabel);
166176
}
167177
} catch (e) {
168178
// Closing the page since an error in the setup, for example a runtime error
@@ -182,7 +192,7 @@ beforeAll(async (s) => {
182192
await watcher?.close();
183193
await browser?.close();
184194
};
185-
}, 15_000);
195+
}, 20_000);
186196

187197
export async function loadConfig(configEnv: ConfigEnv) {
188198
let config: UserConfig | null = null;

0 commit comments

Comments
 (0)