From f77aa7a2eed8abeff8fa66f86c24c8b200656db4 Mon Sep 17 00:00:00 2001 From: Craig Taub Date: Thu, 2 Jul 2020 11:16:59 +0100 Subject: [PATCH] Browser usage issues with `delay` option (#4341) * Prioritise delay option * lint fix * Improve conditional --- browser-entry.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/browser-entry.js b/browser-entry.js index 114d2f7213..1568ddf488 100644 --- a/browser-entry.js +++ b/browser-entry.js @@ -139,11 +139,19 @@ mocha.setup = function(opts) { if (typeof opts === 'string') { opts = {ui: opts}; } - for (var opt in opts) { - if (Object.prototype.hasOwnProperty.call(opts, opt)) { - this[opt](opts[opt]); - } + if (opts.delay === true) { + this.delay(); } + var self = this; + Object.keys(opts) + .filter(function(opt) { + return opt !== 'delay'; + }) + .forEach(function(opt) { + if (Object.prototype.hasOwnProperty.call(opts, opt)) { + self[opt](opts[opt]); + } + }); return this; };