Skip to content

armgit / mocha

Public Imported from GitHub
0

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

docs

Tj Holowaychuk9377a07f6c1b
diff --git a/lib/suite.js b/lib/suite.js
index 00231c32..c384d580 100644
--- a/lib/suite.js
+++ b/lib/suite.js
@@ -5,8 +5,19 @@
var EventEmitter = require('events').EventEmitter;
+/**
+ * Expose `Suite`.
+ */
+
module.exports = Suite;
+/**
+ * Initialize a new `Suite` with the given `title`.
+ *
+ * @param {String} title
+ * @api private
+ */
+
function Suite(title) {
this.title = title;
this.suites = [];
@@ -19,18 +30,42 @@ function Suite(title) {
Suite.prototype.__proto__ = EventEmitter.prototype;
+/**
+ * Add a test `suite`.
+ *
+ * @param {Suite} suite
+ * @return {Suite} for chaining
+ * @api private
+ */
+
Suite.prototype.addSuite = function(suite){
suite.parent = this;
this.suites.push(suite);
return this;
};
+/**
+ * Add a `test` to this suite.
+ *
+ * @param {Test} test
+ * @return {Suite} for chaining
+ * @api private
+ */
+
Suite.prototype.addTest = function(test){
test.parent = this;
this.tests.push(test);
return this;
};
+/**
+ * Return the full title generated by recursively
+ * concatenating the parent's full title.
+ *
+ * @return {String}
+ * @api public
+ */
+
Suite.prototype.fullTitle = function(){
if (this.parent) {
var full = this.parent.fullTitle();
@@ -39,6 +74,13 @@ Suite.prototype.fullTitle = function(){
return this.title;
};
+/**
+ * Return the total number of tests.
+ *
+ * @return {Number}
+ * @api public
+ */
+
Suite.prototype.total = function(){
return this.suites.reduce(function(sum, suite){
return sum + suite.total();
diff --git a/lib/test.js b/lib/test.js
index 3ead2f38..d51de269 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -39,7 +39,7 @@ Test.prototype.timeout = function(ms){
* concatenating the parent's full title.
*
* @return {String}
- * @api private
+ * @api public
*/
Test.prototype.fullTitle = function(){