From 850206d0fbe959db7c6343123b8a0d6ff6cdd5c6 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 5 Feb 2020 09:16:52 +0100 Subject: [PATCH] support --browser flag --- test/browser/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/browser/index.js b/test/browser/index.js index 9c85e985af5..ef3ab565154 100644 --- a/test/browser/index.js +++ b/test/browser/index.js @@ -19,6 +19,7 @@ const optimist = require('optimist') .describe('grep', 'only run tests matching ').alias('grep', 'g').alias('grep', 'f').string('grep') .describe('run', 'only run tests matching ').alias('run', 'glob').string('runGlob') .describe('build', 'run with build output (out-build)').boolean('build') + .describe('browser', 'browsers in which tests should run').string('browser').default('browser', ['chromium']) .describe('reporter', 'the mocha reporter').string('reporter').default('reporter', defaultReporterName) .describe('reporter-options', 'the mocha reporter options').string('reporter-options').default('reporter-options', '') .describe('tfs', 'tfs').string('tfs') @@ -27,7 +28,6 @@ const optimist = require('optimist') // logic const argv = optimist.argv; - const Reporter = (function () { const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', argv.reporter); let Reporter; @@ -161,11 +161,11 @@ class EchoRunner extends events.EventEmitter { } testModules.then(async modules => { - await Promise.all([ - runTestsInBrowser(modules, 'chromium'), - runTestsInBrowser(modules, 'webkit'), - // runTestsInBrowser(modules, 'firefox'), - ]); + + const browserTypes = Array.isArray(argv.browser) ? argv.browser : [argv.browser]; + const promises = browserTypes.map(browserType => runTestsInBrowser(modules, browserType)); + await Promise.all(promises); + }).catch(err => { console.error(err); });