Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityvi committed Sep 1, 2023
1 parent 628ab66 commit 2545379
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/src/cli/testCliRunnerMocha.js
Expand Up @@ -26,6 +26,7 @@ describe('test CLI Runner Mocha', function() {
resolve: function(a) {
return a;
},
extname: path.extname,
join: path.join
});

Expand Down Expand Up @@ -89,6 +90,49 @@ describe('test CLI Runner Mocha', function() {
});
});

it('testRunWithMocha - parallelism', function() {

const ChildProcess = common.require('runner/concurrency/child-process.js');
let childProcessCreated = false;
class ChildProcessMock extends ChildProcess {
run(colors, type) {
childProcessCreated = true;
assert.strictEqual(colors.length, 4);
assert.strictEqual(type, 'workers');
assert.deepStrictEqual(Object.keys(this._events), ['message']);

return Promise.resolve(0);
}
}

mockery.registerMock('./child-process.js', ChildProcessMock);

mockery.registerMock('./withmocha.json', {
src_folders: ['tests'],
output_folder: false,
use_child_process: false,
test_settings: {
'default': {
silent: true
}
},
test_runner: 'mocha'
});


const CliRunner = common.require('runner/cli/cli.js');
const runner = new CliRunner({
config: './withmocha.json',
env: 'default',
reporter: 'junit',
parallel: true
}).setup();

return runner.runTests().then(function() {
assert.ok(childProcessCreated, 'mocha runner with parallel threads should use child process');
});
});

it('testRunWithMochaPerEnvironment', function() {
const testFiles = [];
const defaultOptions = {timeout: 20000, reporterOptions: {}};
Expand Down

0 comments on commit 2545379

Please sign in to comment.