Skip to content

Commit 38119b7

Browse files
committed
fix(vitest): ignore timeout on websocket reporter rpc
1 parent e77c553 commit 38119b7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/vitest/src/api/setup.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { StackTraceParserOptions } from '@vitest/utils/source-map'
1212
import { API_PATH } from '../constants'
1313
import type { Vitest } from '../node'
1414
import type { File, ModuleGraphData, Reporter, TaskResultPack, UserConsoleLog } from '../types'
15-
import { getModuleGraph, isPrimitive, stringifyReplace } from '../utils'
15+
import { getModuleGraph, isPrimitive, noop, stringifyReplace } from '../utils'
1616
import type { WorkspaceProject } from '../node/workspace'
1717
import { parseErrorStacktrace } from '../utils/source-map'
1818
import type { TransformResultWithSource, WebSocketEvents, WebSocketHandlers } from './types'
@@ -168,7 +168,7 @@ export function setup(vitestOrWorkspace: Vitest | WorkspaceProject, _server?: Vi
168168
{
169169
post: msg => ws.send(msg),
170170
on: fn => ws.on('message', fn),
171-
eventNames: ['onUserConsoleLog', 'onFinished', 'onFinishedReportCoverage', 'onCollected', 'onCancel'],
171+
eventNames: ['onUserConsoleLog', 'onFinished', 'onFinishedReportCoverage', 'onCollected', 'onCancel', 'onTaskUpdate'],
172172
serialize: (data: any) => stringify(data, stringifyReplace),
173173
deserialize: parse,
174174
onTimeoutError(functionName) {
@@ -200,7 +200,7 @@ export class WebSocketReporter implements Reporter {
200200
if (this.clients.size === 0)
201201
return
202202
this.clients.forEach((client) => {
203-
client.onCollected?.(files)
203+
client.onCollected?.(files).catch(noop)
204204
})
205205
}
206206

@@ -222,25 +222,25 @@ export class WebSocketReporter implements Reporter {
222222
})
223223

224224
this.clients.forEach((client) => {
225-
client.onTaskUpdate?.(packs)
225+
client.onTaskUpdate?.(packs).catch(noop)
226226
})
227227
}
228228

229229
onFinished(files?: File[], errors?: unknown[]) {
230230
this.clients.forEach((client) => {
231-
client.onFinished?.(files, errors)
231+
client.onFinished?.(files, errors).catch(noop)
232232
})
233233
}
234234

235235
onFinishedReportCoverage() {
236236
this.clients.forEach((client) => {
237-
client.onFinishedReportCoverage?.()
237+
client.onFinishedReportCoverage?.().catch(noop)
238238
})
239239
}
240240

241241
onUserConsoleLog(log: UserConsoleLog) {
242242
this.clients.forEach((client) => {
243-
client.onUserConsoleLog?.(log)
243+
client.onUserConsoleLog?.(log).catch(noop)
244244
})
245245
}
246246
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy