File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -82,18 +82,25 @@ MiniReporter.prototype.finish = function () {
8282 var i = 0 ;
8383
8484 if ( this . failCount > 0 ) {
85- this . api . tests . forEach ( function ( test ) {
85+ this . api . errors . forEach ( function ( test ) {
8686 if ( ! test . error || ! test . error . message ) {
8787 return ;
8888 }
8989
9090 i ++ ;
9191
9292 var title = test . error ? test . title : 'Unhandled Error' ;
93- var description = test . error ? beautifyStack ( test . error . stack ) : JSON . stringify ( test ) ;
93+ var description ;
94+
95+ if ( test . error ) {
96+ description = ' ' + test . error . message ;
97+ description += '\n ' + beautifyStack ( test . error . stack ) ;
98+ } else {
99+ description = JSON . stringify ( test ) ;
100+ }
94101
95102 status += '\n\n ' + chalk . red ( i + '.' , title ) + '\n' ;
96- status += ' ' + chalk . red ( description ) ;
103+ status += chalk . red ( description ) ;
97104 } ) ;
98105 }
99106
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ test('results with errors', function (t) {
137137 reporter . failCount = 1 ;
138138
139139 reporter . api = {
140- tests : [ {
140+ errors : [ {
141141 title : 'failed' ,
142142 error : new Error ( 'failure' )
143143 } ]
@@ -149,7 +149,8 @@ test('results with errors', function (t) {
149149 t . is ( output [ 1 ] , ' ' + chalk . red ( '1 failed' ) ) ;
150150 t . is ( output [ 2 ] , '' ) ;
151151 t . is ( output [ 3 ] , ' ' + chalk . red ( '1. failed' ) ) ;
152- t . match ( output [ 4 ] , / E r r o r : f a i l u r e / ) ;
153- t . match ( output [ 5 ] , / T e s t \. t e s t / ) ;
152+ t . match ( output [ 4 ] , / f a i l u r e / ) ;
153+ t . match ( output [ 5 ] , / E r r o r : f a i l u r e / ) ;
154+ t . match ( output [ 6 ] , / T e s t \. t e s t / ) ;
154155 t . end ( ) ;
155156} ) ;
You can’t perform that action at this time.
0 commit comments