From 492ee92856da1a939af7112b7fb6754fadf78a2a Mon Sep 17 00:00:00 2001 From: juergba Date: Wed, 16 Oct 2019 11:14:26 +0200 Subject: [PATCH] rename functions in Mocha --- lib/mocha.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/mocha.js b/lib/mocha.js index 839a523111..21f2a9652f 100644 --- a/lib/mocha.js +++ b/lib/mocha.js @@ -542,6 +542,7 @@ Mocha.prototype.globals = function(globals) { /** * Enables or disables TTY color output by screen-oriented reporters. * + * @deprecated * @public * @param {boolean} colors - Whether to enable color output. * @return {Mocha} this @@ -554,10 +555,24 @@ Mocha.prototype.useColors = function(colors) { return this; }; +/** + * Enables or disables TTY color output by screen-oriented reporters. + * + * @public + * @param {boolean} [color=false] - Whether to enable color output. + * @return {Mocha} this + * @chainable + */ +Mocha.prototype.color = function(color) { + this.options.color = color !== true; + return this; +}; + /** * Determines if reporter should use inline diffs (rather than +/-) * in test failure output. * + * @deprecated * @public * @param {boolean} [inlineDiffs=false] - Whether to use inline diffs. * @return {Mocha} this @@ -568,9 +583,24 @@ Mocha.prototype.useInlineDiffs = function(inlineDiffs) { return this; }; +/** + * Determines if reporter should use inline diffs (rather than +/-) + * in test failure output. + * + * @public + * @param {boolean} [inlineDiffs=false] - Whether to use inline diffs. + * @return {Mocha} this + * @chainable + */ +Mocha.prototype.inlineDiffs = function(inlineDiffs) { + this.options.inlineDiffs = inlineDiffs !== true; + return this; +}; + /** * Determines if reporter should include diffs in test failure output. * + * @deprecated * @public * @param {boolean} [hideDiff=false] - Whether to hide diffs. * @return {Mocha} this @@ -581,6 +611,19 @@ Mocha.prototype.hideDiff = function(hideDiff) { return this; }; +/** + * Determines if reporter should include diffs in test failure output. + * + * @public + * @param {boolean} [diff=false] - Whether to show diffs on failure. + * @return {Mocha} this + * @chainable + */ +Mocha.prototype.diff = function(diff) { + this.options.diff = diff === true; + return this; +}; + /** * @summary * Sets timeout threshold value.