Skip to content

Commit

Permalink
prevent mocha from ending early
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Feb 9, 2023
1 parent ec3772b commit e79da44
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/tools/runner/hooks/unhandled_checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ function beforeEachUnhandled() {
function afterEachUnhandled() {
process.removeListener('uncaughtException', uncaughtExceptionListener);
process.removeListener('unhandledRejection', uncaughtRejectionListener);
expect(unhandled.rejections).to.have.lengthOf(0);
expect(unhandled.exceptions).to.have.lengthOf(0);
try {
expect(unhandled.rejections).to.have.lengthOf(0);
expect(unhandled.exceptions).to.have.lengthOf(0);
} catch (error) {
this.test.error(error);
}
}

module.exports = { mochaHooks: { beforeEach: beforeEachUnhandled, afterEach: afterEachUnhandled } };

0 comments on commit e79da44

Please sign in to comment.