Conversation
|
I’m not sure that this actually makes the code easier to understand… |
|
I know @jasnell wrote it and likes it, so I'm always hesitant to express the opinion, but I dislike using the Countdown() abstraction in tests in most cases. Tests are the one place where readability is almost always more important than avoiding redundant code. As @addaleax notes, this doesn't make the test more readable. |
test/parallel/test-https-agent.js
Outdated
| res.resume(); | ||
| assert.strictEqual(res.statusCode, 200); | ||
| if (++responses === N * M) server.close(); | ||
| ++responses; |
There was a problem hiding this comment.
By adding the countdown you can eliminate the responses counter and the process.on('exit') check
|
It's not always about making the code more understandable... this doesn't make it less understandable either. There is Do-thing-when-X-events-happen logic all over our tests and it has been done inconsistently and in some cases incorrectly. Countdown has allowed us to unify that logic. I'd be a strong -1 on going back to having every test implementing their own countdown logic. |
|
@HarshithaKP A bit of both. Usually, the My preference would be to not go ahead with this. |
|
Closing based on the feedback. |
Refs: #32082 (comment)
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes