From 563be01292a84bc244a6e725b10b151bb7b7fab0 Mon Sep 17 00:00:00 2001 From: Aviv Keller Date: Mon, 12 May 2025 14:43:02 -0400 Subject: [PATCH] test: allow `tmpDir.path` to be modified PR-URL: https://github.com/nodejs/node/pull/58173 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/common/tmpdir.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/common/tmpdir.js b/test/common/tmpdir.js index 4ff45b7635e..d56a7331105 100644 --- a/test/common/tmpdir.js +++ b/test/common/tmpdir.js @@ -39,7 +39,7 @@ const testRoot = process.env.NODE_TEST_DIR ? // gets tools to ignore it by default or by simple rules, especially eslint. const tmpdirName = '.tmp.' + (process.env.TEST_SERIAL_ID || process.env.TEST_THREAD_ID || '0'); -const tmpPath = path.join(testRoot, tmpdirName); +let tmpPath = path.join(testRoot, tmpdirName); let firstRefresh = true; function refresh(useSpawn = false) { @@ -100,7 +100,13 @@ function fileURL(...paths) { module.exports = { fileURL, hasEnoughSpace, - path: tmpPath, refresh, resolve, + + get path() { + return tmpPath; + }, + set path(newPath) { + tmpPath = path.resolve(newPath); + }, };