Skip to content

Commit 96b60b8

Browse files
authored
chore: Fix merge error (#1193)
nyc.addAllFiles needs to be called after the `!argv.useSpawnWrap` branch performs the `require`'s and we need to await it.
1 parent df4de4d commit 96b60b8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

bin/nyc.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ async function main () {
3838
await nyc.createTempDirectory()
3939
}
4040

41-
if (argv.all) {
42-
await nyc.addAllFiles()
43-
}
44-
4541
const env = {
4642
NYC_CONFIG: JSON.stringify(argv),
4743
NYC_CWD: process.cwd()
@@ -65,7 +61,9 @@ async function main () {
6561
Object.assign(propagateEnv, env)
6662
}
6763

68-
if (argv.all) nyc.addAllFiles()
64+
if (argv.all) {
65+
await nyc.addAllFiles()
66+
}
6967

7068
if (argv.useSpawnWrap) {
7169
const wrapper = require.resolve('./wrap.js')
@@ -103,4 +101,8 @@ async function main () {
103101
})
104102
}
105103

106-
main()
104+
/* istanbul ignore next: the error branch should be unreachable */
105+
main().catch(error => {
106+
console.log('nyc error:', error)
107+
process.exit(1)
108+
})

0 commit comments

Comments
 (0)