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

String representation of EventEmitter changed in Node 12.16 #31787

Closed
remcohaszing opened this issue Feb 14, 2020 · 3 comments
Closed

String representation of EventEmitter changed in Node 12.16 #31787

remcohaszing opened this issue Feb 14, 2020 · 3 comments
Labels
events Issues and PRs related to the events subsystem / EventEmitter. wontfix Issues that will not be fixed.

Comments

@remcohaszing
Copy link

  • Version: v12.16.0 (latest at the moment of writing)

  • Platform (inside Docker image node:12-slim): Linux 8798d6927954 5.3.0-7625-generic Community contrib direction #27157677456019.10~f432cd8-Ubuntu SMP Thu Dec 19 20:35:37 UTC x86_64 GNU/Linux

  • Version: v12.15.0 (latest at the moment of writing)

  • Platform (Docker host): Linux 8798d6927954 5.3.0-7625-generic Community contrib direction #27157677456019.10~f432cd8-Ubuntu SMP Thu Dec 19 20:35:37 UTC x86_64 GNU/Linux

What steps will reproduce the bug?

Run the following code in a NodeJS console.

const events = require('events')
new EventEmitter()

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

This is consistent.

What is the expected behavior?

The output between Node 12.x versions is the same.

What do you see instead?

$ node --version
v12.16.0
$ node
Welcome to Node.js v12.16.0.
Type ".help" for more information.
> const EventEmitter = require('events')
undefined
> new EventEmitter()
EventEmitter {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  [Symbol(kCapture)]: false
}
$ node --version
v12.15.0
$ node
Welcome to Node.js v12.16.0.
Type ".help" for more information.
> const EventEmitter = require('events')
undefined
> new EventEmitter()
EventEmitter {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
}

Additional information

This broke our (admittedly badly written) Jest snapshots.

@devsnek
Copy link
Member

devsnek commented Feb 14, 2020

I don't think this is so much a bug as it is a cautionary tale to not test the output of debug APIs.

@jasnell
Copy link
Member

jasnell commented Feb 14, 2020

I don't think this is so much a bug as it is a cautionary tale to not test the output of debug APIs.

Yeah, I have to agree. The output here is generated by util.inspect() and is not really part of the public API contract for Node.js. It's really intended as debugging output exposing Node.js internals. Annoying? Yes. Bug? No.

@addaleax addaleax added the events Issues and PRs related to the events subsystem / EventEmitter. label Feb 14, 2020
@bnoordhuis
Copy link
Member

I'm closing this as a wontfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
events Issues and PRs related to the events subsystem / EventEmitter. wontfix Issues that will not be fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants