Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Browser usage issues with `delay` option (#4341)

Craig Taubf77aa7a2eed8
diff --git a/browser-entry.js b/browser-entry.js
index 114d2f72..1568ddf4 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;
};