@@ -12,7 +12,7 @@ import type { StackTraceParserOptions } from '@vitest/utils/source-map'
12
12
import { API_PATH } from '../constants'
13
13
import type { Vitest } from '../node'
14
14
import type { File , ModuleGraphData , Reporter , TaskResultPack , UserConsoleLog } from '../types'
15
- import { getModuleGraph , isPrimitive , stringifyReplace } from '../utils'
15
+ import { getModuleGraph , isPrimitive , noop , stringifyReplace } from '../utils'
16
16
import type { WorkspaceProject } from '../node/workspace'
17
17
import { parseErrorStacktrace } from '../utils/source-map'
18
18
import type { TransformResultWithSource , WebSocketEvents , WebSocketHandlers } from './types'
@@ -168,7 +168,7 @@ export function setup(vitestOrWorkspace: Vitest | WorkspaceProject, _server?: Vi
168
168
{
169
169
post : msg => ws . send ( msg ) ,
170
170
on : fn => ws . on ( 'message' , fn ) ,
171
- eventNames : [ 'onUserConsoleLog' , 'onFinished' , 'onFinishedReportCoverage' , 'onCollected' , 'onCancel' ] ,
171
+ eventNames : [ 'onUserConsoleLog' , 'onFinished' , 'onFinishedReportCoverage' , 'onCollected' , 'onCancel' , 'onTaskUpdate' ] ,
172
172
serialize : ( data : any ) => stringify ( data , stringifyReplace ) ,
173
173
deserialize : parse ,
174
174
onTimeoutError ( functionName ) {
@@ -200,7 +200,7 @@ export class WebSocketReporter implements Reporter {
200
200
if ( this . clients . size === 0 )
201
201
return
202
202
this . clients . forEach ( ( client ) => {
203
- client . onCollected ?.( files )
203
+ client . onCollected ?.( files ) . catch ( noop )
204
204
} )
205
205
}
206
206
@@ -222,25 +222,25 @@ export class WebSocketReporter implements Reporter {
222
222
} )
223
223
224
224
this . clients . forEach ( ( client ) => {
225
- client . onTaskUpdate ?.( packs )
225
+ client . onTaskUpdate ?.( packs ) . catch ( noop )
226
226
} )
227
227
}
228
228
229
229
onFinished ( files ?: File [ ] , errors ?: unknown [ ] ) {
230
230
this . clients . forEach ( ( client ) => {
231
- client . onFinished ?.( files , errors )
231
+ client . onFinished ?.( files , errors ) . catch ( noop )
232
232
} )
233
233
}
234
234
235
235
onFinishedReportCoverage ( ) {
236
236
this . clients . forEach ( ( client ) => {
237
- client . onFinishedReportCoverage ?.( )
237
+ client . onFinishedReportCoverage ?.( ) . catch ( noop )
238
238
} )
239
239
}
240
240
241
241
onUserConsoleLog ( log : UserConsoleLog ) {
242
242
this . clients . forEach ( ( client ) => {
243
- client . onUserConsoleLog ?.( log )
243
+ client . onUserConsoleLog ?.( log ) . catch ( noop )
244
244
} )
245
245
}
246
246
}
0 commit comments