From 90fcd537b885fb3cadd1c10a17e77304dcd97ba0 Mon Sep 17 00:00:00 2001 From: juhongchul Date: Wed, 5 Feb 2020 12:15:23 +0900 Subject: [PATCH] Remove deprecated method Remove following methods and cleanup. - Mocha.prototype.ignoreLeaks - Mocha.prototype.useColors - Mocha.prototype.useInlineDiffs - Mocha.prototype.hideDiff --- lib/mocha.js | 71 ------------------------------- test/jsapi/index.js | 1 - test/unit/mocha.spec.js | 94 ----------------------------------------- 3 files changed, 166 deletions(-) diff --git a/lib/mocha.js b/lib/mocha.js index 0b43004abc..e87721b419 100644 --- a/lib/mocha.js +++ b/lib/mocha.js @@ -427,24 +427,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. * @@ -542,24 +524,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. * @@ -574,25 +538,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. @@ -608,22 +553,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.js index 231c52fedf..1aa842eb08 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.js index 33cd0fdb8e..cae0074f7b 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); @@ -502,48 +452,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); - }); - }); });