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 WARNING event
Browse files Browse the repository at this point in the history
  • Loading branch information
j0tunn committed Nov 2, 2017
1 parent 2c22d1d commit c906b1f
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 37 deletions.
1 change: 0 additions & 1 deletion lib/constants/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module.exports = {
END_STATE: 'endState',

INFO: 'info',
WARNING: 'warning',
ERROR: 'err', // unable to call it `error` because `error` handling is a special case for EventEmitter

TEST_RESULT: 'testResult',
Expand Down
8 changes: 0 additions & 8 deletions lib/reporters/flat-factory/flat.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module.exports = class Flat {
runner.on(Events.UPDATE_RESULT, this._onUpdateResult.bind(this));
runner.on(Events.RETRY, this._onRetry.bind(this));
runner.on(Events.ERROR, this._onError.bind(this));
runner.on(Events.WARNING, this._onWarning.bind(this));
runner.on(Events.END, this._onEnd.bind(this));
runner.on(Events.INFO, this._onInfo.bind(this));
runner.on(Events.SKIP_STATE, this._onSkipState.bind(this));
Expand Down Expand Up @@ -57,13 +56,6 @@ module.exports = class Flat {
this._logError(result);
}

_onWarning(result) {
logger.log(`${ICON_WARN} ${this._formatStateInfo(result)}`);
logger.warn(result.message);

this._counter.onSkipped(result);
}

_onSkipState(result) {
const skipReason = result.suite.skipComment
? chalk.yellow('reason: ' + result.suite.skipComment)
Expand Down
1 change: 0 additions & 1 deletion lib/runner/browser-runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ module.exports = class BrowserRunner extends Runner {
Events.END_STATE,
Events.TEST_RESULT,
Events.UPDATE_RESULT,
Events.WARNING,
Events.ERROR,
Events.RETRY
]);
Expand Down
1 change: 0 additions & 1 deletion lib/runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ module.exports = class TestsRunner extends Runner {
Events.BEGIN_STATE,
Events.END_STATE,
Events.INFO,
Events.WARNING,
Events.ERROR
]);

Expand Down
3 changes: 1 addition & 2 deletions lib/runner/suite-runner/insistent-suite-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ module.exports = class InsistentSuiteRunner extends SuiteRunner {
Events.BEGIN_STATE,
Events.SKIP_STATE,
Events.END_STATE,
Events.UPDATE_RESULT,
Events.WARNING
Events.UPDATE_RESULT
]);

return runner;
Expand Down
3 changes: 1 addition & 2 deletions lib/runner/suite-runner/regular-suite-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ module.exports = class RegularSuiteRunner extends SuiteRunner {
Events.BEGIN_STATE,
Events.END_STATE,
Events.TEST_RESULT,
Events.UPDATE_RESULT,
Events.WARNING
Events.UPDATE_RESULT
]);

runner.on(Events.ERROR, (e) => {
Expand Down
2 changes: 0 additions & 2 deletions lib/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const STATS = {
passed: 'passed',
failed: 'failed',
skipped: 'skipped',
warned: 'warned',
retries: 'retries'
};

Expand All @@ -25,7 +24,6 @@ module.exports = class Stats {
attachRunner(runner) {
runner
.on(RunnerEvents.SKIP_STATE, (test) => this._addStat(STATS.skipped, test))
.on(RunnerEvents.WARNING, (test) => this._addStat(STATS.warned, test))
.on(RunnerEvents.ERROR, (test) => this._addStat(STATS.failed, test))
.on(RunnerEvents.UPDATE_RESULT, (test) => {
return test.updated ? this._addStat(STATS.updated, test) : this._addStat(STATS.passed, test);
Expand Down
1 change: 0 additions & 1 deletion test/unit/gemini.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ describe('gemini', () => {
Events.END_STATE,

Events.INFO,
Events.WARNING,
Events.ERROR,

Events.TEST_RESULT,
Expand Down
1 change: 0 additions & 1 deletion test/unit/runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ describe('runner', () => {
Events.BEGIN_STATE,
Events.END_STATE,
Events.INFO,
Events.WARNING,
Events.ERROR
].forEach((event) => testPassthrough(event));
});
Expand Down
4 changes: 1 addition & 3 deletions test/unit/runner/suite-runner/insistent-suite-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ describe('runner/suite-runner/insistent-suite-runner', () => {
Events.SKIP_STATE,
Events.END_STATE,
Events.TEST_RESULT,
Events.UPDATE_RESULT,
Events.WARNING
Events.UPDATE_RESULT
].forEach((stateEvent) => it(`should passthrough ${stateEvent} state`, () => {
stubWrappedRun_((runner) => runner.emit(stateEvent, {foo: 'bar'}));
const handler = sinon.spy().named(stateEvent + 'Handler');
Expand Down Expand Up @@ -452,7 +451,6 @@ describe('runner/suite-runner/insistent-suite-runner', () => {
Events.END_STATE,
Events.UPDATE_RESULT,
Events.TEST_RESULT,
Events.WARNING,
Events.ERROR
].forEach((event) => {
it(`${event}`, () => {
Expand Down
16 changes: 1 addition & 15 deletions test/unit/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ describe('Stats', () => {
assert.equal(stats.getResult().skipped, 1);
});

it('should count warned tests', () => {
runner.emit(RunnerEvents.WARNING, makeStateResult());

assert.equal(stats.getResult().warned, 1);
});

it('should count updated tests', () => {
runner.emit(RunnerEvents.UPDATE_RESULT, makeStateResult({updated: true}));

Expand Down Expand Up @@ -66,12 +60,6 @@ describe('Stats', () => {
assert.equal(stats.getResult().passed, 1);
});

it('should count warned tests on "WARNING" event', () => {
runner.emit(RunnerEvents.WARNING, makeStateResult());

assert.equal(stats.getResult().warned, 1);
});

it('should count total test count', () => {
runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: false, name: 'first'}));
runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: true, name: 'second'}));
Expand All @@ -86,15 +74,13 @@ describe('Stats', () => {
runner.emit(RunnerEvents.TEST_RESULT, makeStateResult({equal: false, name: 'failed'}));
runner.emit(RunnerEvents.ERROR, makeStateResult({name: 'errored'}));
runner.emit(RunnerEvents.SKIP_STATE, makeStateResult({name: 'skipped'}));
runner.emit(RunnerEvents.WARNING, makeStateResult({name: 'warned'}));

assert.deepEqual(stats.getResult(), {
total: 6,
total: 5,
updated: 1,
passed: 1,
failed: 2,
skipped: 1,
warned: 1,
retries: 1
});
});
Expand Down

0 comments on commit c906b1f

Please sign in to comment.