-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
test: refactor several parallel/test-timer tests #10524
Conversation
|
||
var f = function(i) { | ||
const f = function(i) { | ||
if (i <= N) { | ||
// check order | ||
assert.equal(i, last_i + 1, 'order is broken: ' + i + ' != ' + |
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.
Since you're already in here refactoring, could you also change the assert.equal()
on this line to assert.strictEqual()
?
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.
Updated - I missed that one
CI: https://ci.nodejs.org/job/node-test-pull-request/5624/ (although I guess we'll want to re-run it after the |
cda395e
to
3213d6e
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.
Also, does test-timers-uncaught-exception.js
still work even if you reduce the delays to 1
?
process.on('exit', function() { | ||
assert(!exited); | ||
exited = true; | ||
process.removeListener('uncaughtException', uncaughtException); |
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.
This will fail because what was actually registered was a function returned from common.mustCall()
.
I don't think you can have async errors during exit though, so this should be unnecessary I think.
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.
I removed the whole function.
Change var to const/let. Simplify test-timers-uncaught-exception.
3213d6e
to
7d2a771
Compare
e6119a8
to
ff0f0c8
Compare
@Fishrock123 updated to address comments, PTAL. Test still passes with 1ms timeout. |
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.
Landed in 7c77932 |
Change var to const/let. Simplify test-timers-uncaught-exception. PR-URL: #10524 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Change var to const/let. Simplify test-timers-uncaught-exception. PR-URL: nodejs#10524 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Change var to const/let. Simplify test-timers-uncaught-exception. PR-URL: nodejs#10524 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Change var to const/let. Simplify test-timers-uncaught-exception. PR-URL: #10524 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Change var to const/let. Simplify test-timers-uncaught-exception. PR-URL: nodejs#10524 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Change var to const/let. Simplify test-timers-uncaught-exception. PR-URL: nodejs#10524 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This does not land cleanly in LTS. Would someone be willing to backport? |
Change var to const/let. Simplify test-timers-uncaught-exception. PR-URL: nodejs#10524 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Change var to const/let. Simplify test-timers-uncaught-exception. Backport-PR-URL: nodejs/node#12401 PR-URL: nodejs/node#10524 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Change var to const/let. Simplify test-timers-uncaught-exception.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test
Description of change
Refactored several of the parallel/test-timer-* tests - mainly changing vars to const and adding common.mustCall() where possible. parallel/test-timers-uncaught-exception has been simplified. Any further suggestions for improvement are welcome 😄