Skip to content

Commit c157e02

Browse files
tchetwinaduh95
authored andcommitted
test: convert readdir test to use test runner
Signed-off-by: tchetwin <[email protected]> PR-URL: #55750 Reviewed-By: Pietro Marchini <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent a4f57f0 commit c157e02

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed
+14-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
'use strict';
2-
const common = require('../common');
3-
const fs = require('fs');
4-
const net = require('net');
52

3+
const { PIPE, mustCall } = require('../common');
64
const tmpdir = require('../common/tmpdir');
7-
tmpdir.refresh();
5+
const { test } = require('node:test');
6+
const fs = require('node:fs');
7+
const net = require('node:net');
88

9-
const server = net.createServer().listen(common.PIPE, common.mustCall(() => {
10-
// The process should not crash
11-
// See https://github.com/nodejs/node/issues/52159
12-
fs.readdirSync(tmpdir.path, { recursive: true });
13-
server.close();
14-
}));
9+
test('readdir should not recurse into Unix domain sockets', (t, done) => {
10+
tmpdir.refresh();
11+
const server = net.createServer().listen(PIPE, mustCall(() => {
12+
// The process should not crash
13+
// See https://github.com/nodejs/node/issues/52159
14+
fs.readdirSync(tmpdir.path, { recursive: true });
15+
server.close();
16+
done();
17+
}));
18+
});

0 commit comments

Comments
 (0)