Skip to content

Commit

Permalink
chore: Fix merge error (#1193)
Browse files Browse the repository at this point in the history
nyc.addAllFiles needs to be called after the `!argv.useSpawnWrap` branch
performs the `require`'s and we need to await it.
  • Loading branch information
coreyfarrell committed Oct 7, 2019
1 parent df4de4d commit 96b60b8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bin/nyc.js
Expand Up @@ -38,10 +38,6 @@ async function main () {
await nyc.createTempDirectory()
}

if (argv.all) {
await nyc.addAllFiles()
}

const env = {
NYC_CONFIG: JSON.stringify(argv),
NYC_CWD: process.cwd()
Expand All @@ -65,7 +61,9 @@ async function main () {
Object.assign(propagateEnv, env)
}

if (argv.all) nyc.addAllFiles()
if (argv.all) {
await nyc.addAllFiles()
}

if (argv.useSpawnWrap) {
const wrapper = require.resolve('./wrap.js')
Expand Down Expand Up @@ -103,4 +101,8 @@ async function main () {
})
}

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

0 comments on commit 96b60b8

Please sign in to comment.