// src/__tests__/pi-invocation.test.ts import * as fs from "node:fs"; import * as os from "node:os"; import * as path from "node:path"; import { afterEach,describe, expect, it } from "vitest"; import { getPiInvocation } from "../pi-invocation.ts"; describe("getPiInvocation", () => { const originalArgv = process.argv; const originalExecPath = process.execPath; let tmpScript: string; afterEach(() => { Object.defineProperty(process, "argv", { value: originalArgv, configurable: true }); Object.defineProperty(process, "execPath", { value: originalExecPath, configurable: true }); if (tmpScript && fs.existsSync(tmpScript)) fs.unlinkSync(tmpScript); }); it("真实脚本路径存在 → node