Skip to content

Commit 0b0cb33

Browse files
fixup! feat(test): replace cloudflare open-next build test with playwright tests
add new getWebServerConfig function instead of using a ternary
1 parent 40eb3e1 commit 0b0cb33

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

apps/site/playwright.config.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig, devices } from '@playwright/test';
1+
import { defineConfig, devices, type Config } from '@playwright/test';
22

33
const isCI = !!process.env.CI;
44

@@ -10,15 +10,7 @@ export default defineConfig({
1010
retries: isCI ? 2 : 0,
1111
workers: isCI ? 1 : undefined,
1212
reporter: isCI ? [['html'], ['github']] : [['html']],
13-
...(process.env.PLAYWRIGHT_RUN_CLOUDFLARE_PREVIEW
14-
? {
15-
webServer: {
16-
command: 'pnpm turbo run cloudflare:preview',
17-
url: process.env.PLAYWRIGHT_BASE_URL || 'http://127.0.0.1:3000',
18-
timeout: 60_000 * 3,
19-
},
20-
}
21-
: {}),
13+
...getWebServerConfig(),
2214
use: {
2315
baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://127.0.0.1:3000',
2416
trace: 'on-first-retry',
@@ -38,3 +30,17 @@ export default defineConfig({
3830
},
3931
],
4032
});
33+
34+
function getWebServerConfig(): Pick<Config, 'webServer'> {
35+
if (process.env.PLAYWRIGHT_RUN_CLOUDFLARE_PREVIEW) {
36+
return {
37+
webServer: {
38+
command: 'pnpm turbo run cloudflare:preview',
39+
url: process.env.PLAYWRIGHT_BASE_URL || 'http://127.0.0.1:3000',
40+
timeout: 60_000 * 3,
41+
},
42+
};
43+
}
44+
45+
return {};
46+
}

0 commit comments

Comments
 (0)