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 dependency on deep-equal #10

Closed
Closed
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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,17 @@ Asserts that `result` and `expected` are not strictly equal. If `message` is pro

#### `t.deepEqual(result: any, expected: any, message?: string)`

Asserts that `result` and `expected` are loosely equal, with the same structure and nested values. If `message` is provided, it will be outputted as a description of the assertion.
Asserts that `result` and `expected` are equal, with the same structure and nested values. If `message` is provided, it will be outputted as a description of the assertion.

☝️ *Note: uses [node's deepEqual() algorithm][NodeDeepEqual] with strict comparisons (`===`) on leaf nodes*
☝️ *Note: uses [node's isDeepStrictEqual() algorithm][NodeDeepEqual] with strict comparisons (`===`) on leaf nodes*

#### `t.notDeepEqual(result: any, expected: any, message?: string)`

Asserts that `result` and `expected` not loosely equal, with different structure and/or nested values. If `message` is provided, it will be outputted as a description of the assertion.
Asserts that `result` and `expected` are not equal, with different structure and/or nested values. If `message` is provided, it will be outputted as a description of the assertion.

☝️ *Note: uses [node's deepEqual() algorithm][NodeDeepEqual] with strict comparisons (`===`) on leaf nodes*
☝️ *Note: uses [node's isDeepStrictEqual() algorithm][NodeDeepEqual] with strict comparisons (`===`) on leaf nodes*

[NodeDeepEqual]: https://github.com/substack/node-deep-equal
[NodeDeepEqual]: https://nodejs.org/dist/latest-v17.x/docs/api/util.html#utilisdeepstrictequalval1-val2

#### `t.ok(result: boolean | any, message?: string)`

Expand Down
6 changes: 3 additions & 3 deletions packages/supertape/lib/operators.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import deepEqualCheck from 'deep-equal';
import {isDeepStrictEqual} from 'node:util';
import diff from './diff.mjs';
import {
formatOutput,
Expand Down Expand Up @@ -119,7 +119,7 @@ const fail = (error, at) => ({
});

const deepEqual = (result, expected, message = 'should deep equal') => {
const is = deepEqualCheck(result, expected);
const is = isDeepStrictEqual(result, expected);
const output = is ? '' : diff(expected, result);

return {
Expand All @@ -132,7 +132,7 @@ const deepEqual = (result, expected, message = 'should deep equal') => {
};

const notDeepEqual = (result, expected, message = 'should not deep equal') => {
const is = !deepEqualCheck(result, expected);
const is = !isDeepStrictEqual(result, expected);
const output = is ? '' : diff(expected, result);

return {
Expand Down
1 change: 0 additions & 1 deletion packages/supertape/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@supertape/formatter-time": "^1.0.0",
"@supertape/operator-stub": "^3.0.0",
"cli-progress": "^3.8.2",
"deep-equal": "^2.0.3",
"fullstore": "^3.0.0",
"glob": "^10.3.10",
"jest-diff": "^29.0.1",
Expand Down
Loading