test: convert readdir test to use test runner

Signed-off-by: tchetwin <tchetwin@bloomberg.net>
PR-URL: https://github.com/nodejs/node/pull/55750
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
pull/55973/head
Thomas Chetwin 2024-11-23 21:23:53 +00:00 committed by GitHub
parent d0d52092cf
commit e92499c963
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 10 deletions

View File

@ -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();
}));
});