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

Commit

Permalink
feat: remove deprecated BEGIN_SESSION and END_SESSION events
Browse files Browse the repository at this point in the history
  • Loading branch information
j0tunn committed Nov 2, 2017
1 parent d06a913 commit 2c22d1d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 39 deletions.
3 changes: 0 additions & 3 deletions lib/constants/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ module.exports = {
BEGIN: 'begin',
END: 'end',

BEGIN_SESSION: 'beginSession', // Deprecated, will be removed in the next major version - 5.0.0
END_SESSION: 'endSession', // Deprecated, will be removed in the next major version - 5.0.0

RETRY: 'retry',

START_BROWSER: 'startBrowser',
Expand Down
5 changes: 1 addition & 4 deletions lib/runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,10 @@ module.exports = class TestsRunner extends Runner {
}

_runTests(suiteCollection) {
this.emit(Events.BEGIN_SESSION);

return _(this._getBrowsersToRun())
.map((browserId) => this._runTestsInBrowser(suiteCollection, browserId))
.thru(promiseUtils.waitForResults)
.value()
.finally(() => this.emit(Events.END_SESSION));
.value();
}

_getBrowsersToRun() {
Expand Down
3 changes: 0 additions & 3 deletions test/unit/gemini.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ describe('gemini', () => {
Events.BEGIN,
Events.END,

Events.BEGIN_SESSION,
Events.END_SESSION,

Events.RETRY,

Events.START_BROWSER,
Expand Down
29 changes: 0 additions & 29 deletions test/unit/runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,6 @@ describe('runner', () => {
return run(runner).then(() => assert.callOrder(stateProcessor.prepare, BrowserRunner.prototype.run));
});

it('should emit "BEGIN_SESSION" before running of tests', () => {
const runner = createRunner();
const onBeginSession = sinon.spy().named('onBeginSession');

runner.on(Events.BEGIN_SESSION, onBeginSession);

return run(runner).then(() => assert.calledOnce(onBeginSession));
});

it('should create all browser runners', () => {
pool.create.returns('some-pool');

Expand Down Expand Up @@ -298,26 +289,6 @@ describe('runner', () => {
return assert.isRejected(run(runner), /first-runner/);
});

it('should emit "END_SESSION" event after running of tests', () => {
const runner = createRunner();
const onEndSession = sinon.spy().named('onEndSession');

runner.on(Events.END_SESSION, onEndSession);

return run(runner).then(() => assert.callOrder(BrowserRunner.prototype.run, onEndSession));
});

it('should unconditionally emit "END_SESSION" event even if running of tests was rejected', () => {
const runner = createRunner();
const onEndSession = sinon.spy().named('onEndSession');

runner.on(Events.END_SESSION, onEndSession);

BrowserRunner.prototype.run.returns(q.reject());

return run(runner).catch(() => assert.calledOnce(onEndSession));
});

it('should collect coverage', () => {
const runner = createRunner({config: stubConfig({isCoverageEnabled: true})});

Expand Down

0 comments on commit 2c22d1d

Please sign in to comment.