Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ehmicky opened this issue Mar 29, 2024 · 8 comments · Fixed by #52283
Closed

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

ehmicky opened this issue Mar 29, 2024 · 8 comments · Fixed by #52283
Labels
good first issue Issues that are suitable for first-time contributors. web streams

Comments

@ehmicky
Copy link

ehmicky commented Mar 29, 2024

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.

@KhafraDev
Copy link
Member

customInspect(depth, options, 'CompressionStream', {

customInspect(depth, options, 'DecompressionStream', {

These lines are missing a return.

@KhafraDev KhafraDev added good first issue Issues that are suitable for first-time contributors. web streams labels Mar 29, 2024
@ehmicky
Copy link
Author

ehmicky commented Mar 29, 2024

Right, this is it!
So new CompressionStream() and new DecompressionStream() do not return undefined. They are just printed as undefined by util.inspect().

@ehmicky ehmicky changed the title new CompressionStream() returns undefined util.inspect(new CompressionStream()) returns undefined Mar 29, 2024
@mertcanaltin
Copy link
Member

I opened a pr for this place thank you very much for the details

@ehmicky
Copy link
Author

ehmicky commented Mar 30, 2024

Thanks @mertcanaltin!

@mnik7044
Copy link

mnik7044 commented May 4, 2024

hey @ehmicky is this issue resolved? Or do you want someone to work on it? I would be more than happy to help and get started.

@ehmicky
Copy link
Author

ehmicky commented May 4, 2024

This is being worked on at #52283

@mnik7044
Copy link

mnik7044 commented May 4, 2024

Understood, can you refer any good first issues for me, to get started with the project. I have a strong foundation of JavaScript and want to contribute to nodejs. Though all the good first issues are either resolved or someone else is working on it

@ehmicky
Copy link
Author

ehmicky commented May 4, 2024

@mnik7044 That's great. However, you should probably open a new issue, since this question is unrelated.

aduh95 pushed a commit that referenced this issue May 12, 2024
PR-URL: #52283
Fixes: #52263
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
targos pushed a commit that referenced this issue May 12, 2024
PR-URL: #52283
Fixes: #52263
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
lukins-cz pushed a commit to lukins-cz/OS-Aplet-node that referenced this issue Jun 1, 2024
PR-URL: nodejs#52283
Fixes: nodejs#52263
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that are suitable for first-time contributors. web streams
Projects
None yet
4 participants