☕️ Classic, reliable, trusted test framework for Node.js and the browser
Remove deprecated methods in mocha.js (#4178)
kundol6aeeb33908a5
diff --git a/lib/mocha.js b/lib/mocha.jsindex 740e1fd8..017daa1e 100644--- a/lib/mocha.js+++ b/lib/mocha.js@@ -474,24 +474,6 @@ Mocha.prototype.invert = function() {return this;};-/**- * Enables or disables ignoring global leaks.- *- * @deprecated since v7.0.0- * @public- * @see {@link Mocha#checkLeaks}- * @param {boolean} [ignoreLeaks=false] - Whether to ignore global leaks.- * @return {Mocha} this- * @chainable- */-Mocha.prototype.ignoreLeaks = function(ignoreLeaks) {- utils.deprecate(- '"ignoreLeaks()" is DEPRECATED, please use "checkLeaks()" instead.'- );- this.options.checkLeaks = !ignoreLeaks;- return this;-};-/*** Enables or disables checking for global variables leaked while running tests.*@@ -589,24 +571,6 @@ Mocha.prototype.global = function(global) {// for backwards compability, 'globals' is an alias of 'global'Mocha.prototype.globals = Mocha.prototype.global;-/**- * Enables or disables TTY color output by screen-oriented reporters.- *- * @deprecated since v7.0.0- * @public- * @see {@link Mocha#color}- * @param {boolean} colors - Whether to enable color output.- * @return {Mocha} this- * @chainable- */-Mocha.prototype.useColors = function(colors) {- utils.deprecate('"useColors()" is DEPRECATED, please use "color()" instead.');- if (colors !== undefined) {- this.options.color = colors;- }- return this;-};-/*** Enables or disables TTY color output by screen-oriented reporters.*@@ -621,25 +585,6 @@ Mocha.prototype.color = function(color) {return this;};-/**- * Determines if reporter should use inline diffs (rather than +/-)- * in test failure output.- *- * @deprecated since v7.0.0- * @public- * @see {@link Mocha#inlineDiffs}- * @param {boolean} [inlineDiffs=false] - Whether to use inline diffs.- * @return {Mocha} this- * @chainable- */-Mocha.prototype.useInlineDiffs = function(inlineDiffs) {- utils.deprecate(- '"useInlineDiffs()" is DEPRECATED, please use "inlineDiffs()" instead.'- );- this.options.inlineDiffs = inlineDiffs !== undefined && inlineDiffs;- return this;-};-/*** Enables or disables reporter to use inline diffs (rather than +/-)* in test failure output.@@ -655,22 +600,6 @@ Mocha.prototype.inlineDiffs = function(inlineDiffs) {return this;};-/**- * Determines if reporter should include diffs in test failure output.- *- * @deprecated since v7.0.0- * @public- * @see {@link Mocha#diff}- * @param {boolean} [hideDiff=false] - Whether to hide diffs.- * @return {Mocha} this- * @chainable- */-Mocha.prototype.hideDiff = function(hideDiff) {- utils.deprecate('"hideDiff()" is DEPRECATED, please use "diff()" instead.');- this.options.diff = !(hideDiff === true);- return this;-};-/*** Enables or disables reporter to include diff in test failure output.*diff --git a/test/jsapi/index.js b/test/jsapi/index.jsindex 231c52fe..1aa842eb 100644--- a/test/jsapi/index.js+++ b/test/jsapi/index.js@@ -5,7 +5,6 @@ var Mocha = require('../../');var mocha = new Mocha({ui: 'bdd',globals: ['okGlobalA', 'okGlobalB', 'okGlobalC', 'callback*'],- // ignoreLeaks: true,growl: true});diff --git a/test/unit/mocha.spec.js b/test/unit/mocha.spec.jsindex bc460aa8..a317ca7c 100644--- a/test/unit/mocha.spec.js+++ b/test/unit/mocha.spec.js@@ -332,56 +332,6 @@ describe('Mocha', function() {});});- describe('#hideDiff()', function() {- it('should set the diff option to false when param equals true', function() {- var mocha = new Mocha(opts);- mocha.hideDiff(true);- expect(mocha.options, 'to have property', 'diff', false);- });-- it('should set the diff option to true when param equals false', function() {- var mocha = new Mocha(opts);- mocha.hideDiff(false);- expect(mocha.options, 'to have property', 'diff', true);- });-- it('should set the diff option to true when the param is undefined', function() {- var mocha = new Mocha(opts);- mocha.hideDiff();- expect(mocha.options, 'to have property', 'diff', true);- });-- it('should be chainable', function() {- var mocha = new Mocha(opts);- expect(mocha.hideDiff(), 'to be', mocha);- });- });-- describe('#ignoreLeaks()', function() {- it('should set the checkLeaks option to false when param equals true', function() {- var mocha = new Mocha(opts);- mocha.ignoreLeaks(true);- expect(mocha.options, 'to have property', 'checkLeaks', false);- });-- it('should set the checkLeaks option to true when param equals false', function() {- var mocha = new Mocha(opts);- mocha.ignoreLeaks(false);- expect(mocha.options, 'to have property', 'checkLeaks', true);- });-- it('should set the checkLeaks option to true when the param is undefined', function() {- var mocha = new Mocha(opts);- mocha.ignoreLeaks();- expect(mocha.options, 'to have property', 'checkLeaks', true);- });-- it('should be chainable', function() {- var mocha = new Mocha(opts);- expect(mocha.ignoreLeaks(), 'to be', mocha);- });- });-describe('#inlineDiffs()', function() {it('should set the inlineDiffs option to true', function() {var mocha = new Mocha(opts);@@ -512,48 +462,4 @@ describe('Mocha', function() {});});});-- describe('#useColors()', function() {- it('should set the color option to true', function() {- var mocha = new Mocha(opts);- mocha.useColors(true);- expect(mocha.options, 'to have property', 'color', true);- });-- it('should not create the color property', function() {- var mocha = new Mocha(opts);- mocha.useColors();- expect(mocha.options, 'not to have property', 'color');- });-- it('should be chainable', function() {- var mocha = new Mocha(opts);- expect(mocha.useColors(), 'to be', mocha);- });- });-- describe('#useInlineDiffs()', function() {- it('should set the inlineDiffs option to true when param equals true', function() {- var mocha = new Mocha(opts);- mocha.useInlineDiffs(true);- expect(mocha.options, 'to have property', 'inlineDiffs', true);- });-- it('should set the inlineDiffs option to false when param equals false', function() {- var mocha = new Mocha(opts);- mocha.useInlineDiffs(false);- expect(mocha.options, 'to have property', 'inlineDiffs', false);- });-- it('should set the inlineDiffs option to false when the param is undefined', function() {- var mocha = new Mocha(opts);- mocha.useInlineDiffs();- expect(mocha.options, 'to have property', 'inlineDiffs', false);- });-- it('should be chainable', function() {- var mocha = new Mocha(opts);- expect(mocha.useInlineDiffs(), 'to be', mocha);- });- });});