M
assert.notDeepStrictEqual
History
Added in: v1.2.0
v1.2.0
Introduced in: v0.1.21
v0.1.21
Message may now be a
printf-like format string or function.v26.0.0
The
-0 and +0 are not considered equal anymore.v9.0.0
The
NaN is now compared using the SameValueZero comparison.v9.0.0
The
Error names and messages are now properly compared.v9.0.0
The
Set and Map content is also compared.v8.0.0
Typed array slices are handled correctly now.
v6.4.0, v4.7.1
Objects with circular references can be used as inputs now.
v6.1.0
Handle non-
Uint8Array typed arrays correctly.v5.10.1, v4.4.3
assert.notDeepStrictEqual(actual, expected, message?): void
Attributes
Tests for deep strict inequality. Opposite of assert.deepStrictEqual().
import assert from 'node:assert/strict'; assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); // OK
const assert = require('node:assert/strict'); assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); // OK
If the values are deeply and strictly equal, an AssertionError is thrown
with a message property set equal to the value of the message parameter. If
the message parameter is undefined, a default error message is assigned. If
the message parameter is an instance of Error then it will be thrown
instead of the AssertionError.