From 7fe6acdf8b1c2b3ec1234dcef93f46b85eaa8b73 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Fri, 11 Sep 2026 11:39:14 +0800 Subject: [PATCH] test(desktop): canonicalize pnpm fixture paths on Windows --- apps/desktop/tests/plugin-pnpm.spec.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/desktop/tests/plugin-pnpm.spec.ts b/apps/desktop/tests/plugin-pnpm.spec.ts index 9505182c69..34e08eca4e 100644 --- a/apps/desktop/tests/plugin-pnpm.spec.ts +++ b/apps/desktop/tests/plugin-pnpm.spec.ts @@ -13,7 +13,8 @@ import { resolveDesktopPaths } from '../src/paths.ts' import { runtimeFixture, writePackage } from './runtime-fixture.ts' it('installs a real pnpm graph and executes scripts approved by user configuration', async () => { - const root = realpathSync(mkdtempSync(join(tmpdir(), 'desktop-real-pnpm-'))) + // pnpm resolves its cwd natively; use the same spelling for Windows 8.3 temp paths. + const root = realpathSync.native(mkdtempSync(join(tmpdir(), 'desktop-real-pnpm-'))) const server = createServer() const archives = new Map() try { @@ -59,7 +60,14 @@ it('installs a real pnpm graph and executes scripts approved by user configurati writeFileSync(join(manager.paths.profile, 'pnpm-workspace.yaml'), `packages:\n - .\nnodeLinker: hoisted\nautoInstallPeers: false\nstoreDir: ${JSON.stringify(join(root, 'store'))}\nallowBuilds:\n fixture-script-dependency: true\n`) await manager.mutate({ type: 'plugin-add', spec: 'fixture-plugin@1.0.0' }, hooks) expect(manager.listPlugins()).toEqual([{ name: 'fixture-plugin', version: '1.0.0', enabled: true }]) - const built = JSON.parse(readFileSync(join(manager.paths.profile, 'node_modules/fixture-script-dependency/built.json'), 'utf8')) as { node: string } + const builtPath = join(manager.paths.profile, 'node_modules/fixture-script-dependency/built.json') + if (!existsSync(builtPath)) { + const config = (name: string): string => execFileSync(process.execPath, [pnpm, 'config', 'get', name], { + cwd: manager.paths.profile, encoding: 'utf8', + }).trim() + throw new Error(`pnpm install script produced no output: ignoreScripts=${config('ignoreScripts')}, allowBuilds=${config('allowBuilds')}`) + } + const built = JSON.parse(readFileSync(builtPath, 'utf8')) as { node: string } expect(realpathSync(built.node)).toBe(realpathSync(process.execPath)) const entry = join(dsh, 'identity.mjs') writeFileSync(entry, `import {identity} from '@deepseek-ai/cordis'; import {identity as plugin} from ${JSON.stringify(pathToFileURL(join(manager.paths.profile, 'node_modules/fixture-plugin/index.js')).href)}; console.log(identity === plugin)`) @@ -81,7 +89,7 @@ it('installs a real pnpm graph and executes scripts approved by user configurati }, 30_000) it.each(['directory', 'file', 'tarball', 'plain'] as const)('installs a %s source through pnpm', async (source) => { - const root = realpathSync(mkdtempSync(join(tmpdir(), 'desktop-local-pnpm-'))) + const root = realpathSync.native(mkdtempSync(join(tmpdir(), 'desktop-local-pnpm-'))) try { const dsh = join(root, 'dsh') runtimeFixture(dsh)