File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "semi": false,
3+ "singleQuote": true,
4+ "trailingComma": "none"
5+ }
Original file line number Diff line number Diff line change @@ -6,27 +6,25 @@ type SetupWorker = ReturnType<typeof setupWorker>
66
77export let api : SetupWorker
88
9- type ContextfulWorker = SetupWorker & {
10- context : { isMockingEnabled : boolean ; activationPromise ?: any }
11- }
12-
139export type InitializeOptions = Parameters < SetupWorker [ 'start' ] > [ 0 ]
1410
11+ let activationPromise : Promise < void >
12+
1513export function initialize (
1614 options ?: InitializeOptions ,
1715 initialHandlers : RequestHandler [ ] = [ ]
1816) : SetupWorker {
19- const worker = setupWorker ( ...initialHandlers ) as ContextfulWorker
20- worker . context . activationPromise = worker . start (
21- augmentInitializeOptions ( options )
22- )
17+ const worker = setupWorker ( ...initialHandlers )
18+ activationPromise = worker
19+ . start ( augmentInitializeOptions ( options ) )
20+ . then ( ( ) => { } )
2321 api = worker
2422 return worker
2523}
2624
2725export async function waitForMswReady ( ) {
28- const msw = getWorker ( ) as ContextfulWorker
29- await msw . context . activationPromise
26+ getWorker ( )
27+ await activationPromise
3028}
3129
3230export function getWorker ( ) : SetupWorker {
You can’t perform that action at this time.
0 commit comments