File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change 1- import { defineConfig , devices } from '@playwright/test' ;
1+ import { defineConfig , devices , type Config } from '@playwright/test' ;
22
33const 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+ }
You can’t perform that action at this time.
0 commit comments