test: increase coverage for fs/dir read

test invalid callback case for fs/dir read

Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/internal/fs/dir.js.html#L91

PR-URL: https://github.com/nodejs/node/pull/36388
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Zijian Liu 2020-12-05 01:07:51 +08:00 committed by Node.js GitHub Bot
parent 5a637e9d36
commit a9c0077493

View File

@ -244,6 +244,12 @@ async function doConcurrentAsyncAndSyncOps() {
}
doConcurrentAsyncAndSyncOps().then(common.mustCall());
// Check read throw exceptions on invalid callback
{
const dir = fs.opendirSync(testDir);
assert.throws(() => dir.read('INVALID_CALLBACK'), /ERR_INVALID_CALLBACK/);
}
// Check that concurrent read() operations don't do weird things.
async function doConcurrentAsyncOps() {
const dir = await fs.promises.opendir(testDir);