Skip to content

Commit b344e74

Browse files
LiviaMedeirosdanielleadams
authored andcommitted
test: move socket from CWD to temporary directory
PR-URL: #46863 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent b25ee52 commit b344e74

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/parallel/test-fs-cp.mjs

+6-2
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,10 @@ function nextdir() {
275275

276276
// It throws an error if attempt is made to copy socket.
277277
if (!isWindows) {
278+
const src = nextdir();
279+
mkdirSync(src);
278280
const dest = nextdir();
279-
const sock = `${process.pid}.sock`;
281+
const sock = join(src, `${process.pid}.sock`);
280282
const server = net.createServer();
281283
server.listen(sock);
282284
assert.throws(
@@ -596,8 +598,10 @@ if (!isWindows) {
596598

597599
// It returns an error if attempt is made to copy socket.
598600
if (!isWindows) {
601+
const src = nextdir();
602+
mkdirSync(src);
599603
const dest = nextdir();
600-
const sock = `${process.pid}.sock`;
604+
const sock = join(src, `${process.pid}.sock`);
601605
const server = net.createServer();
602606
server.listen(sock);
603607
cp(sock, dest, mustCall((err) => {

0 commit comments

Comments
 (0)