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

+21
View File
@@ -0,0 +1,21 @@
import { mkdtemp, realpath } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
/**
* Create a temporary directory for a test fixture, resolved to its physical
* path.
*
* The system temp directory is reached through a symlink on macOS
* (`/var` -> `/private/var`, `/tmp` -> `/private/tmp`). A test that gives the
* logical path to something that reports paths back — a launched process's
* working directory, a bundler's project root — then compares two spellings of
* the same directory and fails. Resolving the root once, here, keeps both sides
* on the physical path.
*
* @param {string} prefix - Directory name prefix, e.g. `gev-preview-`.
* @returns {Promise<string>} The fixture root, with no symlinked component.
*/
export async function makeFixtureRoot(prefix) {
return realpath(await mkdtemp(path.join(tmpdir(), prefix)));
}