From 5231270409b20403a193e4eb278f1fb280107155 Mon Sep 17 00:00:00 2001 From: AnnaMag Date: Tue, 14 Mar 2017 22:53:13 +0000 Subject: [PATCH] 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. --- test/known_issues/test-vm-getters.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/known_issues/test-vm-getters.js b/test/known_issues/test-vm-getters.js index f815e6d658351d..af27eeee644032 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]); +}