Skip to content

String representation of EventEmitter changed in Node 12.16 #31787

Closed
@remcohaszing

Description

@remcohaszing
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    eventsIssues and PRs related to the events subsystem / EventEmitter.wontfixIssues that will not be fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions