From 0c9e808084bc755e84238cf7271c7fca775ce3a9 Mon Sep 17 00:00:00 2001 From: Craig Taub Date: Mon, 22 Jun 2020 16:33:47 +0100 Subject: [PATCH 1/3] Prioritise delay option --- browser-entry.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/browser-entry.js b/browser-entry.js index 114d2f7213..a928435360 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 ('delay' in opts && 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; }; From 2c5457168367a3fb1ffcfaf086500cc96c05feb8 Mon Sep 17 00:00:00 2001 From: Craig Taub Date: Mon, 22 Jun 2020 17:14:53 +0100 Subject: [PATCH 2/3] lint fix --- browser-entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser-entry.js b/browser-entry.js index a928435360..9905c4ef9f 100644 --- a/browser-entry.js +++ b/browser-entry.js @@ -139,7 +139,7 @@ mocha.setup = function(opts) { if (typeof opts === 'string') { opts = {ui: opts}; } - if ('delay' in opts && opts['delay'] === true) { + if ('delay' in opts && opts.delay === true) { this.delay(); } var self = this; From a53de986d742895afd0cb6165041291080e78552 Mon Sep 17 00:00:00 2001 From: Craig Taub Date: Thu, 2 Jul 2020 10:06:13 +0100 Subject: [PATCH 3/3] Improve conditional --- browser-entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser-entry.js b/browser-entry.js index 9905c4ef9f..1568ddf488 100644 --- a/browser-entry.js +++ b/browser-entry.js @@ -139,7 +139,7 @@ mocha.setup = function(opts) { if (typeof opts === 'string') { opts = {ui: opts}; } - if ('delay' in opts && opts.delay === true) { + if (opts.delay === true) { this.delay(); } var self = this;