@@ -7,7 +7,7 @@ import prWorkflowRunRequestedFixture from './fixtures/pr.workflow_run.requested.
7
7
import prPullRequestSynchronizeFixture from './fixtures/pr.pull_request.json'
8
8
import { simulation } from '@simulacrum/github-api-simulator'
9
9
10
- let server ;
10
+ let server : Awaited < ReturnType < ReturnType < typeof simulation > [ 'listen' ] > > ;
11
11
let workerUrl : string ;
12
12
13
13
let worker : UnstableDevWorker
@@ -30,7 +30,7 @@ beforeAll(async () => {
30
30
worker = await unstable_dev ( `${ import . meta. dirname } /dist/_worker.js` , {
31
31
config : `${ import . meta. dirname } /wrangler.toml` ,
32
32
} )
33
- const url = `${ worker . proxyData . userWorkerUrl . protocol } //${ worker . proxyData . userWorkerUrl . hostname } :${ worker . proxyData . userWorkerUrl . port } `
33
+ const url = `${ worker . proxyData . userWorkerUrl . protocol } //${ worker . proxyData . userWorkerUrl . hostname } :${ worker . proxyData . userWorkerUrl . port } `
34
34
console . log ( url )
35
35
workerUrl = url
36
36
await ezSpawn . async ( `pnpm cross-env TEST=true API_URL=${ url } pnpm --filter=pkg-pr-new run build` , [ ] , {
@@ -47,8 +47,8 @@ describe.sequential.each([
47
47
[ pushWorkflowRunInProgressFixture ] ,
48
48
[ prWorkflowRunRequestedFixture , prPullRequestSynchronizeFixture ]
49
49
] as const ) ( 'webhook endpoints' , ( ...fixture ) => {
50
- const [ { event, payload} , pr ] = fixture
51
- const mode = pr ? 'pr' : 'commit'
50
+ const [ { event, payload } , pr ] = fixture
51
+ const mode = pr ? 'pr' : 'commit'
52
52
it ( `handles ${ mode } events` , async ( ) => {
53
53
// Send PR event if exists
54
54
if ( pr ) {
@@ -93,18 +93,18 @@ describe.sequential.each([
93
93
. map ( ( [ k , v ] ) => `${ k } =${ JSON . stringify ( v ) } ` )
94
94
. join ( " " ) ;
95
95
96
- try {
97
- const process = await ezSpawn . async ( `pnpm cross-env ${ env } pnpm run -w publish:playgrounds` , [ ] , {
98
- stdio : "overlapped" ,
99
- shell : true ,
100
- } ) ;
101
- console . log ( process . stdout )
96
+ try {
97
+ const process = await ezSpawn . async ( `pnpm cross-env ${ env } pnpm run -w publish:playgrounds` , [ ] , {
98
+ stdio : "overlapped" ,
99
+ shell : true ,
100
+ } ) ;
101
+ console . log ( process . stdout )
102
102
103
- } catch ( e ) {
104
- console . log ( e )
103
+ } catch ( e ) {
104
+ console . log ( e )
105
+
106
+ }
105
107
106
- }
107
-
108
108
} )
109
109
110
110
it ( `serves and installs playground-a for ${ mode } ` , async ( ) => {
@@ -127,7 +127,7 @@ describe.sequential.each([
127
127
expect ( shaBlobSize ) . toEqual ( refBlobSize ) ;
128
128
129
129
// Test installation
130
- const url = new URL ( `/${ owner } /${ repo } /playground-a@${ sha } ?id=${ Date . now ( ) } ` , workerUrl )
130
+ const url = new URL ( `/${ owner } /${ repo } /playground-a@${ sha } ?id=${ Date . now ( ) } ` , workerUrl )
131
131
const installProcess = await ezSpawn . async ( `pnpm cross-env CI=true npx -f playground-a@${ url } ` , {
132
132
stdio : "overlapped" ,
133
133
shell : true ,
@@ -144,7 +144,7 @@ describe.sequential.each([
144
144
expect ( response . status ) . toBe ( 200 )
145
145
146
146
// Test installation
147
- const url = new URL ( `/${ owner } /${ repo } /playground-b@${ sha } ?id=${ Date . now ( ) } ` , workerUrl )
147
+ const url = new URL ( `/${ owner } /${ repo } /playground-b@${ sha } ?id=${ Date . now ( ) } ` , workerUrl )
148
148
const installProcess = await ezSpawn . async ( `pnpm cross-env CI=true npx -f playground-b@${ url } ` , {
149
149
stdio : "overlapped" ,
150
150
shell : true ,
@@ -184,13 +184,13 @@ describe('URL redirects', () => {
184
184
185
185
async function fetchWithRedirect ( url : string , maxRedirects = 999 ) : Promise < Response > {
186
186
const response = await worker . fetch ( url , { redirect : 'manual' } )
187
-
187
+
188
188
if ( response . status >= 300 && response . status < 400 && maxRedirects > 0 ) {
189
189
const location = response . headers . get ( 'location' )
190
190
if ( location ) {
191
191
return fetchWithRedirect ( location , maxRedirects - 1 )
192
192
}
193
193
}
194
-
194
+
195
195
return response
196
196
}
0 commit comments