fix(test): resolve the macOS temp root through its symlink in the launcher and preview tests (#501)

Supersedes #301 by @VassagoDevteam, ported onto the current component layout with fixes from review.

Verified before merge: format, package boundaries, unit suite, build, and the browser tracking suite; a browser harness for the change where one applies; adversarial review applied.

Co-authored-by: Vassago DevTeam <[email protected]>
This commit is contained in:
Bilawal SidhuandVassago DevTeam authored and GitHub committed 2026-09-14 18:55:24 -05:00
1 parent c56ef52ce3
commit a1d0a42450
7 files changed
+99 -5

No files matched your search

+5 -3
View File
@@ -1,11 +1,11 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { mkdtemp, writeFile, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { writeFile, rm } from 'node:fs/promises';
import path from 'node:path';
import { build, createServer, preview } from 'vite';
import { localProviderPlugins } from '../../server/providers/local.js';
import { apiNotFoundPlugin } from '../../server/standalone/api-not-found.js';
import { makeFixtureRoot } from './fixtureRoot.mjs';
test('data providers have both hooks; credential editing stays development-only', () => {
for (const plugin of localProviderPlugins()) {
@@ -27,7 +27,9 @@ test('data providers have both hooks; credential editing stays development-only'
});
test('real dev and built-preview servers serve provider JSON and terminate unknown APIs', async (t) => {
const root = await mkdtemp(path.join(tmpdir(), 'gev-preview-'));
// Physical path: Vite's root and the files written under it must agree on one
// spelling, and macOS reaches the temp directory through a symlink.
const root = await makeFixtureRoot('gev-preview-');
t.after(() => rm(root, { recursive: true, force: true }));
await writeFile(
path.join(root, 'index.html'),