From e40bff37d2d98d4b413c7e03b04c662f34affe71 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sun, 1 Nov 2026 20:47:51 -0800 Subject: [PATCH] test(traffic): keep the timing test's Vite cache out of the package tree The traffic timing test starts a Vite server rooted at the package, which wrote its dependency cache to node_modules/.vite and kept writing after the server closed. A host running Core's suite then finds files inside Core and its check refuses them. The server now uses a temporary cache directory, removed afterwards, and skips dependency discovery, which the SSR-loaded modules never need. The HUD place-lookup changelog note credits its PR, #1459. --- changelog.d/1459-hud-place-lookups.md | 2 +- src/data/trafficTiming.test.mjs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/changelog.d/1459-hud-place-lookups.md b/changelog.d/1459-hud-place-lookups.md index b0ff71f09..023e2f2e6 100644 --- a/changelog.d/1459-hud-place-lookups.md +++ b/changelog.d/1459-hud-place-lookups.md @@ -2,4 +2,4 @@ looks up place names when no OpenAI key is configured, reverse-geocodes at most two points instead of up to four, and looks up again only once the view shows a different area, not after every small pan, so a small pan no longer - asks OpenAI for a new summary either (samehkhamis, #0000). + asks OpenAI for a new summary either (samehkhamis, #1459). diff --git a/src/data/trafficTiming.test.mjs b/src/data/trafficTiming.test.mjs index 3cadbfb81..808fb1300 100644 --- a/src/data/trafficTiming.test.mjs +++ b/src/data/trafficTiming.test.mjs @@ -1,5 +1,8 @@ import assert from 'node:assert/strict'; import { readLayerSource } from '../testSupport/readLayerSource.mjs'; +import { mkdtempSync, rmSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import path from 'node:path'; import test from 'node:test'; import { fileURLToPath } from 'node:url'; @@ -136,6 +139,7 @@ test('traffic timing pairs real ordering to the scheduling change and guards re- const timeouts = new Map(); let timerId = 0; let server; + const cacheDir = mkdtempSync(path.join(tmpdir(), 'gev-traffic-timing-vite-')); let trafficLayer; let viewer; @@ -159,6 +163,12 @@ test('traffic timing pairs real ordering to the scheduling change and guards re- }; server = await createServer({ root: fileURLToPath(new URL('../..', import.meta.url)), + // Its own optimizer cache, not node_modules/.vite in the package tree: + // a host running Core's suite refuses files inside Core. + cacheDir, + // The test loads modules over SSR; the browser dependency optimizer would + // keep writing its cache after the server closes. + optimizeDeps: { noDiscovery: true, include: [] }, configFile: false, appType: 'custom', logLevel: 'silent', @@ -328,6 +338,7 @@ test('traffic timing pairs real ordering to the scheduling change and guards re- console.warn = originalWarn; performance.clearMarks(); performance.clearMeasures(); + rmSync(cacheDir, { recursive: true, force: true, maxRetries: 3 }); } });