-
Notifications
You must be signed in to change notification settings - Fork 30k
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: increase coverage of timers #11290
Conversation
I think we should probably restrict the ES6 usage, otherwise we can't backport the changes easily (especially to v4.x -- which has spread and other ES6 features behind a flag yet). |
test/parallel/test-timers-args.js
Outdated
if (nargs < 128) interval(nargs + 1); | ||
} | ||
} | ||
|
||
timeout(0); | ||
interval(0); | ||
function immediate(nargs) { |
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.
IMO this should be in a separate file that is about Immediates rather than Timeouts.
Sure, they are from the same module, but they share pretty much 0 implementation at the current time.
371a61b
to
dd6c89c
Compare
@Fishrock123 Thanks for the review, I moved that test to |
const N = 3; | ||
let count = 0; | ||
function next() { | ||
const immediate = setImmediate(function() { |
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.
Perhaps we can drop count
entirely and the process
'exit'
handler and just wrap the callback in a common.mustCall()
?
const N = 3; | ||
let count = 0; | ||
function next() { | ||
const immediate = setImmediate(function() { |
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.
Now that we have a common.mustNotCall()
, I think we can use that here and drop count
and the process
'exit'
handler.
assert.deepStrictEqual(immediateC, [1, 2, 3], 'immediateC args should match'); | ||
assert.deepStrictEqual(immediateD, [1, 2, 3, 4, 5], '5 args should match'); | ||
}); | ||
process.on('exit', function() { |
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.
Perhaps we can remove this event handler and just move the assertion to inside callback
?
47df589
to
0857f05
Compare
@mscdex Thanks for the review, PTAL. |
CI is green, LGTM. |
@Fishrock123 PTAL |
@DavidCai1993
Oops, it was me who wrote this line...forgot about the backportability part(:facepalm) +1 on fixing this. |
PR-URL: nodejs#11452 Refs: nodejs#11290 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This needs a rebase @DavidCai1993 @Fishrock123 I dismiss your request as that was addressed by @DavidCai1993. Please have another look as soon as he rebased. |
The requested change was addressed
Closing due to a long inactivity. @DavidCai1993 please feel free to reopen if you want to follow up on this. |
PR-URL: nodejs/node#11452 Refs: nodejs/node#11290 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test