Skip to content

Commit 921d386

Browse files
authored
fix: Create directory for merge destination. (#979)
Fixes #976
1 parent df2730d commit 921d386

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/commands/merge.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22
const fs = require('fs')
3+
const path = require('path')
4+
const makeDir = require('make-dir')
35

46
var NYC
57
try {
@@ -49,6 +51,7 @@ exports.handler = function (argv) {
4951
console.error(`failed access input directory ${argv.inputDirectory} with error:\n\n${err.message}`)
5052
process.exit(1)
5153
}
54+
makeDir.sync(path.dirname(argv.outputFile))
5255
const map = nyc.getCoverageMapFromAllCoverageFiles(argv.inputDirectory)
5356
fs.writeFileSync(argv.outputFile, JSON.stringify(map, null, 2), 'utf8')
5457
console.info(`coverage files in ${argv.inputDirectory} merged into ${argv.outputFile}`)

0 commit comments

Comments
 (0)