Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Add mocha.timeout()

John Firebaugh8f35e84cb5f8
diff --git a/lib/mocha.js b/lib/mocha.js
index ef112d6e..1ca7fafb 100644
--- a/lib/mocha.js
+++ b/lib/mocha.js
@@ -66,7 +66,7 @@ function Mocha(options) {
this.suite = new exports.Suite('', new exports.Context);
this.ui(options.ui);
this.reporter(options.reporter);
- if (options.timeout) this.suite.timeout(options.timeout);
+ if (options.timeout) this.timeout(options.timeout);
}
/**
@@ -217,6 +217,18 @@ Mocha.prototype.globals = function(globals){
return this;
};
+/**
+ * Set the timeout in milliseconds.
+ *
+ * @param {Number} timeout
+ * @return {Mocha}
+ * @api public
+ */
+Mocha.prototype.timeout = function(timeout){
+ this.suite.timeout(timeout);
+ return this;
+};
+
/**
* Run tests and invoke `fn()` when complete.
*