File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ var falafel = require ( 'falafel' ) ;
2+ var tape = require ( '../' ) ;
3+ var tap = require ( 'tap' ) ;
4+
5+ tap . test ( 'throw test' , function ( tt ) {
6+ tt . plan ( 1 ) ;
7+
8+ var test = tape . createHarness ( ) ;
9+ var tc = tap . createConsumer ( ) ;
10+
11+ var rows = [ ] ;
12+ tc . on ( 'data' , function ( r ) { rows . push ( r ) } ) ;
13+ tc . on ( 'end' , function ( ) {
14+ var rs = rows . map ( function ( r ) {
15+ if ( r && typeof r === 'object' ) {
16+ return { id : r . id , ok : r . ok , name : r . name . trim ( ) } ;
17+ }
18+ else return r ;
19+ } ) ;
20+ tt . same ( rs , [
21+ 'TAP version 13' ,
22+ 'thrower' ,
23+ { id : 1 , ok : true , name : 'should be equivalent' } ,
24+ { id : 2 , ok : false , name : 'Error: rawr' } ,
25+ 'tests 2' ,
26+ 'pass 1' ,
27+ 'fail 1' ,
28+ ] ) ;
29+ } ) ;
30+
31+ test . stream . pipe ( tc ) ;
32+
33+ test ( 'thrower' , function ( t ) {
34+ t . equal ( 1 + 1 , 2 ) ;
35+
36+ throw new Error ( 'rawr' ) ;
37+ } ) ;
38+ } ) ;
You can’t perform that action at this time.
0 commit comments