From 5277a9f77c7f071531a59feca27a5c62cb10e683 Mon Sep 17 00:00:00 2001 From: Christopher Hiller Date: Wed, 13 May 2020 16:57:30 -0700 Subject: [PATCH 1/2] fix test/unit/hook.spec.js `Function.prototype.name` is not available in IE11, and will cause the browser tests to fail. --- test/unit/hook.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/hook.spec.js b/test/unit/hook.spec.js index b02a6c5120..5fb51733e1 100644 --- a/test/unit/hook.spec.js +++ b/test/unit/hook.spec.js @@ -4,7 +4,7 @@ var Mocha = require('../../lib/mocha'); var Hook = Mocha.Hook; var Runnable = Mocha.Runnable; -describe(Hook.name, function() { +describe('Hook', function() { var hook; beforeEach(function() { From 885b525d730070185250e8bd54341da222e06d09 Mon Sep 17 00:00:00 2001 From: Christopher Hiller Date: Wed, 13 May 2020 17:34:44 -0700 Subject: [PATCH 2/2] another IE11 fix: avoid Array.prototype.findIndex Signed-off-by: Christopher Hiller --- lib/runner.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/runner.js b/lib/runner.js index 2f38fa8e96..7eabb5a1cf 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -192,15 +192,18 @@ Runner.prototype._addEventListener = function(target, eventName, listener) { * @param fn {function} */ Runner.prototype._removeEventListener = function(target, eventName, listener) { - var eventListenerIndex = this._eventListeners.findIndex(function( - eventListenerDescriptor - ) { - return ( + var eventListenerIndex = -1; + for (var i = 0; i < this._eventListeners.length; i++) { + var eventListenerDescriptor = this._eventListeners[i]; + if ( eventListenerDescriptor[0] === target && eventListenerDescriptor[1] === eventName && eventListenerDescriptor[2] === listener - ); - }); + ) { + eventListenerIndex = i; + break; + } + } if (eventListenerIndex !== -1) { var removedListener = this._eventListeners.splice(eventListenerIndex, 1)[0]; removedListener[0].removeListener(removedListener[1], removedListener[2]);