diff --git a/scripts/run-vitest-stable.mjs b/scripts/run-vitest-stable.mjs index 3abc0ad62e3..f0404fae69b 100644 --- a/scripts/run-vitest-stable.mjs +++ b/scripts/run-vitest-stable.mjs @@ -320,6 +320,8 @@ function runVitest(args, label, testShard = null) { const env = { ...process.env, NODE_ENV: "test", + PAPERCLIP_TEST_HOST_HOME: process.env.PAPERCLIP_TEST_HOST_HOME + ?? (process.env.PAPERCLIP_HOME?.trim() || path.join(os.homedir(), ".paperclip")), PAPERCLIP_HOME: path.join(testRoot, "h"), // Config discovery otherwise prefers the checkout's .paperclip/config.json // over PAPERCLIP_HOME, importing preview scheduling policy into unit tests. diff --git a/server/src/__tests__/setup-supertest.ts b/server/src/__tests__/setup-supertest.ts index 0fa086fe29b..9c7db2179d4 100644 --- a/server/src/__tests__/setup-supertest.ts +++ b/server/src/__tests__/setup-supertest.ts @@ -21,6 +21,9 @@ type SupertestTestConstructor = { }; }; +// Keep the original home available only for read-only host port-lease checks. +process.env.PAPERCLIP_TEST_HOST_HOME ??= process.env.PAPERCLIP_HOME?.trim() || path.join(os.homedir(), ".paperclip"); + // Receipt-spool recovery must never scan a developer's instance during tests. const paperclipTestHome = fs.mkdtempSync(path.join(os.tmpdir(), "paperclip-vitest-home-")); process.env.PAPERCLIP_HOME = paperclipTestHome; diff --git a/server/src/__tests__/workspace-runtime-exposure-reservation.test.ts b/server/src/__tests__/workspace-runtime-exposure-reservation.test.ts index 08615ec352e..ff08db371ff 100644 --- a/server/src/__tests__/workspace-runtime-exposure-reservation.test.ts +++ b/server/src/__tests__/workspace-runtime-exposure-reservation.test.ts @@ -101,7 +101,9 @@ let NEXT_HMR_PORT: number; * must be read before that happens. Mirrors the default in * `resolvePaperclipHomeDir`. */ -const REAL_PAPERCLIP_HOME = process.env.PAPERCLIP_HOME?.trim() || path.join(os.homedir(), ".paperclip"); +const REAL_PAPERCLIP_HOME = process.env.PAPERCLIP_TEST_HOST_HOME?.trim() + || process.env.PAPERCLIP_HOME?.trim() + || path.join(os.homedir(), ".paperclip"); /** * Every port a local Paperclip instance's on-disk service registry currently