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
PR-URL: https://github.com/nodejs/node/pull/64813
Refs: https://github.com/nodejs/reliability/issues?q=sort%3Aupdated-desc%20%22test-vfs-readdir-symlink-recursive%22
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Tim Perry <pimterry@gmail.com>
This commit is contained in:
Trivikram Kamat authored and Antoine du Hamel committed 2026-08-05 11:15:03 +02:00
1 parent 279547b7da
commit 5293abff73
1 file changed
+2 -6
@@ -114,12 +114,8 @@ assert.ok(
const v = vfs.create();
// Build /deep/0/1/2/.../999/leaf.txt
let path = '/deep';
v.mkdirSync(path);
for (let i = 0; i < DEPTH; i++) {
path += `/${i}`;
v.mkdirSync(path);
}
const path = `/deep/${Array.from({ length: DEPTH }, (_, i) => i).join('/')}`;
v.mkdirSync(path, { recursive: true });
v.writeFileSync(`${path}/leaf.txt`, 'deep');
const entries = v.readdirSync('/deep', { recursive: true });