Skip to content

Commit 2cab00a

Browse files
AnnaMagItalo A. Casas
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 8bda7b8 commit 2cab00a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎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
constcode='Object.getOwnPropertyDescriptor(this, "prop");';
1717
constresult=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(constpropofObject.keys(result)){
23+
assert.strictEqual(result[prop],descriptor[prop]);
24+
}

0 commit comments

Comments
(0)