@@ -12,7 +12,7 @@ import type { StackTraceParserOptions } from '@vitest/utils/source-map'
1212import { API_PATH } from '../constants'
1313import type { Vitest } from '../node'
1414import type { File , ModuleGraphData , Reporter , TaskResultPack , UserConsoleLog } from '../types'
15- import { getModuleGraph , isPrimitive , stringifyReplace } from '../utils'
15+ import { getModuleGraph , isPrimitive , noop , stringifyReplace } from '../utils'
1616import type { WorkspaceProject } from '../node/workspace'
1717import { parseErrorStacktrace } from '../utils/source-map'
1818import 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