File tree Expand file tree Collapse file tree 3 files changed +46
-4
lines changed
Expand file tree Collapse file tree 3 files changed +46
-4
lines changed Original file line number Diff line number Diff line change @@ -58,8 +58,10 @@ Results.prototype.createStream = function (opts) {
5858 ontest ( st , { parent : id } ) ;
5959 } ) ;
6060 t . on ( 'result' , function ( res ) {
61- res . test = id ;
62- res . type = 'assert' ;
61+ if ( res && typeof res === 'object' ) {
62+ res . test = id ;
63+ res . type = 'assert' ;
64+ }
6365 output . queue ( res ) ;
6466 } ) ;
6567 t . on ( 'end' , function ( ) {
Original file line number Diff line number Diff line change @@ -47,8 +47,7 @@ tap.test('object results', function (assert) {
4747 assert . end ( ) ;
4848 } ;
4949
50- tape . createStream ( { objectMode : true } )
51- . pipe ( printer ) ;
50+ tape . createStream ( { objectMode : true } ) . pipe ( printer ) ;
5251
5352 tape ( 'parent' , function ( t1 ) {
5453 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