Skip to content

Commit 364330b

Browse files
committed
vfs: speed up recursive readdir test setup
Create the deep directory tree with one recursive mkdirSync() call. This avoids repeatedly resolving increasingly long paths and prevents timeouts on slower CI hosts. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: codex:gpt-5.6-sol
1 parent 6d0db4a commit 364330b

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

test/parallel/test-vfs-readdir-symlink-recursive.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,8 @@ assert.ok(
114114
const v = vfs.create();
115115

116116
// Build /deep/0/1/2/.../999/leaf.txt
117-
let path = '/deep';
118-
v.mkdirSync(path);
119-
for (let i = 0; i < DEPTH; i++) {
120-
path += `/${i}`;
121-
v.mkdirSync(path);
122-
}
117+
const path = `/deep/${Array.from({ length: DEPTH }, (_, i) => i).join('/')}`;
118+
v.mkdirSync(path, { recursive: true });
123119
v.writeFileSync(`${path}/leaf.txt`, 'deep');
124120

125121
const entries = v.readdirSync('/deep', { recursive: true });

0 commit comments

Comments
 (0)