Skip to content

Commit

Permalink
Merge pull request #158 from gemini-testing/fix/load.plugins.early
Browse files Browse the repository at this point in the history
fix: load plugins early
  • Loading branch information
j0tunn authored Jul 25, 2017
2 parents b11a8d6 + 5c00a24 commit 9a77697
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/hermione.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ module.exports = class Hermione extends QEmitter {

validateUnknownBrowsers(options.browsers, _.keys(this._config.browsers));

const runner = Runner.create(this._config);
this._loadPlugins();

const runner = Runner.create(this._config);
runner.on(RunnerEvents.TEST_FAIL, () => this._fail());
runner.on(RunnerEvents.ERROR, () => this._fail());

Expand All @@ -51,7 +52,6 @@ module.exports = class Hermione extends QEmitter {
qUtils.passthroughEventAsync(runner, this, _.values(RunnerEvents.getAsync()));
qUtils.passthroughEventAsync(signalHandler, this, RunnerEvents.EXIT);

this._loadPlugins();
_.extend(this._config.system.mochaOpts, {grep: options.grep});

return sets.reveal(this._config.sets, options)
Expand All @@ -60,10 +60,10 @@ module.exports = class Hermione extends QEmitter {
}

readTests(testPaths, browsers) {
const runner = Runner.create(this._config);
this._loadPlugins();

const runner = Runner.create(this._config);
qUtils.passthroughEvent(runner, this, _.values(RunnerEvents.getSync()));
this._loadPlugins();

return sets.reveal(this._config.sets, {paths: testPaths, browsers})
.then((tests) => runner.buildSuiteTree(tests));
Expand Down
7 changes: 7 additions & 0 deletions test/lib/hermione.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ describe('hermione', () => {
return runHermione()
.then(() => assert.calledWith(pluginsLoader.load, sinon.match.any, sinon.match.any, 'hermione-'));
});

it('should load plugins before creating any runner', () => {
sandbox.spy(Runner, 'create');

return runHermione()
.then(() => assert.callOrder(pluginsLoader.load, Runner.create));
});
});

describe('sets revealing', () => {
Expand Down

0 comments on commit 9a77697

Please sign in to comment.