@@ -2,6 +2,7 @@ const istanbul = require('istanbul-lib-coverage')
2
2
const { join } = require ( 'path' )
3
3
const { existsSync, mkdirSync, readFileSync, writeFileSync } = require ( 'fs' )
4
4
const execa = require ( 'execa' )
5
+ const debug = require ( 'debug' ) ( 'cypress-istanbul' )
5
6
6
7
// these are standard folder and file names used by NYC tools
7
8
const outputFolder = '.nyc_output'
@@ -11,7 +12,7 @@ const nycFilename = join(coverageFolder, 'out.json')
11
12
function saveCoverage ( coverage ) {
12
13
if ( ! existsSync ( coverageFolder ) ) {
13
14
mkdirSync ( coverageFolder )
14
- console . log ( 'created folder %s for output coverage' , coverageFolder )
15
+ debug ( 'created folder %s for output coverage' , coverageFolder )
15
16
}
16
17
17
18
writeFileSync ( nycFilename , JSON . stringify ( coverage , null , 2 ) )
@@ -29,7 +30,7 @@ module.exports = {
29
30
*/
30
31
resetCoverage ( { isInteractive } ) {
31
32
if ( isInteractive ) {
32
- console . log ( 'reset code coverage in interactive mode' )
33
+ debug ( 'reset code coverage in interactive mode' )
33
34
const coverageMap = istanbul . createCoverageMap ( { } )
34
35
saveCoverage ( coverageMap )
35
36
}
@@ -54,7 +55,7 @@ module.exports = {
54
55
const coverageMap = istanbul . createCoverageMap ( previous )
55
56
coverageMap . merge ( coverage )
56
57
saveCoverage ( coverageMap )
57
- console . log ( 'wrote coverage file %s' , nycFilename )
58
+ debug ( 'wrote coverage file %s' , nycFilename )
58
59
59
60
return null
60
61
} ,
@@ -69,8 +70,10 @@ module.exports = {
69
70
console . warn ( 'Skipping coverage report' )
70
71
return null
71
72
}
72
- console . log ( 'saving coverage report' )
73
+ const command = 'nyc'
74
+ const args = [ 'report' , '--reporter=html' ]
75
+ debug ( 'saving coverage report using command: %s %s' , command , args )
73
76
// should we generate report via NYC module API?
74
- return execa ( 'nyc' , [ 'report' , '--reporter=html' ] , { stdio : 'inherit' } )
77
+ return execa ( command , args , { stdio : 'inherit' } )
75
78
}
76
79
}
0 commit comments