@@ -39,7 +39,6 @@ interface TestContext {
3939 flushEvents : ( ) => Promise < void >
4040 deleteAllCookies : ( ) => Promise < void >
4141 sendXhr : ( url : string , headers ?: string [ ] [ ] ) => Promise < string >
42- interactWithWorker : ( cb : ( worker : ServiceWorker ) => void ) => Promise < void >
4342}
4443
4544type TestRunner = ( testContext : TestContext ) => Promise < void > | void
@@ -132,9 +131,8 @@ class TestBuilder {
132131 return this
133132 }
134133
135- withWorker ( implementation : WorkerImplementationFactory , options : RegistrationOptions = { } ) {
136- implementation . isModule = options . type === 'module'
137- this . workerImplementationFactory = implementation
134+ withWorker ( implementation : WorkerImplementationFactory [ 'implementation' ] , options : RegistrationOptions = { } ) {
135+ this . workerImplementationFactory = { ...options , implementation }
138136
139137 // Service workers require HTTPS or localhost due to browser security restrictions
140138 this . withHostName ( 'localhost' )
@@ -175,7 +173,7 @@ class TestBuilder {
175173 testFixture : this . testFixture ,
176174 extension : this . extension ,
177175 hostName : this . hostName ,
178- workerImplementation : this . workerImplementationFactory ,
176+ workerImplementationFactory : this . workerImplementationFactory ,
179177 }
180178
181179 if ( this . alsoRunWithRumSlim ) {
@@ -255,7 +253,7 @@ function declareTest(title: string, setupOptions: SetupOptions, factory: SetupFa
255253 servers . base . bindServerApp (
256254 createMockServerApp ( servers , setup , {
257255 remoteConfiguration : setupOptions . remoteConfiguration ,
258- workerImplementation : setupOptions . workerImplementation && workerSetup ( setupOptions , servers ) ,
256+ workerImplementation : setupOptions . workerImplementationFactory && workerSetup ( setupOptions , servers ) ,
259257 } )
260258 )
261259 servers . crossOrigin . bindServerApp ( createMockServerApp ( servers , setup ) )
@@ -299,9 +297,6 @@ function createTestContext(
299297 browserLogsManager . clear ( )
300298 }
301299 } ,
302- interactWithWorker : async ( cb : ( worker : ServiceWorker ) => void ) => {
303- await page . evaluate ( `(${ cb . toString ( ) } )(window.myServiceWorker.active)` )
304- } ,
305300 flushBrowserLogs : ( ) => browserLogsManager . clear ( ) ,
306301 flushEvents : ( ) => flushEvents ( page ) ,
307302 deleteAllCookies : ( ) => deleteAllCookies ( browserContext ) ,
0 commit comments