-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
stream: fix eventNames() to not return not defined events #51331
Conversation
34542ca
to
bf229ca
Compare
Yep, that's basically what I had in mind. I'd maybe make it check if it's an array and non-empty though to be more accurate rather than just the simple check that it's not undefined. Can you add some tests? 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please add a test :]
9a4ba8d
to
0c7adfc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but a suggestion: the tests currently rely on the implementation detail of streams doing the _events pre-allocation. It may be a good idea to manually reproduce the behaviour on a plain event listener as streams could change in the future to not do that anymore. 🤔
I wonder if it is better to override |
0c7adfc
to
05c64c3
Compare
@lpinca I agree with you, this is related to Stream not EventEmitter, I pushed the changes, could you please check again ? |
05c64c3
to
feb07ec
Compare
I think flaky tests 🤔 no ? |
Yes. |
Failed on this one wasi/test-wasi # TODO : Fix flaky test |
feb07ec
to
cea8fe3
Compare
cea8fe3
to
2bbe1f6
Compare
Commit Queue failed- Loading data for nodejs/node/pull/51331 ✔ Done loading data for nodejs/node/pull/51331 ----------------------------------- PR info ------------------------------------ Title stream: fix eventNames() to not return not defined events (#51331) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch IlyasShabi:stream-event-names -> nodejs:main Labels events, needs-ci Commits 1 - stream: fix eventNames() to not return not defined events Committers 1 - Ilyas Shabi PR-URL: https://github.com/nodejs/node/pull/51331 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Stephen Belanger Reviewed-By: Luigi Pinca ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/51331 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Stephen Belanger Reviewed-By: Luigi Pinca -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last approving review: ⚠ - stream: fix eventNames() to not return not defined events ℹ This PR was created on Mon, 01 Jan 2024 12:43:44 GMT ✔ Approvals: 3 ✔ - Benjamin Gruenbaum (@benjamingr) (TSC): https://github.com/nodejs/node/pull/51331#pullrequestreview-1799869531 ✔ - Stephen Belanger (@Qard): https://github.com/nodejs/node/pull/51331#pullrequestreview-1890807762 ✔ - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/51331#pullrequestreview-1890926622 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2024-02-27T21:35:07Z: https://ci.nodejs.org/job/node-test-pull-request/57477/ - Querying data for job/node-test-pull-request/57477/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/8072630772 |
Landed in a51efa2 |
PR-URL: #51331 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #51331 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #51331 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #51331 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#51331 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Fix issue #51302
As explained by @Qard, the root cause is that by default, we pre-allocate events here here
I did different tests like:
I will add tests as soon as I can