Skip to content

Commit

Permalink
Remove deprecated assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Jan 20, 2017
1 parent 5a3b792 commit c010fd7
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 48 deletions.
10 changes: 0 additions & 10 deletions index.js.flow
Expand Up @@ -43,10 +43,6 @@ type AssertContext = {
truthy(value: mixed, message?: string): void;
// Assert that value is falsy.
falsy(value: mixed, message?: string): void;
// DEPRECATED, use `truthy`. Assert that value is truthy.
ok(value: mixed, message?: string): void;
// DEPRECATED, use `falsy`. Assert that value is falsy.
notOk(value: mixed, message?: string): void;
// Assert that value is true.
true(value: mixed, message?: string): void;
// Assert that value is false.
Expand All @@ -60,12 +56,6 @@ type AssertContext = {
// Assert that value is not deep equal to expected.
notDeepEqual<U>(value: U, expected: U, message?: string): void;
// Assert that function throws an error or promise rejects.
// DEPRECATED, use `deepEqual`. Assert that value is deep equal to expected.
// @param error Can be a constructor, regex, error message or validation function.
same<U>(value: U, expected: U, message?: string): void;
// DEPRECATED use `notDeepEqual`. Assert that value is not deep equal to expected.
notSame<U>(value: U, expected: U, message?: string): void;
// Assert that function throws an error or promise rejects.
// @param error Can be a constructor, regex, error message or validation function.
throws(value: PromiseLike<mixed>, error?: ErrorValidator, message?: string): Promise<mixed>;
throws(value: () => void, error?: ErrorValidator, message?: string): mixed;
Expand Down
14 changes: 0 additions & 14 deletions lib/assert.js
@@ -1,5 +1,4 @@
'use strict';
const util = require('util');
const assert = require('core-assert');
const deepEqual = require('lodash.isequal');
const observableToPromise = require('observable-to-promise');
Expand Down Expand Up @@ -184,16 +183,3 @@ x._snapshot = function (tree, optionalMessage, match, snapshotStateGetter) {
x.snapshot = function (tree, optionalMessage) {
x._snapshot.call(this, tree, optionalMessage);
};

/*
* Deprecated APIs
*/
x.ok = util.deprecate(x.truthy, getDeprecationNotice('ok()', 'truthy()'));
x.notOk = util.deprecate(x.falsy, getDeprecationNotice('notOk()', 'falsy()'));
x.same = util.deprecate(x.deepEqual, getDeprecationNotice('same()', 'deepEqual()'));
x.notSame = util.deprecate(x.notDeepEqual, getDeprecationNotice('notSame()', 'notDeepEqual()'));
x.error = util.deprecate(x.ifError, getDeprecationNotice('error()', 'ifError()'));

function getDeprecationNotice(oldApi, newApi) {
return `DEPRECATION NOTICE: ${oldApi} has been renamed to ${newApi} and will eventually be removed. See https://github.com/avajs/ava-codemods to help upgrade your codebase automatically.`;
}
7 changes: 1 addition & 6 deletions lib/enhance-assert.js
Expand Up @@ -13,12 +13,7 @@ module.exports.PATTERNS = [
't.deepEqual(value, expected, [message])',
't.notDeepEqual(value, expected, [message])',
't.regex(contents, regex, [message])',
't.notRegex(contents, regex, [message])',
// Deprecated apis
't.ok(value, [message])',
't.notOk(value, [message])',
't.same(value, expected, [message])',
't.notSame(value, expected, [message])'
't.notRegex(contents, regex, [message])'
];

module.exports.NON_ENHANCED_PATTERNS = [
Expand Down
18 changes: 0 additions & 18 deletions types/base.d.ts
Expand Up @@ -32,14 +32,6 @@ export interface AssertContext {
* Assert that value is falsy.
*/
falsy(value: any, message?: string): void;
/**
* DEPRECATED, use `truthy`. Assert that value is truthy.
*/
ok(value: any, message?: string): void;
/**
* DEPRECATED, use `falsy`. Assert that value is falsy.
*/
notOk(value: any, message?: string): void;
/**
* Assert that value is true.
*/
Expand All @@ -64,16 +56,6 @@ export interface AssertContext {
* Assert that value is not deep equal to expected.
*/
notDeepEqual<U>(value: U, expected: U, message?: string): void;
/**
* Assert that function throws an error or promise rejects.
* DEPRECATED, use `deepEqual`. Assert that value is deep equal to expected.
* @param error Can be a constructor, regex, error message or validation function.
*/
same<U>(value: U, expected: U, message?: string): void;
/**
* DEPRECATED use `notDeepEqual`. Assert that value is not deep equal to expected.
*/
notSame<U>(value: U, expected: U, message?: string): void;
/**
* Assert that function throws an error or promise rejects.
* @param error Can be a constructor, regex, error message or validation function.
Expand Down

0 comments on commit c010fd7

Please sign in to comment.