Skip to content

Commit

Permalink
test: convert readdir test to use test runner
Browse files Browse the repository at this point in the history
Signed-off-by: tchetwin <[email protected]>
PR-URL: #55750
Reviewed-By: Pietro Marchini <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
tchetwin authored and aduh95 committed Nov 26, 2024
1 parent a4f57f0 commit c157e02
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions test/parallel/test-fs-readdir-recursive.js
Original file line number Diff line number Diff line change
@@ -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();
}));
});

0 comments on commit c157e02

Please sign in to comment.