-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Increase test coverage for fs/promises.js #19811
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
Conversation
|
@Trott OK, thanks, I'll compare with what's landed there and adjust this. |
|
(Lone CI failure is unrelated. Can be re-run if this PR isn't going to change, but if there are any changes, we'll have to re-run all of CI anyway. So, either way...) |
166aa52 to
7a97e40
Compare
7a97e40 to
be70489
Compare
|
@nodejs/fs @nodejs/testing |
test/parallel/test-fs-promises.js
Outdated
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.
As a general note: we can actually use the following instead:
assert.rejects(
// `mode` can't be > 0o777
() => fchmod(handle, (0o777 + 1)),
{
code: 'ERR_OUT_OF_RANGE',
name: 'RangeError [ERR_OUT_OF_RANGE]'
}
);
test/parallel/test-fs-promises.js
Outdated
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.
Nit: can you please remove the console.log here?
test/parallel/test-fs-promises.js
Outdated
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.
Shouldn't this be compared with buf2?
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.
Nit: Also, if we reduce magic numbers (like 11 in this case) it would be better.
test/parallel/test-fs-promises.js
Outdated
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.
It would be better, if did this for chmod as well.
|
@humphd would you be so kind and have a look at the comments? :-) |
|
@BridgeAR apologies for the delay. I'll update this week. |
be70489 to
d20bde9
Compare
|
OK, I've rebased and done the following based on the reviews above:
|
test/parallel/test-fs-promises.js
Outdated
|
|
||
| await chmod(dest, 0o666); | ||
| await fchmod(handle, 0o666); | ||
| handle.chmod(0o666); |
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.
Should this be awaited?
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.
Indeed, thank you for spotting this. I'll fix.
mhdawson
left a comment
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
|
OSX CI failure looks unrelated, opened #20660 New CI run: https://ci.nodejs.org/job/node-test-pull-request/14796/ |
|
Landed in fcc46ee 🎉 |
PR-URL: #19811 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
PR-URL: #19811 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
|
Thanks for landing this @addaleax, and to the rest for your reviews and help spotting mistakes. |
I was looking at test coverage for the new things in
fs/promises.jsand wanted to add some more. This adds test cases usingFileHandleobjects vs. only using paths or fds.Due to #19057, I'm unable to run coverage locally on macOS; apologies for not including updated coverage info.