From c0a2b380419077285366d9c2bf5518713ab8087f Mon Sep 17 00:00:00 2001 From: Cryptomental Date: Mon, 1 Oct 2018 20:04:29 +0200 Subject: [PATCH] cmd, run_tests: Add --nobrowser option for runCoverage. Do not start browser during coverage run when --nobrowser option is passed. Refs: https://github.com/embark-framework/embark/issues/941 --- cmd/cmd.js | 3 ++- lib/tests/run_tests.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/cmd.js b/cmd/cmd.js index ff04da366..c05221922 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -273,6 +273,7 @@ class Cmd { ' - ' + __('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('--nobrowser', __('do not start browser after coverage report is generated')) .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')) @@ -293,7 +294,7 @@ class Cmd { checkDeps(); i18n.setOrDetectLocale(options.locale); embark.runTests({file, loglevel: options.loglevel, gasDetails: options.gasDetails, - node: options.node, coverage: options.coverage}); + node: options.node, coverage: options.coverage, noBrowser: options.nobrowser}); }); } diff --git a/lib/tests/run_tests.js b/lib/tests/run_tests.js index ee1f16e6f..b0c3f82be 100644 --- a/lib/tests/run_tests.js +++ b/lib/tests/run_tests.js @@ -140,6 +140,9 @@ module.exports = { console.log(`Coverage report created. You can find it here: ${fs.dappPath('coverage/__root__/index.html')}\n`); const opn = require('opn'); const _next = () => { next(); }; + if (options.noBrowser) { + return next(); + } opn(fs.dappPath('coverage/__root__/index.html'), {wait: false}) .then(() => new Promise(resolve => setTimeout(resolve, 1000))) .then(_next, _next);