@@ -9,15 +9,16 @@ function typof (val) {
99 return Object . prototype . toString . call ( val ) . slice ( 8 , - 1 ) . toLowerCase ( ) ;
1010}
1111
12- describe ( 'use with require' , function ( ) {
12+ describe ( 'use with require #1 ' , function ( ) {
1313
1414 let result ;
15+ const outputPath = path . resolve ( __dirname , 'report/o#1.data' ) ;
1516
1617 beforeEach ( function ( done ) {
1718 if ( ! result ) {
1819 tree ( {
1920 ignore : [ 'package.json' , / n o d e _ m o d u l e s \/ b f o l d e r \/ n o d e _ m o d u l e s / ] ,
20- o : path . resolve ( __dirname , 'o.data' ) ,
21+ o : outputPath ,
2122 l : 3 ,
2223 f : true ,
2324 base : testBase ,
@@ -47,7 +48,40 @@ describe('use with require', function () {
4748 } ) ;
4849
4950 it ( 'should generate report' , function ( ) {
50- const generatedReport = fs . readFileSync ( path . resolve ( __dirname , 'o.data' ) ) ;
51+ const generatedReport = fs . readFileSync ( outputPath ) ;
5152 expect ( generatedReport . toString ( ) ) . to . equal ( result . report ) ;
52- } )
53+ } ) ;
54+ } ) ;
55+
56+ describe ( 'use with require #2' , function ( ) {
57+
58+ let result ;
59+ const outputPath = path . resolve ( __dirname , 'report/o#2.data' ) ;
60+
61+ beforeEach ( function ( done ) {
62+ if ( ! result ) {
63+ tree ( {
64+ ignore : [ 'package.json' , / n o d e _ m o d u l e s \/ b f o l d e r \/ n o d e _ m o d u l e s / , 'b.data' , 't.txt' ] ,
65+ o : outputPath ,
66+ l : 3 ,
67+ f : true ,
68+ base : testBase ,
69+ noreport : true ,
70+ directoryFirst : true ,
71+ } ) . then ( ( res ) => {
72+ result = res ;
73+ done ( ) ;
74+ } ) ;
75+ }
76+ else {
77+ done ( ) ;
78+ }
79+ } ) ;
80+
81+ it ( 'should output corret report with ignores' , function ( ) {
82+ const generatedReport = fs . readFileSync ( outputPath ) ;
83+ const report = result . report ;
84+ expect ( generatedReport . toString ( ) ) . to . equal ( report ) ;
85+ expect ( report ) . to . match ( / └ ─ ─ a \. t s / )
86+ } ) ;
5387} ) ;
0 commit comments