Skip to content

Commit 23f85bd

Browse files
committed
fixed an issue where settings.testWorkersEnabled was true when single test file was being run
1 parent 34322ca commit 23f85bd

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

lib/settings/settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const lodashMerge = require('lodash.merge');
66
const CI_Info = require('ci-info');
77
const Defaults = require('./defaults.js');
88
const Utils = require('../utils');
9-
const {isObject, isUndefined, isDefined, isNumber} = Utils;
9+
const {isObject, isUndefined, isDefined, isNumber, singleSourceFile} = Utils;
1010

1111
class Settings {
1212

@@ -330,7 +330,7 @@ class Settings {
330330
this.settings.test_workers.workers = this.argv.workers || this.settings.test_workers.workers;
331331
}
332332

333-
this.settings.testWorkersEnabled = this.testWorkersEnabled;
333+
this.settings.testWorkersEnabled = this.testWorkersEnabled && !singleSourceFile(this.argv);
334334

335335
return this;
336336
}

test/src/runner/cli/testCliRunnerParallel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('Test CLI Runner in Parallel', function () {
8383
assert.strictEqual(runner.isTestWorkersEnabled(), false);
8484
});
8585

86-
it('mobile config setup on with worker threads - disabled parallelsim ', function() {
86+
it('mobile config setup on with worker threads - disabled parallelism ', function() {
8787
class RunnerBaseMock extends RunnerBase {
8888
static readTestSource(settings, argv) {
8989
assert.strictEqual(settings.testWorkersEnabled, true);
@@ -120,7 +120,7 @@ describe('Test CLI Runner in Parallel', function () {
120120
assert.strictEqual(runner.parallelMode(), false);
121121
});
122122

123-
it('mobile config setup on with multiple envs - enable parallelsim ', function() {
123+
it('mobile config setup on with multiple envs - enable parallelism ', function() {
124124
class RunnerBaseMock extends RunnerBase {
125125
static readTestSource(settings, argv) {
126126
assert.strictEqual(settings.testWorkersEnabled, true);

test/src/runner/testRunTestsuite.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,24 @@ describe('testRunTestSuite', function () {
260260
skip_testcases_on_fail: true
261261
}));
262262
});
263+
264+
it('testRunner with parallel mode and single test source', function () {
265+
let testsPath = path.join(__dirname, '../../sampletests/withdescribe/failures/sampleSkipTestcases.js');
266+
let globals = {
267+
calls: 0,
268+
retryAssertionTimeout: 0,
269+
reporter(results, cb) {
270+
assert.strictEqual(this.settings.testWorkersEnabled, false);
271+
cb();
272+
}
273+
};
274+
275+
return runTests({
276+
_source: [testsPath]
277+
}, settings({
278+
globals,
279+
output: false,
280+
test_workers: true,
281+
}));
282+
});
263283
});

0 commit comments

Comments
 (0)