Skip to content

Commit 2b777bf

Browse files
committed
fix: handle args as potentially undefined
1 parent 59ab3ff commit 2b777bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ export interface CreateWorkerFixtureArgs {
1111
}
1212

1313
export function createWorkerFixture(
14-
args: CreateWorkerFixtureArgs,
14+
args?: CreateWorkerFixtureArgs,
1515
/** @todo `onUnhandledRequest`? */
1616
): TestFixture<WorkerFixture, any> {
1717
return async ({ page }, use) => {
1818
const worker = new WorkerFixture({
1919
page,
20-
initialHandlers: args.initialHandlers,
20+
initialHandlers: args?.initialHandlers || [],
2121
})
2222

2323
await worker.start()
@@ -30,7 +30,7 @@ export class WorkerFixture extends SetupApi<LifeCycleEventsMap> {
3030
#page: Page
3131

3232
constructor(args: { page: Page; initialHandlers: Array<RequestHandler> }) {
33-
super(...(args.initialHandlers || []))
33+
super(...args.initialHandlers)
3434
this.#page = args.page
3535
}
3636

0 commit comments

Comments
 (0)