From 1ed2ea670d7647bceef003534067196b9b9084f3 Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Mon, 27 Feb 2023 18:52:28 +0800 Subject: [PATCH] test: move socket from CWD to temporary directory --- 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) => {