forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: convert readdir test to use test runner
Signed-off-by: tchetwin <tchetwin@bloomberg.net> PR-URL: nodejs#55750 Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
Showing
1 changed file
with
14 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
})); | ||
}); |