Skip to content

stream: remove legacy prependListener fallback#62435

Open
karan-lrn wants to merge 2 commits intonodejs:mainfrom
karan-lrn:stream-remove-prependlistener-hack
Open

stream: remove legacy prependListener fallback#62435
karan-lrn wants to merge 2 commits intonodejs:mainfrom
karan-lrn:stream-remove-prependlistener-hack

Conversation

@karan-lrn
Copy link
Contributor

The prependListener method has been available on EventEmitter since Node.js v6.0.0 (April 2016). The fallback code that manipulated the internal _events object is no longer necessary.

This also removes tests that explicitly tested the fallback behavior.

The prependListener method has been available on EventEmitter since
Node.js v6.0.0 (April 2016). The fallback code that manipulated the
internal _events object is no longer necessary.

This also removes tests that explicitly tested the fallback behavior.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Mar 25, 2026
@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.69%. Comparing base (1ea93c7) to head (73f182e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62435      +/-   ##
==========================================
+ Coverage   89.59%   89.69%   +0.09%     
==========================================
  Files         676      676              
  Lines      206581   206724     +143     
  Branches    39512    39593      +81     
==========================================
+ Hits       185094   185412     +318     
+ Misses      13583    13460     -123     
+ Partials     7904     7852      -52     
Files with missing lines Coverage Δ
lib/internal/streams/legacy.js 97.32% <100.00%> (+2.87%) ⬆️

... and 47 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@karan-lrn
Copy link
Contributor Author

cc @nodejs/streams @mcollina @ronag

This PR removes the legacy prependListener fallback in lib/internal/streams/legacy.js. The fallback code manipulated the internal _events object to support Node.js versions before v6.0.0 (April 2016) where prependListener didn't exist.

Since Node.js v6 has been EOL for over 8 years, this cleanup removes ~15 lines of unnecessary code and the associated tests that explicitly tested the fallback behavior.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to deprecate this first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants