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

Remove deprecated methods #4178

Merged
merged 1 commit into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 0 additions & 71 deletions lib/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand All @@ -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.
Expand All @@ -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.
*
Expand Down
1 change: 0 additions & 1 deletion test/jsapi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var Mocha = require('../../');
var mocha = new Mocha({
ui: 'bdd',
globals: ['okGlobalA', 'okGlobalB', 'okGlobalC', 'callback*'],
// ignoreLeaks: true,
growl: true
});

Expand Down
94 changes: 0 additions & 94 deletions test/unit/mocha.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
});
});