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) => {