File tree 3 files changed +48
-3
lines changed
3 files changed +48
-3
lines changed Original file line number Diff line number Diff line change 1
1
var Stream = require ( 'stream' ) ;
2
2
var json = typeof JSON === 'object' ? JSON : require ( 'jsonify' ) ;
3
+ var getSerialize = require ( 'json-stringify-safe' ) . getSerialize ( )
3
4
4
5
module . exports = Render ;
5
6
@@ -70,8 +71,8 @@ function encodeResult (res, count) {
70
71
output += outer + '---\n' ;
71
72
output += inner + 'operator: ' + res . operator + '\n' ;
72
73
73
- var ex = json . stringify ( res . expected ) || '' ;
74
- var ac = json . stringify ( res . actual ) || '' ;
74
+ var ex = json . stringify ( res . expected , getSerialize ) || '' ;
75
+ var ac = json . stringify ( res . actual , getSerialize ) || '' ;
75
76
76
77
if ( Math . max ( ex . length , ac . length ) > 65 ) {
77
78
output += inner + 'expected:\n' + inner + ' ' + ex + '\n' ;
Original file line number Diff line number Diff line change 11
11
"dependencies" : {
12
12
"jsonify" : " ~0.0.0" ,
13
13
"deep-equal" : " ~0.0.0" ,
14
- "defined" : " ~0.0.0"
14
+ "defined" : " ~0.0.0" ,
15
+ "json-stringify-safe" : " ~4.0.0"
15
16
},
16
17
"devDependencies" : {
17
18
"tap" : " ~0.3.0" ,
Original file line number Diff line number Diff line change
1
+ var tape = require ( '../' ) ;
2
+ var tap = require ( 'tap' ) ;
3
+
4
+ tap . test ( 'circular test' , function ( assert ) {
5
+ var test = tape . createHarness ( { exit : false } ) ;
6
+ var tc = tap . createConsumer ( ) ;
7
+
8
+ var rows = [ ] ;
9
+ tc . on ( 'data' , function ( r ) { rows . push ( r ) } ) ;
10
+ tc . on ( 'end' , function ( ) {
11
+ // console.log("rs", rows)
12
+
13
+ // console.log("deepEqual?")
14
+
15
+ assert . same ( rows , [
16
+ "TAP version 13"
17
+ , "circular"
18
+ , { id : 1
19
+ , ok : false
20
+ , name : " should be equal"
21
+ , operator : "equal"
22
+ , expected : "{}"
23
+ , actual : '{"circular":"[Circular]"}'
24
+ }
25
+ , "tests 1"
26
+ , "pass 0"
27
+ , "fail 1"
28
+ ] )
29
+ assert . end ( )
30
+ } )
31
+
32
+ // tt.equal(10, 10)
33
+ // tt.end()
34
+
35
+ test . stream . pipe ( tc ) ;
36
+
37
+ test ( "circular" , function ( t ) {
38
+ t . plan ( 1 )
39
+ var circular = { }
40
+ circular . circular = circular
41
+ t . equal ( circular , { } )
42
+ } )
43
+ } )
You can’t perform that action at this time.
0 commit comments