Skip to content

console.assert(false, Symbol()) throws #49680

Closed
@jcbhmr

Description

@jcbhmr

Version

v20.6.1

Platform

Linux PIG-2016 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

console

What steps will reproduce the bug?

node -e 'console.assert(false, Symbol())'

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

No response

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

image

What do you see instead?

internal/console/constructor.js:401
      args[0] = `Assertion failed${args.length === 0 ? '' : `: ${args[0]}`}`;
                                                                     ^

TypeError: Cannot convert a Symbol value to a string
    at console.assert (internal/console/constructor.js:401:70)
    at Object.<anonymous> (/home/cg/root/6509ba68c2e82/main.js:1:9)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    consoleIssues and PRs related to the console subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions