nyc 17.0.0 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nyc.js +21 -5
- package/lib/commands/merge.js +1 -1
- package/package.json +2 -2
package/bin/nyc.js
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
const configUtil = require('../lib/config-util')
|
|
5
5
|
const { cliWrapper, suppressEPIPE } = require('../lib/commands/helpers')
|
|
6
|
-
const
|
|
6
|
+
const { foregroundChild } = require('foreground-child')
|
|
7
7
|
const resolveFrom = require('resolve-from')
|
|
8
8
|
const NYC = require('../index.js')
|
|
9
|
+
const path = require('path')
|
|
10
|
+
const fs = require('fs')
|
|
9
11
|
|
|
10
12
|
// parse configuration and command-line arguments;
|
|
11
13
|
// we keep these values in a few different forms,
|
|
@@ -86,10 +88,22 @@ async function main () {
|
|
|
86
88
|
// set process.exitCode. Keep track so that both children are run, but
|
|
87
89
|
// a non-zero exit codes in either one leads to an overall non-zero exit code.
|
|
88
90
|
process.exitCode = 0
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
foregroundChild(childArgs, async (code, signal, processInfo) => {
|
|
92
|
+
let exitCode = process.exitCode || code
|
|
91
93
|
|
|
92
94
|
try {
|
|
95
|
+
// clean up foreground-child watchdog process info
|
|
96
|
+
const parentDir = path.resolve(nyc.tempDirectory())
|
|
97
|
+
const dir = path.resolve(nyc.tempDirectory(), 'processinfo')
|
|
98
|
+
const files = await nyc.coverageFiles(dir)
|
|
99
|
+
for (let i = 0; i < files.length; i++) {
|
|
100
|
+
const data = await nyc.coverageFileLoad(files[i], dir)
|
|
101
|
+
if (data.pid === processInfo.watchdogPid) {
|
|
102
|
+
fs.unlinkSync(path.resolve(parentDir, files[i]))
|
|
103
|
+
fs.unlinkSync(path.resolve(dir, files[i]))
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
93
107
|
await nyc.writeProcessIndex()
|
|
94
108
|
|
|
95
109
|
nyc.maybePurgeSourceMapCache()
|
|
@@ -100,7 +114,7 @@ async function main () {
|
|
|
100
114
|
branches: argv.branches,
|
|
101
115
|
statements: argv.statements
|
|
102
116
|
}, argv['per-file']).catch(suppressEPIPE)
|
|
103
|
-
|
|
117
|
+
exitCode = process.exitCode || exitCode
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
if (!argv.silent) {
|
|
@@ -108,10 +122,12 @@ async function main () {
|
|
|
108
122
|
}
|
|
109
123
|
} catch (error) {
|
|
110
124
|
/* istanbul ignore next */
|
|
111
|
-
|
|
125
|
+
exitCode = process.exitCode || exitCode || 1
|
|
112
126
|
/* istanbul ignore next */
|
|
113
127
|
console.error(error.message)
|
|
114
128
|
}
|
|
129
|
+
|
|
130
|
+
return exitCode
|
|
115
131
|
})
|
|
116
132
|
}
|
|
117
133
|
|
package/lib/commands/merge.js
CHANGED
|
@@ -41,6 +41,6 @@ exports.handler = cliWrapper(async argv => {
|
|
|
41
41
|
}
|
|
42
42
|
await makeDir(path.dirname(argv.outputFile))
|
|
43
43
|
const map = await nyc.getCoverageMapFromAllCoverageFiles(argv.inputDirectory)
|
|
44
|
-
await fs.writeFile(argv.outputFile, JSON.stringify(map
|
|
44
|
+
await fs.writeFile(argv.outputFile, JSON.stringify(map), 'utf8')
|
|
45
45
|
console.info(`coverage files in ${argv.inputDirectory} merged into ${argv.outputFile}`)
|
|
46
46
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nyc",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.1.0",
|
|
4
4
|
"description": "the Istanbul command line interface",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"decamelize": "^1.2.0",
|
|
65
65
|
"find-cache-dir": "^3.2.0",
|
|
66
66
|
"find-up": "^4.1.0",
|
|
67
|
-
"foreground-child": "^
|
|
67
|
+
"foreground-child": "^3.3.0",
|
|
68
68
|
"get-package-type": "^0.1.0",
|
|
69
69
|
"glob": "^7.1.6",
|
|
70
70
|
"istanbul-lib-coverage": "^3.0.0",
|