Skip to content

Commit 4a804f7

Browse files
author
Kent C. Dodds
committed
Responding to PR comments
1 parent e9a2b2a commit 4a804f7

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

index.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ export interface AssertContext {
129129
* Assert that function throws an error or promise rejects.
130130
* @param error Can be a constructor, regex, error message or validation function.
131131
*/
132+
/**
133+
* Assert that value is deep equal to expected. (DEPRECATED, use `deepEqual`)
134+
*/
135+
same<U>(value: U, expected: U, message?: string): void;
136+
/**
137+
* Assert that value is not deep equal to expected. (DEPRECATED use `notDeepEqual`)
138+
*/
139+
notSame<U>(value: U, expected: U, message?: string): void;
140+
/**
141+
* Assert that function throws an error or promise rejects.
142+
* @param error Can be a constructor, regex, error message or validation function.
143+
*/
132144
throws(value: Promise<{}>, error?: ErrorValidator, message?: string): Promise<any>;
133145
throws(value: () => void, error?: ErrorValidator, message?: string): any;
134146
/**

lib/assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,5 @@ x.same = util.deprecate(x.deepEqual, getDeprecationNotice('same()', 'deepEqual()
146146
x.notSame = util.deprecate(x.notDeepEqual, getDeprecationNotice('notSame()', 'notDeepEqual()'));
147147

148148
function getDeprecationNotice(oldApi, newApi) {
149-
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.`;
149+
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.';
150150
}

lib/enhance-assert.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ module.exports.PATTERNS = [
1010
't.not(value, expected, [message])',
1111
't.deepEqual(value, expected, [message])',
1212
't.notDeepEqual(value, expected, [message])',
13-
't.regex(contents, regex, [message])'
13+
't.regex(contents, regex, [message])',
14+
// deprecated apis
15+
't.same(value, expected, [message])',
16+
't.notSame(value, expected, [message])'
1417
];
1518

1619
module.exports.NON_ENHANCED_PATTERNS = [

0 commit comments

Comments
 (0)