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: fix intrinsics test #26660

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
9 changes: 4 additions & 5 deletions test/parallel/test-freeze-intrinsics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
require('../common');
const assert = require('assert');

try {
Object.defineProperty = 'asdf';
assert(false);
} catch {
}
assert.throws(
() => Object.defineProperty = 'asdf',
Copy link
Member

Choose a reason for hiding this comment

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

Ignorable style micro-nit that others might not agree with anyway: I prefer braces ({ and }) in situations like this because without braces, the arrow function returns a value, and IMO we shouldn't return a value unless we are intending to return a value. Here, we are returning a value as a style side effect. Someone reading this might not know if the return value is significant. By adding braces, we make it clear it's not.

There are, of course arguments the other way. (Someone who knows how assert.throws() works will know the return value is irrelevant. Return a value or not, who cares really?) Just my opinion. I think...uh...@sam-github maybe? Someone else thinks the same way. But it's hardly universal on the project....

Anyway, code change looks good with or without this suggestion. But if I've managed to convince you, cool. 😆

Copy link
Member

Choose a reason for hiding this comment

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

I agree with you, but since the assignment throws an error, there is in fact no return value 😁

TypeError
);