From dbac72ea7d337b26e9120cace64c64e096337065 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Tue, 18 Sep 2018 15:05:52 -0500 Subject: [PATCH 1/4] --coverage option only support "vm" node --- cmd/cmd.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/cmd.js b/cmd/cmd.js index e30ce34a..52a14e93 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -272,7 +272,7 @@ class Cmd { ' embark - ' + __('Uses the node associated with an already running embark process') + '\n' + ' ' + __(' - Connects to a running node available at the end point and uses it to run the tests')) .option('-d , --gasDetails', __('When set, will print the gas cost for each contract deployment')) - .option('-c , --coverage', __('When set, will generate the coverage after the tests')) + .option('-c , --coverage', __('generate a coverage report after running the tests (vm only)')) .option('--locale [locale]', __('language to use (default: en)')) .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'warn') .description(__('run tests')) @@ -285,6 +285,11 @@ class Cmd { process.exit(1); } options.node = node; + if (options.coverage && options.node !== 'vm') { + console.error(`invalid --node option: coverage supports "vm" only\n`.red); + options.outputHelp(); + process.exit(1); + } checkDeps(); i18n.setOrDetectLocale(options.locale); embark.runTests({file, loglevel: options.loglevel, gasDetails: options.gasDetails, From b2c7ef37b7aa20acfd0a8fc8489ea1dfe7452e02 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Tue, 18 Sep 2018 15:01:32 -0500 Subject: [PATCH 2/4] rev --node help output --- cmd/cmd.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/cmd.js b/cmd/cmd.js index 52a14e93..b35f538e 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -267,11 +267,11 @@ class Cmd { test() { program .command('test [file]') - .option('-n , --node ', __('Node to connect to. Valid values are ["vm", "embark", ""]: \n') + - ' vm - ' + __('Starts an Ethereum simulator (ganache) and runs the tests using the simulator') + '\n' + - ' embark - ' + __('Uses the node associated with an already running embark process') + '\n' + - ' ' + __(' - Connects to a running node available at the end point and uses it to run the tests')) .option('-d , --gasDetails', __('When set, will print the gas cost for each contract deployment')) + .option('-n , --node ', __('node for running the tests ["vm", "embark", ] (default: vm)\n') + + ' vm - ' + __('start and use an Ethereum simulator (ganache)') + '\n' + + ' embark - ' + __('use the node of a running embark process') + '\n' + + ' - ' + __('connect to and use the specified node')) .option('-c , --coverage', __('generate a coverage report after running the tests (vm only)')) .option('--locale [locale]', __('language to use (default: en)')) .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'warn') From fc68e9be3ccb8632d4c2f54e9300dab2d61c6693 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Tue, 18 Sep 2018 15:01:48 -0500 Subject: [PATCH 3/4] rev --gasDetails help output --- cmd/cmd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/cmd.js b/cmd/cmd.js index b35f538e..ea1a42b7 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -267,11 +267,11 @@ class Cmd { test() { program .command('test [file]') - .option('-d , --gasDetails', __('When set, will print the gas cost for each contract deployment')) .option('-n , --node ', __('node for running the tests ["vm", "embark", ] (default: vm)\n') + ' vm - ' + __('start and use an Ethereum simulator (ganache)') + '\n' + ' embark - ' + __('use the node of a running embark process') + '\n' + ' - ' + __('connect to and use the specified node')) + .option('-d , --gasDetails', __('print the gas cost for each contract deployment when running the tests')) .option('-c , --coverage', __('generate a coverage report after running the tests (vm only)')) .option('--locale [locale]', __('language to use (default: en)')) .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'warn') From a6231851b033015dc03cadcaa2347c4200b3c200 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Tue, 18 Sep 2018 15:06:27 -0500 Subject: [PATCH 4/4] consistent quotes --- cmd/cmd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/cmd.js b/cmd/cmd.js index ea1a42b7..aaea0c11 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -280,7 +280,7 @@ class Cmd { const node = options.node || 'vm'; const urlRegexExp = /^(vm|embark|((ws|https?):\/\/([a-zA-Z0-9_.-]*):?([0-9]*)?))$/i; if (!urlRegexExp.test(node)) { - console.error(`invalid --node option: must be 'vm', 'embark' or a valid URL\n`.red); + console.error(`invalid --node option: must be "vm", "embark" or a valid URL\n`.red); options.outputHelp(); process.exit(1); }