From b344e74bc1a4b1453c4aaa62b9032ce7c4ec15ef Mon Sep 17 00:00:00 2001 From: Livia Medeiros Date: Wed, 1 Mar 2023 20:06:39 +0900 Subject: [PATCH] test: move socket from CWD to temporary directory PR-URL: https://github.com/nodejs/node/pull/46863 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca --- test/parallel/test-fs-cp.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-cp.mjs b/test/parallel/test-fs-cp.mjs index c6ebb3944cecc9..c4d6c4b737e371 100644 --- a/test/parallel/test-fs-cp.mjs +++ b/test/parallel/test-fs-cp.mjs @@ -275,8 +275,10 @@ function nextdir() { // It throws an error if attempt is made to copy socket. if (!isWindows) { + const src = nextdir(); + mkdirSync(src); const dest = nextdir(); - const sock = `${process.pid}.sock`; + const sock = join(src, `${process.pid}.sock`); const server = net.createServer(); server.listen(sock); assert.throws( @@ -596,8 +598,10 @@ if (!isWindows) { // It returns an error if attempt is made to copy socket. if (!isWindows) { + const src = nextdir(); + mkdirSync(src); const dest = nextdir(); - const sock = `${process.pid}.sock`; + const sock = join(src, `${process.pid}.sock`); const server = net.createServer(); server.listen(sock); cp(sock, dest, mustCall((err) => {