From 28f64113e7727ad83881838f589b6795542e6c96 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Tue, 20 Oct 2026 14:24:23 +0800 Subject: [PATCH] test(core): resolve startup fixture paths through symlinks Canonicalize temporary fixture directories before matching build inputs and locating staged updates. Compare the child working directory with its real path so startup tests also pass when the default temporary directory is a symlink. --- packages/core/tests/update-entry.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/core/tests/update-entry.test.ts b/packages/core/tests/update-entry.test.ts index f14135c7..95cf43f6 100644 --- a/packages/core/tests/update-entry.test.ts +++ b/packages/core/tests/update-entry.test.ts @@ -1,5 +1,5 @@ import { spawn } from 'node:child_process'; -import { cp, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'; +import { cp, mkdtemp, readFile, realpath, rm, writeFile } from 'node:fs/promises'; import { builtinModules } from 'node:module'; import os from 'node:os'; import path from 'node:path'; @@ -14,7 +14,8 @@ let root: string; let staging: string; beforeAll(async () => { - compiled = await mkdtemp(path.join(os.tmpdir(), 'snowluma-entry-build-')); + // Module resolution uses canonical paths, including when the temp directory is a symlink. + compiled = await realpath(await mkdtemp(path.join(os.tmpdir(), 'snowluma-entry-build-'))); const loaded = await loadConfigFromFile( { command: 'build', mode: 'production' }, fileURLToPath(new URL('../vite.config.ts', import.meta.url)), @@ -114,7 +115,7 @@ afterAll(async () => { await rm(compiled, { recursive: true, force: true }); }); beforeEach(async () => { - root = await mkdtemp(path.join(os.tmpdir(), 'snowluma-entry-test-')); + root = await realpath(await mkdtemp(path.join(os.tmpdir(), 'snowluma-entry-test-'))); staging = await updateDirectory(root); await releaseFixture(root, '1.0.0'); await cp(path.join(compiled, '1.0.0/index.mjs'), path.join(root, 'index.mjs')); @@ -158,7 +159,7 @@ describe('packaged startup', () => { expect(JSON.parse(result.output)).toEqual({ version: '1.0.0', node: process.execPath, - cwd: os.tmpdir(), + cwd: await realpath(os.tmpdir()), args: ['value with spaces'], oldAlive: false, });