-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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 test coverage for fs.promises read #22800
Conversation
Welcome @ratracegrad, and thanks for the pull request! /pinging @nodejs/fs @nodejs/testing for reviews |
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 an optional suggestion, you could also check that ret.buffer
remains unchanged here (I think in this case that means it only contains 0 bytes).
LGTM. I'm able to confirm that this covers https://coverage.nodejs.org/coverage-1cee08536794b6d7/root/internal/fs/promises.js.html#L123. |
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.
Er, uh, maybe not. The test fails, probably because using the handle changes the results for the next test case? To avoid side effects, I imagine you'll need to create a new handle for this test, or flush the data you loaded in there or put it after other tests?
@Trott @ratracegrad the setup between tests seems pretty fragile, assertions rely on the behavior of the prior assertion (this was already the case before Jennifer wrote the new test). What if we update this test so all its setup is included in: {
} including the temp file creation. |
@bcoe Yes, a change to provide a block scope around each test and to not share/re-use anything other than the built-in modules (and |
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'm really happy with this; I like that the state has started to be cleaned up between tests, this is good future work.
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
CI was good, landing |
Landed as 27f3d9a. @ratracegrad thanks :) |
PR-URL: #22800 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Coe <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #22800 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Coe <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #22800 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Coe <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Increased test coverage for fs.promises by hitting missing branch on read.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes