diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-13 07:33:31 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-01-27 03:34:25 +0100 |
commit | 7493db21b667ed746d39c9b54357eac4287232e3 (patch) | |
tree | e6ae60900e43b5fa3d5dcdc8171782ae60192bb1 /test/es-module | |
parent | 5cb196441a6df0fc3fa62e042ce108347f49814c (diff) | |
download | android-node-v8-7493db21b667ed746d39c9b54357eac4287232e3.tar.gz android-node-v8-7493db21b667ed746d39c9b54357eac4287232e3.tar.bz2 android-node-v8-7493db21b667ed746d39c9b54357eac4287232e3.zip |
assert: adjust loose assertions
This changes the loose deep equal comparison by using the same logic
as done in the strict deep equal comparison besides comparing
primitives loosely, not comparing symbol properties and not comparing
the prototype.
`assert.deepEqual` is still commenly used and this is likely the
biggest pitfall.
Most changes are only minor and won't have a big impact besides
likely fixing user expectations.
PR-URL: https://github.com/nodejs/node/pull/25008
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'test/es-module')
-rw-r--r-- | test/es-module/test-esm-dynamic-import.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index 8873399776..b271d43c80 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -23,9 +23,12 @@ function expectMissingModuleError(result) { function expectOkNamespace(result) { Promise.resolve(result) .then(common.mustCall((ns) => { - // Can't deepStrictEqual because ns isn't a normal object - // eslint-disable-next-line no-restricted-properties - assert.deepEqual(ns, { default: true }); + const expected = { default: true }; + Object.defineProperty(expected, Symbol.toStringTag, { + value: 'Module' + }); + Object.setPrototypeOf(expected, Object.getPrototypeOf(ns)); + assert.deepStrictEqual(ns, expected); })); } |