Skip to content

rename t.same() to t.deepEqual() #686

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

Merged
merged 6 commits into from
Apr 5, 2016
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update deprecation method to use util.deprecate
  • Loading branch information
Kent C. Dodds committed Apr 4, 2016
commit ef49c0f00fdd7d3e90744559bb15711b5e3b9529
16 changes: 5 additions & 11 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,11 @@ x.ifError = x.error = function (err, msg) {
/*
* deprecated APIs
*/
x.same = function (val, expected, msg) {
deprecationNotice('same()', 'deepEqual()');
return x.deepEqual(val, expected, msg);
};

x.notSame = function (val, expected, msg) {
deprecationNotice('notSame()', 'notDeepEqual()');
return x.notDeepEqual(val, expected, msg);
};
x.same = util.deprecate(x.deepEqual, getDeprecationNotice('same()', 'deepEqual()'));
x.notSame = util.deprecate(x.notDeepEqual, getDeprecationNotice('notSame()', 'notDeepEqual()'));

function deprecationNotice(oldApi, newApi) {
console.warn(`DEPRECATION NOTICE: ${oldApi} has been renamed to ${newApi} and will eventually be removed`);
function getDeprecationNotice(oldApi, newApi) {
return `DEPRECATION NOTICE: ${oldApi} has been renamed to ${newApi} and will eventually be removed.` +
` See https://github.com/jamestalmage/ava-codemods to help upgrade your codebase automatically.`;
}