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

Commit

Permalink
feat: Pass suiteCollection on BEGIN event to allow to modify it
Browse files Browse the repository at this point in the history
  • Loading branch information
j0tunn committed Feb 9, 2017
1 parent 1f905cc commit 94f1974
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/runner/index.js
Expand Up @@ -46,6 +46,7 @@ module.exports = class TestsRunner extends Runner {

_formatBeginEventData(suiteCollection) {
return {
suiteCollection,
config: this.config,
totalStates: _.sumBy(suiteCollection.allSuites(), (suite) => suite.states.length),
browserIds: this.config.getBrowserIds()
Expand Down
11 changes: 11 additions & 0 deletions test/unit/runner/index.js
Expand Up @@ -133,6 +133,17 @@ describe('runner', () => {
return run(runner).then(() => assert.calledOnce(onBegin));
});

it('should suite collection of states when emitting "BEGIN" event', () => {
const runner = createRunner();
const suiteCollection = {allSuites: sinon.stub()};
const onBegin = sinon.spy().named('onBegin');

runner.on(Events.BEGIN, onBegin);

return run(runner, suiteCollection)
.then(() => assert.calledWithMatch(onBegin, {suiteCollection}));
});

it('should pass total number of states when emitting "BEGIN" event', () => {
const runner = createRunner();
const suiteCollection = {allSuites: sinon.stub()};
Expand Down

0 comments on commit 94f1974

Please sign in to comment.