Node: String representation of EventEmitter changed in Node 12.16

Created on 14 Feb 2020  路  3Comments  路  Source: nodejs/node

  • Version: v12.16.0 (latest at the moment of writing)
  • Platform (inside Docker image node:12-slim): Linux 8798d6927954 5.3.0-7625-generic #27~1576774560~19.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 #27~1576774560~19.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.

events wontfix

All 3 comments

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

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.

I'm closing this as a wontfix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fanjunzhi picture fanjunzhi  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

cong88 picture cong88  路  3Comments

mcollina picture mcollina  路  3Comments

srl295 picture srl295  路  3Comments