diff --git a/lib/cli/run-helpers.js b/lib/cli/run-helpers.js index 6c76851b22..c46e0d16fe 100644 --- a/lib/cli/run-helpers.js +++ b/lib/cli/run-helpers.js @@ -195,17 +195,17 @@ const parallelRun = async (mocha, options, fileCollectParams) => { * @returns {Promise} */ exports.runMocha = async (mocha, options) => { - let { + const { watch = false, extension = [], ignore = [], file = [], - parallel = false, recursive = false, sort = false, spec = [], parallelForce = false } = options; + let {parallel} = options; const fileCollectParams = { ignore, @@ -223,6 +223,7 @@ exports.runMocha = async (mocha, options) => { parallel = false; } } + let run; if (watch) { run = parallel ? watchParallelRun : watchRun; diff --git a/lib/mocha.js b/lib/mocha.js index 350df62dbc..4bd9a874b7 100644 --- a/lib/mocha.js +++ b/lib/mocha.js @@ -123,6 +123,7 @@ exports.Test = require('./test'); * @param {number|string} [options.timeout] - Timeout threshold value. * @param {string} [options.ui] - Interface name. * @param {boolean} [options.parallel] - Run jobs in parallel + * @param {boolean} [options.parallelForce] - Run jobs in parallel * @param {number} [options.jobs] - Max number of worker processes for parallel runs * @param {MochaRootHookObject} [options.rootHooks] - Hooks to bootstrap the root * suite with diff --git a/test/integration/options/jobs.spec.js b/test/integration/options/jobs.spec.js index 832d825298..b2b7ef8672 100644 --- a/test/integration/options/jobs.spec.js +++ b/test/integration/options/jobs.spec.js @@ -23,7 +23,7 @@ describe('--jobs', function() { return expect( runMochaAsync( 'options/jobs/fail-in-parallel', - ['--parallel', '--jobs', '2'], + ['--parallel', '--parallelForce', '--jobs', '2'], 'pipe' ), 'when fulfilled', diff --git a/test/integration/options/parallel.spec.js b/test/integration/options/parallel.spec.js index 8fc5389943..44d18b68e5 100644 --- a/test/integration/options/parallel.spec.js +++ b/test/integration/options/parallel.spec.js @@ -43,7 +43,10 @@ describe('--parallel', function() { describe('when there is only a single test file', function() { it('should fail gracefully', function() { return expect( - runMochaAsync('options/parallel/syntax-err', ['--parallel']), + runMochaAsync('options/parallel/syntax-err', [ + '--parallelForce', + '--parallel' + ]), 'when fulfilled', 'to have failed with output', /SyntaxError/ @@ -146,6 +149,7 @@ describe('--parallel', function() { [ require.resolve('../fixtures/options/parallel/uncaught.fixture.js'), '--parallel', + '--parallelForce', '--allow-uncaught' ], 'pipe'