@@ -103,9 +103,6 @@ class VerboseReporter {
103103 const fileStats = this . stats && evt . testFile ? this . stats . byFile . get ( evt . testFile ) : null ;
104104
105105 switch ( evt . type ) {
106- case 'declared-test' :
107- this . addTestRunning ( evt . testFile , evt . title ) ;
108- break ;
109106 case 'hook-failed' :
110107 this . failures . push ( evt ) ;
111108 this . writeTestSummary ( evt ) ;
@@ -145,20 +142,25 @@ class VerboseReporter {
145142 this . stats = evt . stats ;
146143 break ;
147144 case 'test-failed' :
148- this . removeTestRunning ( evt . testFile , evt . title ) ;
149145 this . failures . push ( evt ) ;
150146 this . writeTestSummary ( evt ) ;
151147 break ;
152148 case 'test-passed' :
153- this . removeTestRunning ( evt . testFile , evt . title ) ;
154149 if ( evt . knownFailing ) {
155150 this . knownFailures . push ( evt ) ;
156151 }
157152
158153 this . writeTestSummary ( evt ) ;
159154 break ;
160155 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 ) ;
162164 break ;
163165 case 'uncaught-exception' :
164166 this . lineWriter . ensureEmptyLine ( ) ;
@@ -261,42 +263,18 @@ class VerboseReporter {
261263 }
262264 }
263265
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+ }
296271
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 ) } ` ) ;
299275 }
276+
277+ this . lineWriter . writeLine ( '' ) ;
300278 }
301279 }
302280
0 commit comments