File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -155,10 +155,17 @@ exports.cursor = {
155155 }
156156} ;
157157
158- function showDiff ( err ) {
158+ function showDiff ( err ) {
159159 return err && err . showDiff !== false && sameType ( err . actual , err . expected ) && err . expected !== undefined ;
160160}
161161
162+ function stringifyDiffObjs ( err ) {
163+ if ( ! utils . isString ( err . actual ) || ! utils . isString ( err . expected ) ) {
164+ err . actual = utils . stringify ( err . actual ) ;
165+ err . expected = utils . stringify ( err . expected ) ;
166+ }
167+ }
168+
162169/**
163170 * Output the given `failures` as a list.
164171 *
@@ -204,6 +211,7 @@ exports.list = function (failures) {
204211 }
205212 // explicitly show diff
206213 if ( showDiff ( err ) ) {
214+ stringifyDiffObjs ( err ) ;
207215 escape = false ;
208216 fmt = color ( 'error title' , ' %s) %s:\n%s' ) + color ( 'error stack' , '\n%s\n' ) ;
209217 var match = message . match ( / ^ ( [ ^ : ] + ) : e x p e c t e d / ) ;
@@ -290,10 +298,7 @@ function Base (runner) {
290298 stats . failures = stats . failures || 0 ;
291299 stats . failures ++ ;
292300 if ( showDiff ( err ) ) {
293- if ( ! utils . isString ( err . actual ) || ! utils . isString ( err . expected ) ) {
294- err . actual = utils . stringify ( err . actual ) ;
295- err . expected = utils . stringify ( err . expected ) ;
296- }
301+ stringifyDiffObjs ( err ) ;
297302 }
298303 test . err = err ;
299304 failures . push ( test ) ;
Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ describe('List reporter', function () {
192192
193193 Base . cursor = cachedCursor ;
194194 } ) ;
195- it ( 'should immediately construct fail strings' , function ( ) {
195+ it ( 'should immediately construct fail strings' , function ( ) {
196196 var actual = { a : 'actual' } ;
197197 var expected = { a : 'expected' } ;
198198 var test = { } ;
You can’t perform that action at this time.
0 commit comments