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 #797 from gemini-testing/fix/stats
Browse files Browse the repository at this point in the history
fix: tests statistic should listen events on main runner
  • Loading branch information
rostik404 authored Jul 11, 2017
2 parents 5843952 + e676c3a commit 2792042
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ module.exports = class TestsRunner extends Runner {
this.coverage = this.config.isCoverageEnabled() && Coverage.create(config);

this._stateProcessor = stateProcessor;

this._stats = RunnerStats.create();
this._stats.attachRunner(this);

this._browserPool = pool.create(this.config, this);

Expand Down Expand Up @@ -87,7 +89,6 @@ module.exports = class TestsRunner extends Runner {
Events.WARNING,
Events.ERROR
]);
this._stats.attachRunner(runner);

runner.on(Events.END_SUITE, (data) => this._suiteMonitor.suiteFinished(data.suite, data.browserId));

Expand Down
12 changes: 12 additions & 0 deletions test/unit/runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,18 @@ describe('runner', () => {
.then(() => assert.equal(testsStatistic.total, 2));
});

it('should include tests state data emitted from main runner to the statistic', () => {
const runner = createRunner();

runner.emit(Events.ERROR, makeStateResult({name: 'some-name'}));

let testsStatistic;
runner.on(Events.END, (stat) => testsStatistic = stat);

return run(runner)
.then(() => assert.equal(testsStatistic.total, 1));
});

it('should not be immediately rejected if running of tests in some browser was rejected', () => {
const runner = createRunner();
const rejected = q.reject();
Expand Down

0 comments on commit 2792042

Please sign in to comment.