Skip to content

armgit / mocha

Public Imported from GitHub
0

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

docs

Tj Holowaychuk048ca025c420
diff --git a/lib/test.js b/lib/test.js
index ce824b50..3ead2f38 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -1,6 +1,18 @@
+/**
+ * Expose `Test`.
+ */
+
module.exports = Test;
+/**
+ * Initialize a new `Test` with the given `title` and callback `fn`.
+ *
+ * @param {String} title
+ * @param {Function} fn
+ * @api private
+ */
+
function Test(title, fn) {
this.title = title;
this.fn = fn;
@@ -9,15 +21,38 @@ function Test(title, fn) {
this.timeout(5000);
}
+/**
+ * Set timeout `ms`.
+ *
+ * @param {Number} ms
+ * @return {Test} for chaining
+ * @api private
+ */
+
Test.prototype.timeout = function(ms){
this._timeout = ms;
return this;
};
+/**
+ * Return the full title generated by recursively
+ * concatenating the parent's full title.
+ *
+ * @return {String}
+ * @api private
+ */
+
Test.prototype.fullTitle = function(){
return this.parent.fullTitle() + ' ' + this.title;
};
+/**
+ * Run the test and invoke `fn(err)`.
+ *
+ * @param {Function} fn
+ * @api private
+ */
+
Test.prototype.run = function(fn){
var timer
, self = this