diff --git a/test/parallel/test-fs-readdir-recursive.js b/test/parallel/test-fs-readdir-recursive.js index f32e600d2a3660..7cfc0903faa0b4 100644 --- a/test/parallel/test-fs-readdir-recursive.js +++ b/test/parallel/test-fs-readdir-recursive.js @@ -1,14 +1,18 @@ 'use strict'; -const common = require('../common'); -const fs = require('fs'); -const net = require('net'); +const { PIPE, mustCall } = require('../common'); const tmpdir = require('../common/tmpdir'); -tmpdir.refresh(); +const { test } = require('node:test'); +const fs = require('node:fs'); +const net = require('node:net'); -const server = net.createServer().listen(common.PIPE, common.mustCall(() => { - // The process should not crash - // See https://github.com/nodejs/node/issues/52159 - fs.readdirSync(tmpdir.path, { recursive: true }); - server.close(); -})); +test('readdir should not recurse into Unix domain sockets', (t, done) => { + tmpdir.refresh(); + const server = net.createServer().listen(PIPE, mustCall(() => { + // The process should not crash + // See https://github.com/nodejs/node/issues/52159 + fs.readdirSync(tmpdir.path, { recursive: true }); + server.close(); + done(); + })); +});