Skip to content

console.log(proxy) default output is less than helpful #60964

@jasnell

Description

@jasnell

Version

All

Platform

All

Subsystem

console/util.inspect

What steps will reproduce the bug?

const p = new Proxy({}, {
  ownKeys() { return ['a']; },
  getOwnPropertyDescriptor() {
    return { value: 1, writable: false, enumerable: true, configurable: true };
  },
  has() { return true; },
  get() { return 1; },
});
console.log(p);  // Outputs '{}'

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

Ideally, the output would include all enumerable properties, just like it would with a normal, non-proxy object.

What do you see instead?

{} ... omitting the enumerable ownKeys

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions