Skip to content

Commit

Permalink
replaced hack with Mocha setting
Browse files Browse the repository at this point in the history
  • Loading branch information
fearphage committed Aug 11, 2024
1 parent 4fcf9ab commit cb41aa9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
1 change: 1 addition & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
allow-uncaught: true
exclude:
- test/helpers/scripts/*.js
exit: true
Expand Down
22 changes: 2 additions & 20 deletions test/helpers/handlers.js → test/helpers/handler-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,7 @@ const mocha = require('mocha');
const helpers = require('.');
const winston = require('../../lib/winston');

module.exports = function ({ getAllInfo, helper, listener, name, setup, toggleSetting, trigger }) {
before(function () {
/*
* This is an awful and fragile hack that
* needs to be changed ASAP.
* https://github.com/mochajs/mocha/issues/1985
*/
var _runTest = this.originalRunTest = mocha.Runner.prototype.runTest;

mocha.Runner.prototype.runTest = function () {
this.allowUncaught = true;
_runTest.apply(this, arguments);
};
});

after(function () {
mocha.Runner.prototype.runTest = this.originalRunTest;
});

module.exports = function ({ helper, listener, name, setup, toggleSetting, trigger }) {
describe('basics', function () {
var handler;

Expand Down Expand Up @@ -70,7 +52,7 @@ module.exports = function ({ getAllInfo, helper, listener, name, setup, toggleSe

it('.getAllInfo(undefined)', function () {
// eslint-disable-next-line no-undefined
handler.getAllInfo(getAllInfo);
handler.getAllInfo(undefined);
});
});

Expand Down

0 comments on commit cb41aa9

Please sign in to comment.