From 829213f62435c429b5bd7c38eb4bbdc6449bef52 Mon Sep 17 00:00:00 2001 From: Zijian Liu Date: Sat, 5 Dec 2020 01:07:51 +0800 Subject: [PATCH] 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 Reviewed-By: Rich Trott Reviewed-By: James M Snell --- test/parallel/test-fs-opendir.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/parallel/test-fs-opendir.js b/test/parallel/test-fs-opendir.js index 1064bd79f44409..4c4681ef48e2ff 100644 --- a/test/parallel/test-fs-opendir.js +++ b/test/parallel/test-fs-opendir.js @@ -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);