Skip to content

util.inspect/console.log: classes print as bare integers, holes as NaN, resolved promises as pending #9415

Description

@proggeramlug
console.log(class Klass {})       // node "[class Klass]"        perry "49"  (a bare integer)
console.log(new Array(3))         // node "[ <3 empty items> ]"  perry "[ NaN, NaN, NaN ]"
console.log(Promise.resolve(1))   // node "Promise { 1 }"        perry "Promise { <pending> }"

Three distinct inspect defects. The first is the worst: a class value prints as an integer (its class id leaking through), which is unrecognisable rather than merely differently formatted. The second turns holes into NaN, which is a wrong value, not a formatting choice. The third reports a settled promise as pending.

Debug output is how people diagnose everything else, so these make every other investigation harder.

Found by a differential stress-test of claude-code under perry.

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