Skip to content

Commit 89d3789

Browse files
add (failing) test case
1 parent 6f12f1e commit 89d3789

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/sequential/test-fs-opendir-recursive.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ function getDirentPath(dirent) {
132132
}
133133

134134
function assertDirents(dirents) {
135+
assert.strictEqual(dirents.length, expected.length);
135136
dirents.sort((a, b) => (getDirentPath(a) < getDirentPath(b) ? -1 : 1));
136137
assert.deepStrictEqual(
137138
dirents.map((dirent) => {
@@ -221,3 +222,12 @@ function processDirCb(dir, cb) {
221222

222223
test().then(common.mustCall());
223224
}
225+
226+
// Issue https://github.com/nodejs/node/issues/48820 highlights that
227+
// opendir recursive does not properly handle the buffer size option.
228+
// This test asserts that the buffer size option is respected.
229+
{
230+
const dir = fs.opendirSync(testDir, { bufferSize: 1, recursive: true });
231+
processDirSync(dir);
232+
dir.closeSync();
233+
}

0 commit comments

Comments
 (0)