From cb41aa9c738ba165f1957d8822419691bce14712 Mon Sep 17 00:00:00 2001 From: Phred Date: Sun, 11 Aug 2024 13:12:31 -0500 Subject: [PATCH] replaced hack with Mocha setting --- .mocharc.yml | 1 + .../helpers/{handlers.js => handler-tests.js} | 22 ++----------------- 2 files changed, 3 insertions(+), 20 deletions(-) rename test/helpers/{handlers.js => handler-tests.js} (81%) diff --git a/.mocharc.yml b/.mocharc.yml index 2d4ed8a59..458b14f26 100644 --- a/.mocharc.yml +++ b/.mocharc.yml @@ -1,3 +1,4 @@ +allow-uncaught: true exclude: - test/helpers/scripts/*.js exit: true diff --git a/test/helpers/handlers.js b/test/helpers/handler-tests.js similarity index 81% rename from test/helpers/handlers.js rename to test/helpers/handler-tests.js index f2a7c82b8..6986b0307 100644 --- a/test/helpers/handlers.js +++ b/test/helpers/handler-tests.js @@ -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; @@ -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); }); });