Skip to content

armgit / mocha

Public Imported from GitHub
0

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

add Mocha#bail() method

TJ Holowaychukabb93c0c836b
diff --git a/lib/mocha.js b/lib/mocha.js
index 4604f6cd..7a21e332 100644
--- a/lib/mocha.js
+++ b/lib/mocha.js
@@ -72,6 +72,19 @@ function Mocha(options) {
if (options.slow) this.slow(options.slow);
}
+/**
+ * Enable or disable bailing on the first failure.
+ *
+ * @param {Boolean} [bail]
+ * @api public
+ */
+
+Mocha.prototype.bail = function(bail){
+ if (null == bail) bail = true;
+ this.suite.bail(bail);
+ return this;
+};
+
/**
* Add test `file`.
*
@@ -87,7 +100,7 @@ Mocha.prototype.addFile = function(file){
/**
* Set reporter to `reporter`, defaults to "dot".
*
- * @param {String|Function} reporter name of a reporter or a reporter constructor
+ * @param {String|Function} reporter name or constructor
* @api public
*/