Increase test coverage for fs/promises.js#19811
Increase test coverage for fs/promises.js#19811humphd wants to merge 3 commits intonodejs:masterfrom
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.
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.
Nit: can you please remove the console.log here?
test/parallel/test-fs-promises.js
Outdated
There was a problem hiding this comment.
Shouldn't this be compared with buf2?
There was a problem hiding this comment.
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.
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.
Indeed, thank you for spotting this. I'll fix.
|
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.