From 6a7fa7b86c4ae052f5a9384b9440da04ae104e32 Mon Sep 17 00:00:00 2001 From: tchetwin Date: Wed, 6 Nov 2024 15:26:46 +0000 Subject: [PATCH] test: convert readdir test to use test runner Signed-off-by: tchetwin --- test/parallel/test-fs-readdir-recursive.js | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-fs-readdir-recursive.js b/test/parallel/test-fs-readdir-recursive.js index f32e600d2a3660..b1758e0cf82116 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 { test } = require('node:test'); +const fs = require('node:fs'); +const net = require('node:net'); +const common = require('../common'); const tmpdir = require('../common/tmpdir'); -tmpdir.refresh(); -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(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(); + done(); + })); +});