@@ -103,9 +103,6 @@ class VerboseReporter {
103
103
const fileStats = this . stats && evt . testFile ? this . stats . byFile . get ( evt . testFile ) : null ;
104
104
105
105
switch ( evt . type ) {
106
- case 'declared-test' :
107
- this . addTestRunning ( evt . testFile , evt . title ) ;
108
- break ;
109
106
case 'hook-failed' :
110
107
this . failures . push ( evt ) ;
111
108
this . writeTestSummary ( evt ) ;
@@ -145,20 +142,25 @@ class VerboseReporter {
145
142
this . stats = evt . stats ;
146
143
break ;
147
144
case 'test-failed' :
148
- this . removeTestRunning ( evt . testFile , evt . title ) ;
149
145
this . failures . push ( evt ) ;
150
146
this . writeTestSummary ( evt ) ;
151
147
break ;
152
148
case 'test-passed' :
153
- this . removeTestRunning ( evt . testFile , evt . title ) ;
154
149
if ( evt . knownFailing ) {
155
150
this . knownFailures . push ( evt ) ;
156
151
}
157
152
158
153
this . writeTestSummary ( evt ) ;
159
154
break ;
160
155
case 'timeout' :
161
- this . writeTimeoutSummary ( evt ) ;
156
+ this . lineWriter . writeLine ( colors . error ( `\n${ figures . cross } Timed out while running tests` ) ) ;
157
+ this . lineWriter . writeLine ( '' ) ;
158
+ this . writePendingTests ( evt ) ;
159
+ break ;
160
+ case 'interrupt' :
161
+ this . lineWriter . writeLine ( colors . error ( `\n${ figures . cross } Exiting due to SIGINT` ) ) ;
162
+ this . lineWriter . writeLine ( '' ) ;
163
+ this . writePendingTests ( evt ) ;
162
164
break ;
163
165
case 'uncaught-exception' :
164
166
this . lineWriter . ensureEmptyLine ( ) ;
@@ -261,42 +263,18 @@ class VerboseReporter {
261
263
}
262
264
}
263
265
264
- addTestRunning ( file , title ) {
265
- if ( ! this . runningTestFiles . has ( file ) ) {
266
- this . runningTestFiles . set ( file , new Set ( ) ) ;
267
- }
268
-
269
- this . runningTestFiles . get ( file ) . add ( title ) ;
270
- }
271
-
272
- removeTestRunning ( file , title ) {
273
- const byFile = this . runningTestFiles . get ( file ) ;
274
- if ( byFile ) {
275
- byFile . delete ( title ) ;
276
- }
277
- }
278
-
279
- writeTimeoutSummary ( evt ) {
280
- this . lineWriter . writeLine ( colors . error ( `\n${ figures . cross } Exited because no new tests completed within the last ${ evt . period } ms of inactivity` ) ) ;
281
- let wroteTrailingSeparator = false ;
282
-
283
- for ( const timedOutFile of evt . timedOutWorkerFiles ) {
284
- const byFile = this . runningTestFiles . get ( timedOutFile ) ;
285
- if ( byFile ) {
286
- this . runningTestFiles . delete ( timedOutFile ) ;
287
-
288
- if ( ! wroteTrailingSeparator ) {
289
- this . lineWriter . writeLine ( '' ) ;
290
- }
291
-
292
- this . lineWriter . writeLine ( `${ byFile . size } tests still running in ${ timedOutFile } :\n` ) ;
293
- for ( const title of byFile ) {
294
- this . lineWriter . writeLine ( `${ figures . circleDotted } ${ this . prefixTitle ( timedOutFile , title ) } ` ) ;
295
- }
266
+ writePendingTests ( evt ) {
267
+ for ( const [ file , testsInFile ] of evt . pendingTests ) {
268
+ if ( testsInFile . size === 0 ) {
269
+ continue ;
270
+ }
296
271
297
- this . lineWriter . writeLine ( '' ) ;
298
- wroteTrailingSeparator = true ;
272
+ this . lineWriter . writeLine ( `${ testsInFile . size } tests were pending in ${ file } \n` ) ;
273
+ for ( const title of testsInFile ) {
274
+ this . lineWriter . writeLine ( `${ figures . circleDotted } ${ this . prefixTitle ( file , title ) } ` ) ;
299
275
}
276
+
277
+ this . lineWriter . writeLine ( '' ) ;
300
278
}
301
279
}
302
280
0 commit comments