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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions