mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(ext/node): improve comparison of faked objects in deepStrictEqual
(#29819)
This commit improves the handling of objects with faked prototypes in `deepStrictEqual`. This enables `parallel/test-assert-checktag.js` - `Date` objects are checked by `core.isDate` - In object comparison, now it checks `obj.toString()` output (The difference of `Symbol.toStringTag` is now detected). - Stoped using std's assertion error message for `deepStrictEqual`, but started using Node.js version of diff string. Now the diff expression is more compatible with Node.
This commit is contained in:
parent
1e9415cda8
commit
c538f44fa0
8 changed files with 109 additions and 19 deletions
|
@ -383,11 +383,16 @@ function deepStrictEqual(
|
|||
throw new ERR_MISSING_ARGS("actual", "expected");
|
||||
}
|
||||
|
||||
toNode(
|
||||
() => asserts.assertEquals(actual, expected),
|
||||
{ message, actual, expected, operator: "deepStrictEqual" },
|
||||
);
|
||||
if (!asserts.equal(actual, expected)) {
|
||||
throw new AssertionError({
|
||||
message,
|
||||
actual,
|
||||
expected,
|
||||
operator: "deepStrictEqual",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function notDeepStrictEqual(
|
||||
actual: unknown,
|
||||
expected: unknown,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue