From 89d3789eb1affa5ba8b6f6a7aa87108495299cb7 Mon Sep 17 00:00:00 2001 From: Ethan Arrowood Date: Wed, 6 Nov 2024 12:11:22 +0000 Subject: [PATCH] add (failing) test case --- test/sequential/test-fs-opendir-recursive.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/sequential/test-fs-opendir-recursive.js b/test/sequential/test-fs-opendir-recursive.js index a7e9b9a318e5fb..e3aeda26e9a75f 100644 --- a/test/sequential/test-fs-opendir-recursive.js +++ b/test/sequential/test-fs-opendir-recursive.js @@ -132,6 +132,7 @@ function getDirentPath(dirent) { } function assertDirents(dirents) { + assert.strictEqual(dirents.length, expected.length); dirents.sort((a, b) => (getDirentPath(a) < getDirentPath(b) ? -1 : 1)); assert.deepStrictEqual( dirents.map((dirent) => { @@ -221,3 +222,12 @@ function processDirCb(dir, cb) { test().then(common.mustCall()); } + +// Issue https://github.com/nodejs/node/issues/48820 highlights that +// opendir recursive does not properly handle the buffer size option. +// This test asserts that the buffer size option is respected. +{ + const dir = fs.opendirSync(testDir, { bufferSize: 1, recursive: true }); + processDirSync(dir); + dir.closeSync(); +}