Skip to content

Commit

Permalink
test: reduce hmr test flakiness (#11075)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Nov 25, 2022
1 parent 96ed795 commit 9693176
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions playground/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,29 @@ export async function withRetry(
await func()
}

type UntilBrowserLogAfterCallback = (logs: string[]) => PromiseLike<void> | void

export async function untilBrowserLogAfter(
operation: () => any,
target: string | RegExp | Array<string | RegExp>,
expectOrder?: boolean,
callback?: UntilBrowserLogAfterCallback
): Promise<string[]>
export async function untilBrowserLogAfter(
operation: () => any,
target: string | RegExp | Array<string | RegExp>,
callback?: (logs: string[]) => PromiseLike<void> | void
callback?: UntilBrowserLogAfterCallback
): Promise<string[]>
export async function untilBrowserLogAfter(
operation: () => any,
target: string | RegExp | Array<string | RegExp>,
arg3?: boolean | UntilBrowserLogAfterCallback,
arg4?: UntilBrowserLogAfterCallback
): Promise<string[]> {
const promise = untilBrowserLog(target, false)
const expectOrder = typeof arg3 === 'boolean' ? arg3 : false
const callback = typeof arg3 === 'boolean' ? arg4 : arg3

const promise = untilBrowserLog(target, expectOrder)
await operation()
const logs = await promise
if (callback) {
Expand Down

0 comments on commit 9693176

Please sign in to comment.