From fa504a1fa8817adfe23b5e5583fa342fb73f66f9 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 14 Mar 2022 09:55:18 -0500 Subject: [PATCH] chore: cleanup e-test --- src/e-auto-update.js | 4 +--- src/e-test.js | 44 ++++++++++++++++++++++---------------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/e-auto-update.js b/src/e-auto-update.js index e1725ae8..806b33c7 100644 --- a/src/e-auto-update.js +++ b/src/e-auto-update.js @@ -11,9 +11,7 @@ const markerFilePath = path.join(__dirname, '..', '.disable-auto-updates'); program .description('Check for build-tools updates or enable/disable automatic updates') - .action(() => { - checkForUpdates(); - }); + .action(checkForUpdates); program .command('enable') diff --git a/src/e-test.js b/src/e-test.js index c79918e1..e89499be 100644 --- a/src/e-test.js +++ b/src/e-test.js @@ -34,7 +34,7 @@ function runSpecRunner(config, script, runnerArgs) { } program - .arguments('[specRunnerArgs...]') + .argument('[specRunnerArgs...]') .allowUnknownOption() .option('--node', 'Run node spec runner', false) .option('--nan', 'Run nan spec runner', false) @@ -42,25 +42,25 @@ program '--runners=', "A subset of tests to run - either 'main', 'remote', or 'native', not used with either the node or nan specs", ) + .action((specRunnerArgs, options) => { + try { + const config = evmConfig.current(); + if (options.node && options.nan) { + fatal( + 'Can not run both node and nan specs at the same time, --node and --nan are mutually exclusive', + ); + } + let script = './script/spec-runner.js'; + if (options.node) { + script = './script/node-spec-runner.js'; + } + if (options.nan) { + script = './script/nan-spec-runner.js'; + } + ensureNodeHeaders(config); + runSpecRunner(config, script, specRunnerArgs); + } catch (e) { + fatal(e); + } + }) .parse(process.argv); - -try { - const runnerArgs = program.parseOptions(process.argv).unknown; - const config = evmConfig.current(); - if (program.node && program.nan) { - fatal( - 'Can not run both node and nan specs at the same time, --node and --nan are mutually exclusive', - ); - } - let script = './script/spec-runner.js'; - if (program.node) { - script = './script/node-spec-runner.js'; - } - if (program.nan) { - script = './script/nan-spec-runner.js'; - } - ensureNodeHeaders(config); - runSpecRunner(config, script, runnerArgs); -} catch (e) { - fatal(e); -}