File tree 3 files changed +46
-4
lines changed
3 files changed +46
-4
lines changed Original file line number Diff line number Diff line change @@ -60,8 +60,10 @@ Results.prototype.createStream = function (opts) {
60
60
ontest ( st , { parent : id } ) ;
61
61
} ) ;
62
62
t . on ( 'result' , function ( res ) {
63
- res . test = id ;
64
- res . type = 'assert' ;
63
+ if ( res && typeof res === 'object' ) {
64
+ res . test = id ;
65
+ res . type = 'assert' ;
66
+ }
65
67
output . queue ( res ) ;
66
68
} ) ;
67
69
t . on ( 'end' , function ( ) {
Original file line number Diff line number Diff line change @@ -49,8 +49,7 @@ tap.test('object results', function (assert) {
49
49
assert . end ( ) ;
50
50
} ;
51
51
52
- tape . createStream ( { objectMode : true } )
53
- . pipe ( printer ) ;
52
+ tape . createStream ( { objectMode : true } ) . pipe ( printer ) ;
54
53
55
54
tape ( 'parent' , function ( t1 ) {
56
55
t1 . equal ( true , true ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ var tap = require ( 'tap' ) ;
4
+ var tape = require ( '../' ) ;
5
+ var through = require ( 'through' ) ;
6
+
7
+ tap . test ( 'test.comment() in objectMode' , function ( assert ) {
8
+ var printer = through ( { objectMode : true } ) ;
9
+ var objects = [ ] ;
10
+ printer . on ( 'error' , function ( e ) {
11
+ assert . fail ( e ) ;
12
+ } ) ;
13
+
14
+ printer . write = function ( obj ) {
15
+ objects . push ( obj ) ;
16
+ } ;
17
+ printer . end = function ( obj ) {
18
+ if ( obj ) { objects . push ( obj ) ; }
19
+
20
+ assert . equal ( objects . length , 3 ) ;
21
+ assert . deepEqual ( objects , [
22
+ {
23
+ type : 'test' ,
24
+ name : 'test.comment' ,
25
+ id : 0 ,
26
+ skip : false ,
27
+ todo : false
28
+ } ,
29
+ 'message' ,
30
+ { type : 'end' , test : 0 }
31
+ ] ) ;
32
+ assert . end ( ) ;
33
+ } ;
34
+
35
+ tape . createStream ( { objectMode : true } ) . pipe ( printer ) ;
36
+
37
+ tape ( 'test.comment' , function ( test ) {
38
+ test . comment ( 'message' ) ;
39
+ test . end ( ) ;
40
+ } ) ;
41
+ } ) ;
You can’t perform that action at this time.
0 commit comments