Skip to content

Commit 7ef2d90

Browse files
AnnaMagfhinkel
authored andcommitted
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: #11862 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent 4895e0c commit 7ef2d90

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

test/known_issues/test-vm-getters.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ const context = vm.createContext(sandbox);
1616
const code = 'Object.getOwnPropertyDescriptor(this, "prop");';
1717
const result = vm.runInContext(code, context);
1818

19-
assert.strictEqual(result, descriptor);
19+
// Ref: https://github.com/nodejs/node/issues/11803
20+
21+
assert.deepStrictEqual(Object.keys(result), Object.keys(descriptor));
22+
for (const prop of Object.keys(result)) {
23+
assert.strictEqual(result[prop], descriptor[prop]);
24+
}

0 commit comments

Comments
 (0)