Skip to content

Commit 8934c37

Browse files
committed
fix: when generating nyc report, pass temp folder
1 parent 40a602d commit 8934c37

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

task.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ const { fixSourcePathes } = require('./utils')
88
const debug = require('debug')('code-coverage')
99

1010
// these are standard folder and file names used by NYC tools
11+
const processWorkingDirectory = process.cwd()
1112
const outputFolder = '.nyc_output'
12-
const coverageFolder = join(process.cwd(), outputFolder)
13+
const coverageFolder = join(processWorkingDirectory, outputFolder)
1314
const nycFilename = join(coverageFolder, 'out.json')
1415

1516
// there might be custom "nyc" options in the user package.json
1617
// see https://github.com/istanbuljs/nyc#configuring-nyc
1718
// potentially there might be "nyc" options in other configuration files
1819
// it allows, but for now ignore those options
19-
const pkgFilename = join(process.cwd(), 'package.json')
20+
const pkgFilename = join(processWorkingDirectory, 'package.json')
2021
const pkg = fs.existsSync(pkgFilename)
2122
? JSON.parse(fs.readFileSync(pkgFilename, 'utf8'))
2223
: {}
@@ -93,7 +94,13 @@ module.exports = {
9394

9495
// should we generate report via NYC module API?
9596
const command = 'nyc'
96-
const args = ['report', '--report-dir', reportDir].concat(reporters)
97+
const args = [
98+
'report',
99+
'--report-dir',
100+
reportDir,
101+
'--temp-dir',
102+
processWorkingDirectory
103+
].concat(reporters)
97104
debug(
98105
'saving coverage report using command: "%s %s"',
99106
command,

0 commit comments

Comments
 (0)