Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: correct the assertion for the ES6 object properties #11862

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/known_issues/test-vm-getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked whether using assert.deepStrictEqual(Object.assign({}, result), descriptor) instead works too? I am not a 100 % sure it’s more readable so feel free to ignore me. 😄

Copy link
Member Author

@AnnaMag AnnaMag Mar 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@addaleax, I double-checked and your alternative does work! Upps...
IMHO, it is more elegant, so I'd choose to use it in the test. Not sure about readability, so maybe I'll hold off with the change until an extra view on that :)