diff --git a/cmd/cmd.js b/cmd/cmd.js index 1e1cb9a97..f83940d3f 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -264,12 +264,21 @@ class Cmd { test() { program .command('test [file]') - .option('-n , --node [node]', __('Node to connect to (default: vm)')) + .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'), + /^(vm|embark|((ws|https?):\/\/([a-zA-Z0-9_.-]*):?([0-9]*)?))$/i, null) .option('-d , --gasDetails', __('When set, will print the gas cost for each contract deploy')) .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')) .action(function(file, options) { + if(options.node === null){ + console.log(__('Invalid value for option --node. Valid values are ["vm", "embark", ""]".').red); + console.log(options.optionHelp()); + process.exit(1); + } checkDeps(); i18n.setOrDetectLocale(options.locale); embark.runTests({file, loglevel: options.loglevel, gasDetails: options.gasDetails, node: options.node}); diff --git a/lib/tests/test.js b/lib/tests/test.js index 9345f8f7b..0c7c636d1 100644 --- a/lib/tests/test.js +++ b/lib/tests/test.js @@ -58,7 +58,7 @@ class Test { }); } - if (this.simOptions.host || this.options.node) { + if (this.simOptions.host || (this.options.node && this.options.node !== 'vm')) { let options = this.simOptions; if (this.options.node) { options = utils.deconstructUrl(this.options.node);