doc,test: widen fsPromises.appendFile()'s data type, add missing tests#64279
Open
hkleungai wants to merge 1 commit into
Open
doc,test: widen fsPromises.appendFile()'s data type, add missing tests#64279hkleungai wants to merge 1 commit into
hkleungai wants to merge 1 commit into
Conversation
From lib/internal/fs/promises.js, one can see fsPromises.appendFile() is simply a wrapper on fsPromises.writeFile(). Hence if writeFile() can take non-buffer data argument, so can appendFile() too. To justify the doc change, I have also restuctured the relevant tests, to enhance the test coverage. They now includes the below test cases consistently. - await do(Append|Write)Buffer(); - await do(Append|Write)BufferAndCancel(); - await do(Append|Write)String(); - await do(Append|Write)Stream(); - await do(Append|Write)StreamWithCancel(); - await do(Append|Write)Iterable(); - await do(Append|Write)InvalidIterable(); - await do(Append|Write)IterableWithEncoding(); - await do(Append|Write)BufferIterable(); - await do(Append|Write)AsyncIterable(); - await do(Append|Write)LargeIterable(); - await do(Append|Write)InvalidValues(); - await do(Append|Write)TypedArrays(); Note that test/parallel/test-fs-promises-writefile-typedarray.js is subsumed by test/parallel/test-fs-promises-file-handle-writeFile.js, and test/parallel/test-fs-promises-writefile-with-fd.js becomes a subcase in test/parallel/test-fs-promises-file-handle-writeFile.js. Refs: nodejs#41677 Signed-off-by: Jimmy Leung <mingfamily@hotmail.com.hk>
0b04ed5 to
62f79de
Compare
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From lib/internal/fs/promises.js, one can see fsPromises.appendFile() is
simply a wrapper on fsPromises.writeFile(). Hence if writeFile() can
take non-buffer data argument, so can appendFile() too.
To justify the doc change, I have also restuctured the relevant tests,
to enhance the test coverage. They now includes the below test cases
consistently.
Note that test/parallel/test-fs-promises-writefile-typedarray.js is
subsumed by test/parallel/test-fs-promises-file-handle-writeFile.js, and
test/parallel/test-fs-promises-writefile-with-fd.js becomes a subcase in
test/parallel/test-fs-promises-file-handle-writeFile.js.
Refs: #41677
Signed-off-by: Jimmy Leung mingfamily@hotmail.com.hk