Skip to content

util.inspect(new CompressionStream()) returns undefined #52263

@ehmicky

Description

@ehmicky

Version

v21.7.1

Platform

Linux my-laptop 6.5.0-26-generic #26-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 5 21:19:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

stream/web

What steps will reproduce the bug?

const stream = new CompressionStream('gzip');
console.log(stream); // undefined

This applies to DecompressionStream() as well.

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

Earlier Node.js versions show the same behavior.

The behavior is the same regardless of whether it is accessed as a global variable or as an import from stream/web.

The behavior happens on my machine, but it appears on other users that tried it too. I also tried it on an online REPL for Node.js.

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

The return value should not be undefined.

What do you see instead?

The return value is undefined.

Additional information

I tried it in Firefox and Chrome, and it does not return undefined.

When calling CompressionStream.toString(), it appears the correct source code is being used. That source code looks normal to me.

What I find very strange is how new ... can return undefined. I through it was impossible. Even if the constructor returned a value (which it does not here), that value is ignored if it is undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions