Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
fixup! src: disallow constructor behaviour for native methods
  • Loading branch information
addaleax committed Mar 17, 2019
commit af88f4157e8eea68e994018c755e021beb001f25
5 changes: 1 addition & 4 deletions test/parallel/test-process-chdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,4 @@ common.expectsError(function() { process.chdir(); }, err);
// Check that our built-in methods do not have a prototype/constructor behaviour
// if they don't need to. This could be tested for any of our C++ methods.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This could be tested for any of our C++ methods.

Maybe it doesn't matter, but the one picked here means this isn't tested in Worker threads.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I’d say it doesn’t matter – these things are pretty independent, and I’ve chosen something that is likely to stay a directly C++-backed method for a long time. I’m happy to take other suggestions, though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like this conflicted with #27224 😄

assert.strictEqual(process.cwd.prototype, undefined);
assert.throws(() => new process.cwd(), /not a constructor/);
// Make sure that the above checks verify the right thing, i.e. that we're
// actually looking at a directly exposed C++ binding method.
assert.strictEqual(process.cwd.toString(), 'function cwd() { [native code] }');
assert.throws(() => new process.cwd(), TypeError);