Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #834 from gemini-testing/fix/load.plugins
Browse files Browse the repository at this point in the history
fix: load plugins only once
  • Loading branch information
j0tunn authored Nov 2, 2017
2 parents 05d10da + a56e39b commit 0224b70
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/gemini.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ module.exports = class Gemini extends PassthroughEmitter {
}

_exec(fn) {
const plugins = pluginsLoader.load(this, this.config.system.plugins, PREFIX);
return bluebirdQ(Promise.all(plugins).then(() => fn()));
return bluebirdQ(this._loadPlugins().then(() => fn()));
}

_loadPlugins() {
this._loadPlugins = () => Promise.resolve(); // load plugins only once
return Promise.all(pluginsLoader.load(this, this.config.system.plugins, PREFIX));
}

_readTests(paths, options) {
Expand Down
8 changes: 8 additions & 0 deletions test/unit/gemini.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ describe('gemini', () => {
return assert.isRejected(result, err)
.then(() => assert.notCalled(Runner.prototype.run));
});

it('should load plugins only once', () => {
const gemini = initGemini();

return gemini.readTests()
.then((collection) => gemini.test(collection))
.then(() => assert.calledOnce(pluginsLoader.load));
});
});

describe('readTests', () => {
Expand Down

0 comments on commit 0224b70

Please sign in to comment.