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

Commit e676c3a

Browse files
committed
fix: tests statistic should listen events on main runner
1 parent 5843952 commit e676c3a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/runner/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ module.exports = class TestsRunner extends Runner {
2424
this.coverage = this.config.isCoverageEnabled() && Coverage.create(config);
2525

2626
this._stateProcessor = stateProcessor;
27+
2728
this._stats = RunnerStats.create();
29+
this._stats.attachRunner(this);
2830

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

@@ -87,7 +89,6 @@ module.exports = class TestsRunner extends Runner {
8789
Events.WARNING,
8890
Events.ERROR
8991
]);
90-
this._stats.attachRunner(runner);
9192

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

test/unit/runner/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,18 @@ describe('runner', () => {
260260
.then(() => assert.equal(testsStatistic.total, 2));
261261
});
262262

263+
it('should include tests state data emitted from main runner to the statistic', () => {
264+
const runner = createRunner();
265+
266+
runner.emit(Events.ERROR, makeStateResult({name: 'some-name'}));
267+
268+
let testsStatistic;
269+
runner.on(Events.END, (stat) => testsStatistic = stat);
270+
271+
return run(runner)
272+
.then(() => assert.equal(testsStatistic.total, 1));
273+
});
274+
263275
it('should not be immediately rejected if running of tests in some browser was rejected', () => {
264276
const runner = createRunner();
265277
const rejected = q.reject();

0 commit comments

Comments
 (0)