Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate API documentation #3239

Closed
wants to merge 14 commits into from
6 changes: 4 additions & 2 deletions lib/context.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

/**
* @module Context
*/
/**
* Expose `Context`.
*/
Expand All @@ -18,7 +20,7 @@ function Context () {}
*
* @api private
* @param {Runnable} runnable
* @return {Context}
* @return {Context} context
*/
Context.prototype.runnable = function (runnable) {
if (!arguments.length) {
Expand Down
17 changes: 13 additions & 4 deletions lib/hook.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
'use strict';

/**
* @module Hook
*
*/
/**
* Module dependencies.
*/
Expand All @@ -14,8 +17,12 @@ var inherits = require('./utils').inherits;
module.exports = Hook;

/**
* Initialize a new `Hook` with the given `title` and callback `fn`.
*
* Initialize a new `Hook` with the given `title` and callback `fn`. Derived from
* `Runnable`. {@link Runnable}
*
* @memberof Mocha
* @public
* @class
* @param {String} title
* @param {Function} fn
* @api private
Expand All @@ -32,7 +39,9 @@ inherits(Hook, Runnable);

/**
* Get or set the test `err`.
*
*
* @memberof Mocha.Hook
* @public
* @param {Error} err
* @return {Error}
* @api public
Expand Down
51 changes: 46 additions & 5 deletions lib/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
* Copyright(c) 2011 TJ Holowaychuk <[email protected]>
* MIT Licensed
*/

/**
* @namespace Mocha
* @module Mocha
*/
/**
* Module dependencies.
*/
Expand Down Expand Up @@ -34,19 +37,33 @@ if (!process.browser) {
* Expose internals.
*/

/**
* @public
* @class utils
* @memberof Mocha
*/
exports.utils = utils;
exports.interfaces = require('./interfaces');
/**
*
* @memberof Mocha
* @public
*/
exports.reporters = reporters;
exports.Runnable = require('./runnable');
exports.Context = require('./context');
/**
*
* @memberof Mocha
*/
exports.Runner = require('./runner');
exports.Suite = require('./suite');
exports.Hook = require('./hook');
exports.Test = require('./test');

/**
* Return image `name` path.
*
*
* @api private
* @param {string} name
* @return {string}
Expand All @@ -71,6 +88,8 @@ function image (name) {
* - `fullTrace` display the full stack-trace on failing
* - `grep` string or regexp to filter tests with
*
* @public
* @class Mocha
* @param {Object} options
* @api public
*/
Expand Down Expand Up @@ -105,7 +124,8 @@ function Mocha (options) {

/**
* Enable or disable bailing on the first failure.
*
*
* @public
* @api public
* @param {boolean} [bail]
*/
Expand All @@ -119,7 +139,8 @@ Mocha.prototype.bail = function (bail) {

/**
* Add test `file`.
*
*
* @public
* @api public
* @param {string} file
*/
Expand All @@ -131,6 +152,7 @@ Mocha.prototype.addFile = function (file) {
/**
* Set reporter to `reporter`, defaults to "spec".
*
* @public
* @param {String|Function} reporter name or constructor
* @param {Object} reporterOptions optional options
* @api public
Expand Down Expand Up @@ -181,7 +203,7 @@ Mocha.prototype.reporter = function (reporter, reporterOptions) {

/**
* Set test UI `name`, defaults to "bdd".
*
* @public
* @api public
* @param {string} bdd
*/
Expand Down Expand Up @@ -260,6 +282,7 @@ Mocha.prototype._growl = function (runner, reporter) {
/**
* Escape string and add it to grep as a regexp.
*
* @public
* @api public
* @param str
* @returns {Mocha}
Expand All @@ -271,6 +294,7 @@ Mocha.prototype.fgrep = function (str) {
/**
* Add regexp to grep, if `re` is a string it is escaped.
*
* @public
* @param {RegExp|String} re
* @return {Mocha}
* @api public
Expand All @@ -290,6 +314,7 @@ Mocha.prototype.grep = function (re) {
/**
* Invert `.grep()` matches.
*
* @public
* @return {Mocha}
* @api public
*/
Expand All @@ -301,6 +326,7 @@ Mocha.prototype.invert = function () {
/**
* Ignore global leaks.
*
* @public
* @param {Boolean} ignore
* @return {Mocha}
* @api public
Expand All @@ -317,6 +343,7 @@ Mocha.prototype.ignoreLeaks = function (ignore) {
*
* @return {Mocha}
* @api public
* @public
*/
Mocha.prototype.checkLeaks = function () {
this.options.ignoreLeaks = false;
Expand All @@ -328,6 +355,7 @@ Mocha.prototype.checkLeaks = function () {
*
* @return {Mocha}
* @api public
* @public
*/
Mocha.prototype.fullTrace = function () {
this.options.fullStackTrace = true;
Expand All @@ -339,6 +367,7 @@ Mocha.prototype.fullTrace = function () {
*
* @return {Mocha}
* @api public
* @public
*/
Mocha.prototype.growl = function () {
this.options.growl = true;
Expand All @@ -351,6 +380,7 @@ Mocha.prototype.growl = function () {
* @param {Array|String} globals
* @return {Mocha}
* @api public
* @public
* @param {Array|string} globals
* @return {Mocha}
*/
Expand All @@ -365,6 +395,7 @@ Mocha.prototype.globals = function (globals) {
* @param {Boolean} colors
* @return {Mocha}
* @api public
* @public
* @param {boolean} colors
* @return {Mocha}
*/
Expand All @@ -381,6 +412,7 @@ Mocha.prototype.useColors = function (colors) {
* @param {Boolean} inlineDiffs
* @return {Mocha}
* @api public
* @public
* @param {boolean} inlineDiffs
* @return {Mocha}
*/
Expand All @@ -395,6 +427,7 @@ Mocha.prototype.useInlineDiffs = function (inlineDiffs) {
* @param {Boolean} hideDiff
* @return {Mocha}
* @api public
* @public
* @param {boolean} hideDiff
* @return {Mocha}
*/
Expand All @@ -409,6 +442,7 @@ Mocha.prototype.hideDiff = function (hideDiff) {
* @param {Number} timeout
* @return {Mocha}
* @api public
* @public
* @param {number} timeout
* @return {Mocha}
*/
Expand All @@ -423,6 +457,7 @@ Mocha.prototype.timeout = function (timeout) {
* @param {Number} retry times
* @return {Mocha}
* @api public
* @public
*/
Mocha.prototype.retries = function (n) {
this.suite.retries(n);
Expand All @@ -435,6 +470,7 @@ Mocha.prototype.retries = function (n) {
* @param {Number} slow
* @return {Mocha}
* @api public
* @public
* @param {number} slow
* @return {Mocha}
*/
Expand All @@ -449,6 +485,7 @@ Mocha.prototype.slow = function (slow) {
* @param {Boolean} enabled
* @return {Mocha}
* @api public
* @public
* @param {boolean} enabled
* @return {Mocha}
*/
Expand All @@ -462,6 +499,7 @@ Mocha.prototype.enableTimeouts = function (enabled) {
*
* @return {Mocha}
* @api public
* @public
*/
Mocha.prototype.asyncOnly = function () {
this.options.asyncOnly = true;
Expand All @@ -472,6 +510,7 @@ Mocha.prototype.asyncOnly = function () {
* Disable syntax highlighting (in browser).
*
* @api public
* @public
*/
Mocha.prototype.noHighlighting = function () {
this.options.noHighlighting = true;
Expand All @@ -483,6 +522,7 @@ Mocha.prototype.noHighlighting = function () {
*
* @return {Mocha}
* @api public
* @public
*/
Mocha.prototype.allowUncaught = function () {
this.options.allowUncaught = true;
Expand Down Expand Up @@ -528,6 +568,7 @@ Mocha.prototype.forbidPending = function () {
* cache first in whichever manner best suits your needs.
*
* @api public
* @public
* @param {Function} fn
* @return {Runner}
*/
Expand Down
8 changes: 6 additions & 2 deletions lib/ms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

/**
* @module milliseconds
*/
/**
* Helpers.
*/
Expand All @@ -12,7 +14,9 @@ var y = d * 365.25;

/**
* Parse or format the given `val`.
*
*
* @memberof Mocha
* @public
* @api public
* @param {string|number} val
* @return {string|number}
Expand Down
14 changes: 12 additions & 2 deletions lib/reporters/base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

/**
* @module Base
*/
/**
* Module dependencies.
*/
Expand Down Expand Up @@ -169,6 +171,9 @@ function stringifyDiffObjs (err) {
/**
* Output the given `failures` as a list.
*
* @public
* @memberof Mocha.reporters.Base
* @variation 1
* @param {Array} failures
* @api public
*/
Expand Down Expand Up @@ -249,6 +254,9 @@ exports.list = function (failures) {
* stats such as test duration, number
* of tests passed / failed etc.
*
* @memberof Mocha.reporters
* @public
* @class
* @param {Runner} runner
* @api public
*/
Expand Down Expand Up @@ -315,7 +323,9 @@ function Base (runner) {
/**
* Output common epilogue used by many of
* the bundled reporters.
*
*
* @memberof Mocha.reporters.Base
* @public
* @api public
*/
Base.prototype.epilogue = function () {
Expand Down
8 changes: 7 additions & 1 deletion lib/reporters/doc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

/**
* @module Doc
*/
/**
* Module dependencies.
*/
Expand All @@ -16,6 +18,10 @@ exports = module.exports = Doc;
/**
* Initialize a new `Doc` reporter.
*
* @class
* @memberof Mocha.reporters
* @extends {Base}
* @public
* @param {Runner} runner
* @api public
*/
Expand Down
8 changes: 7 additions & 1 deletion lib/reporters/dot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

/**
* @module Dot
*/
/**
* Module dependencies.
*/
Expand All @@ -17,6 +19,10 @@ exports = module.exports = Dot;
/**
* Initialize a new `Dot` matrix test reporter.
*
* @class
* @memberof Mocha.reporters
* @extends Mocha.reporters.Base
* @public
* @api public
* @param {Runner} runner
*/
Expand Down
Loading