File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1
1
var Stream = require ( 'stream' ) ;
2
+ var json = typeof JSON === 'object' ? JSON : require ( 'jsonify' ) ;
2
3
3
4
module . exports = Render ;
4
5
@@ -57,5 +58,27 @@ function encodeResult (res, count) {
57
58
else if ( res . todo ) output += ' # TODO' ;
58
59
59
60
output += '\n' ;
61
+
62
+ if ( ! res . ok ) {
63
+ var outer = Array ( res . indent + 3 ) . join ( ' ' ) ;
64
+ var inner = outer + ' ' ;
65
+ output += outer + '---\n' ;
66
+ output += inner + 'operator: ' + res . operator + '\n' ;
67
+
68
+ var ex = json . stringify ( res . expected ) ;
69
+ var ac = json . stringify ( res . actual ) ;
70
+
71
+ if ( Math . max ( ex . length , ac . length ) > 65 ) {
72
+ output += inner + 'expected:\n' + inner + ' ' + ex + '\n' ;
73
+ output += inner + 'actual:\n' + inner + ' ' + ac + '\n' ;
74
+ }
75
+ else {
76
+ output += inner + 'expected: ' + ex + '\n' ;
77
+ output += inner + 'actual: ' + ac + '\n' ;
78
+ }
79
+
80
+ output += outer + '...\n' ;
81
+ }
82
+
60
83
return output ;
61
84
}
You can’t perform that action at this time.
0 commit comments