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.
This commit is contained in:
Sameh Khamis committed 2026-11-01 22:47:05 -08:00
1 parent e8d5e8793e
commit e40bff37d2
2 files changed
+12 -1

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@
looks up place names when no OpenAI key is configured, reverse-geocodes at 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 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 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).
+11
View File
@@ -1,5 +1,8 @@
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import { readLayerSource } from '../testSupport/readLayerSource.mjs'; 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 test from 'node:test';
import { fileURLToPath } from 'node:url'; 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(); const timeouts = new Map();
let timerId = 0; let timerId = 0;
let server; let server;
const cacheDir = mkdtempSync(path.join(tmpdir(), 'gev-traffic-timing-vite-'));
let trafficLayer; let trafficLayer;
let viewer; let viewer;
@@ -159,6 +163,12 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
}; };
server = await createServer({ server = await createServer({
root: fileURLToPath(new URL('../..', import.meta.url)), 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, configFile: false,
appType: 'custom', appType: 'custom',
logLevel: 'silent', logLevel: 'silent',
@@ -328,6 +338,7 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
console.warn = originalWarn; console.warn = originalWarn;
performance.clearMarks(); performance.clearMarks();
performance.clearMeasures(); performance.clearMeasures();
rmSync(cacheDir, { recursive: true, force: true, maxRetries: 3 });
} }
}); });