@@ -10,12 +10,18 @@ chai.should();
1010describe ( 'lcovResultMerger' , function ( ) {
1111 it ( 'should combine the given records into one' , async function ( ) {
1212 const expected = fs . readFileSync ( './test/expected/basic/lcov.info' , 'utf8' ) ;
13+ let tmpFilePath = '' ;
14+
1315 await new Promise ( ( res ) => {
1416 fg . stream ( './test/fixtures/basic/*/lcov.info' )
1517 . pipe ( lcovResultMerger ( ) )
18+ . on ( 'data' , ( tmpFile ) => {
19+ tmpFilePath = tmpFile ;
20+ } )
1621 . on ( 'end' , res ) ;
1722 } ) ;
18- const actual = fs . readFileSync ( 'lcov.info' , 'utf8' ) ;
23+
24+ const actual = fs . readFileSync ( tmpFilePath , 'utf8' ) ;
1925 return actual . should . equal ( expected ) ;
2026 } ) ;
2127
@@ -38,12 +44,17 @@ describe('lcovResultMerger', function () {
3844 './test/expected/windows/lcov.info' ,
3945 'utf8'
4046 ) ;
47+ let tmpFilePath = '' ;
48+
4149 await new Promise ( ( res ) => {
4250 fg . stream ( './test/fixtures/windows/lcov.info' )
4351 . pipe ( lcovResultMerger ( ) )
52+ . on ( 'data' , ( tmpFile ) => {
53+ tmpFilePath = tmpFile ;
54+ } )
4455 . on ( 'end' , res ) ;
4556 } ) ;
46- const actual = fs . readFileSync ( 'lcov.info' , 'utf8' ) ;
57+ const actual = fs . readFileSync ( tmpFilePath , 'utf8' ) ;
4758 return actual . should . equal ( expected ) ;
4859 } ) ;
4960
@@ -52,6 +63,9 @@ describe('lcovResultMerger', function () {
5263 './test/expected/prepended/lcov.info' ,
5364 'utf8'
5465 ) ;
66+
67+ let tmpFilePath = '' ;
68+
5569 await new Promise ( ( res ) => {
5670 fg . stream ( './test/fixtures/basic/*/lcov.info' )
5771 . pipe (
@@ -60,9 +74,12 @@ describe('lcovResultMerger', function () {
6074 'prepend-path-fix' : '' ,
6175 } )
6276 )
77+ . on ( 'data' , ( tmpFile ) => {
78+ tmpFilePath = tmpFile ;
79+ } )
6380 . on ( 'end' , res ) ;
6481 } ) ;
65- const actual = fs . readFileSync ( 'lcov.info' , 'utf8' ) ;
82+ const actual = fs . readFileSync ( tmpFilePath , 'utf8' ) ;
6683 return actual . should . equal ( expected ) ;
6784 } ) ;
6885
@@ -71,12 +88,18 @@ describe('lcovResultMerger', function () {
7188 './test/expected/prepended-path-fix/lcov.info' ,
7289 'utf8'
7390 ) ;
91+
92+ let tmpFilePath = '' ;
93+
7494 await new Promise ( ( res ) => {
7595 fg . stream ( './test/fixtures/coverage-subfolder/*/coverage/lcov.info' )
7696 . pipe ( lcovResultMerger ( { 'prepend-source-files' : true } ) )
97+ . on ( 'data' , ( tmpFile ) => {
98+ tmpFilePath = tmpFile ;
99+ } )
77100 . on ( 'end' , res ) ;
78101 } ) ;
79- const actual = fs . readFileSync ( 'lcov.info' , 'utf8' ) ;
102+ const actual = fs . readFileSync ( tmpFilePath , 'utf8' ) ;
80103 return actual . should . equal ( expected ) ;
81104 } ) ;
82105} ) ;
0 commit comments