-
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 test-fs-fsync #10176
test: refactor test-fs-fsync #10176
Conversation
20d3a0e
to
333f421
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 with one question
fs.open(file, 'a', 0o777, function(err, fd) { | ||
if (err) throw err; | ||
const fdatasyncSync = common.mustCall(fs.fdatasyncSync); | ||
const fsyncSync = common.mustCall(fs.fsyncSync); |
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.
Wrapping these in common.mustCall()
is really necessary?
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.
@santigimeno Great question! I went back and forth with this before submitting. On one hand, I think having them makes the test a little more explicit and self documenting. On the other hand, they are not really needed since if either function fails, the test should throw an error. I am more than happy to remove them. Thoughts?
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.
Yea, on second though, these aren't needed. common.mustCall()
isn't really necessary with any synchronous code.
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.
Cool, thanks for the input. I'll remove.
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall().
333f421
to
f121377
Compare
Bump |
Landed 34991be Thanks for the contribution |
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: nodejs#10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change
var
withconst
.successes
variable.assert.ifError()
for handling all errors.common.mustCall()
.