@@ -9,11 +9,14 @@ const clone = require('clone')
99const pathLib = require ( 'path' )
1010const url = require ( 'url' )
1111
12- const storagePath = './.nyc_output/js'
1312let iterator = { }
1413
1514class OutputFiles {
16- constructor ( coverageInfo ) {
15+ constructor ( coverageInfo , options ) {
16+ options = options || { }
17+ options . storagePath = options . storagePath || './.nyc_output'
18+ this . storagePath = `${ options . storagePath } /js`
19+
1720 // Clone coverageInfo to prevent mutating the passed in data
1821 this . coverageInfo = clone ( coverageInfo )
1922 this . _parseAndIsolate ( )
@@ -53,11 +56,11 @@ class OutputFiles {
5356 // Special case: when html present, strip and return specialized string
5457 if ( pathLib . extname ( parsedPath ) === '.html' ) {
5558 isInline = true
56- parsedPath = pathLib . resolve ( storagePath , parsedPath + 'puppeteerTemp-inline' )
59+ parsedPath = pathLib . resolve ( this . storagePath , parsedPath + 'puppeteerTemp-inline' )
5760 } else {
58- parsedPath = pathLib . resolve ( storagePath , pathLib . dirname ( parsedPath ) , pathLib . basename ( parsedPath , '.js' ) )
61+ parsedPath = pathLib . resolve ( this . storagePath , pathLib . dirname ( parsedPath ) , pathLib . basename ( parsedPath , '.js' ) )
5962 }
60- mkdirp . sync ( storagePath )
63+ mkdirp . sync ( this . storagePath )
6164 if ( fs . existsSync ( parsedPath + '.js' ) && isInline ) {
6265 if ( ! Number . isInteger ( iterator [ parsedPath ] ) ) {
6366 iterator [ parsedPath ] = 1
@@ -90,8 +93,8 @@ class OutputFiles {
9093 }
9194}
9295
93- function genOutputFiles ( coverageInfo ) {
94- return new OutputFiles ( coverageInfo )
96+ function genOutputFiles ( coverageInfo , options ) {
97+ return new OutputFiles ( coverageInfo , options )
9598}
9699
97100genOutputFiles . resetIterator = function ( ) {
0 commit comments