Skip to content

Commit

Permalink
chore: guard try/catch in websocket reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Mar 14, 2024
1 parent 8f04e79 commit efe441f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/vitest/src/api/setup.ts
Expand Up @@ -200,7 +200,7 @@ export class WebSocketReporter implements Reporter {
if (this.clients.size === 0)
return
this.clients.forEach((client) => {
client.onCollected?.(files).catch(noop)
client.onCollected?.(files)?.catch?.(noop)
})
}

Expand All @@ -222,25 +222,25 @@ export class WebSocketReporter implements Reporter {
})

this.clients.forEach((client) => {
client.onTaskUpdate?.(packs).catch(noop)
client.onTaskUpdate?.(packs)?.catch?.(noop)
})
}

onFinished(files?: File[], errors?: unknown[]) {
this.clients.forEach((client) => {
client.onFinished?.(files, errors).catch(noop)
client.onFinished?.(files, errors)?.catch?.(noop)
})
}

onFinishedReportCoverage() {
this.clients.forEach((client) => {
client.onFinishedReportCoverage?.().catch(noop)
client.onFinishedReportCoverage?.()?.catch?.(noop)
})
}

onUserConsoleLog(log: UserConsoleLog) {
this.clients.forEach((client) => {
client.onUserConsoleLog?.(log).catch(noop)
client.onUserConsoleLog?.(log)?.catch?.(noop)
})
}
}

0 comments on commit efe441f

Please sign in to comment.