Skip to content

Commit

Permalink
fix: do nothing if error was emitted without runnable
Browse files Browse the repository at this point in the history
  • Loading branch information
eGavr committed Sep 15, 2017
1 parent 5d25b23 commit fcdc5ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hermione.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ module.exports = (hermione, opts) => {
hermione.on(hermione.events.TEST_FAIL, (data) => collector.addFail(data));
hermione.on(hermione.events.TEST_PENDING, (data) => collector.addSkipped(data));
hermione.on(hermione.events.RETRY, (data) => collector.addRetry(data));
hermione.on(hermione.events.ERROR, (err, data) => collector.addError(data));
hermione.on(hermione.events.ERROR, (err, data) => data && collector.addError(data));
hermione.on(hermione.events.RUNNER_END, () => collector.saveFile());
};
8 changes: 8 additions & 0 deletions test/hermione.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ describe('json-reporter/hermione', () => {
assert.calledOnceWith(Collector.prototype.addError, data);
});

it('should do nothing if error was emitted without runnable', () => {
sandbox.stub(Collector.prototype, 'addError');

hermione.emit(hermione.events.ERROR, 'some error', undefined);

assert.notCalled(Collector.prototype.addError);
});

it('should save collected test data into file when the tests are completed', () => {
sandbox.stub(Collector.prototype, 'saveFile');

Expand Down

0 comments on commit fcdc5ac

Please sign in to comment.