From 96b60b876b5e2f4ac13165f8672bc7da03f7b48a Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Sun, 6 Oct 2019 21:55:47 -0400 Subject: [PATCH] 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. --- bin/nyc.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/nyc.js b/bin/nyc.js index da9f45631..3760dbc7d 100755 --- a/bin/nyc.js +++ b/bin/nyc.js @@ -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() @@ -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') @@ -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) +})