diff options
author | AnnaMag <AnnaMag@users.noreply.github.com> | 2017-03-15 01:53:13 +0300 |
---|---|---|
committer | Italo A. Casas <me@italoacasas.com> | 2017-03-20 17:38:10 +0300 |
commit | 2cab00aec0e4ba546ae751cd3c3182aac309e782 (patch) | |
tree | 5519cd4bf0d6f1d97af294a8af28062f6f5e692b /test | |
parent | 8bda7b8d39b85c77c53f510beadd6e4d898890ad (diff) |
test: fix assertion in vm test
Prototypes are not strict equal when they are from
different contexts. Therefore, assert.strictEqual()
fails for objects that are created in different
contexts, e.g., in vm.runInContext().
Instead of expecting the prototypes to be equal,
only check the properties of the objects
for equality.
PR-URL: https://github.com/nodejs/node/pull/11862
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/known_issues/test-vm-getters.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/known_issues/test-vm-getters.js b/test/known_issues/test-vm-getters.js index f815e6d6583..af27eeee644 100644 --- a/test/known_issues/test-vm-getters.js +++ b/test/known_issues/test-vm-getters.js @@ -16,4 +16,9 @@ const context = vm.createContext(sandbox); const code = 'Object.getOwnPropertyDescriptor(this, "prop");'; const result = vm.runInContext(code, context); -assert.strictEqual(result, descriptor); +// Ref: https://github.com/nodejs/node/issues/11803 + +assert.deepStrictEqual(Object.keys(result), Object.keys(descriptor)); +for (const prop of Object.keys(result)) { + assert.strictEqual(result[prop], descriptor[prop]); +} |