File tree 3 files changed +27
-7
lines changed
3 files changed +27
-7
lines changed Original file line number Diff line number Diff line change
1
+ var tapSummary = require ( '..' )
2
+ var fs = require ( 'fs' )
3
+
4
+ fs . createReadStream ( __dirname + '/unnamed-test.tap' )
5
+ . pipe ( tapSummary ( ) )
6
+ . pipe ( process . stdout )
Original file line number Diff line number Diff line change
1
+ TAP version 13
2
+ 1..4
3
+ ok 1 test 1
4
+ ok 2 test 2
5
+ ok 3 test 3
6
+ ok 4 test 4
Original file line number Diff line number Diff line change @@ -20,23 +20,31 @@ module.exports = function () {
20
20
}
21
21
}
22
22
23
+ function ensureTest ( name ) {
24
+ if ( name || ! test ) {
25
+ test = {
26
+ name : name || 'unnamed test' ,
27
+ pass : 0 ,
28
+ fail : 0 ,
29
+ start : new Date ( ) ,
30
+ }
31
+ dup . emit ( 'test.start' , test )
32
+ }
33
+ }
34
+
23
35
tap . on ( 'test' , function ( res ) {
24
36
handleTestEnd ( )
25
- test = {
26
- name : res . name ,
27
- pass : 0 ,
28
- fail : 0 ,
29
- start : new Date ( ) ,
30
- }
31
- dup . emit ( 'test.start' , test )
37
+ ensureTest ( res . name )
32
38
} )
33
39
34
40
tap . on ( 'pass' , function ( ) {
41
+ ensureTest ( )
35
42
++ test . pass
36
43
dup . emit ( 'test.pass' , test )
37
44
} )
38
45
39
46
tap . on ( 'fail' , function ( ) {
47
+ ensureTest ( )
40
48
++ test . fail
41
49
dup . emit ( 'test.fail' , test )
42
50
} )
You can’t perform that action at this time.
0 commit comments