fix: resolve workspace source dependencies in tests

This commit is contained in:
Armin Ronacher 2026-09-01 17:50:33 +02:00
parent c30cda1d43
commit 6ee906d3d2
5 changed files with 18 additions and 10 deletions

View file

@ -6,6 +6,7 @@ import { afterEach, describe, expect, it } from "vitest";
import { ENV_AGENT_DIR } from "../src/config.ts";
const cliPath = resolve(__dirname, "../src/cli.ts");
const sourceResolverPath = resolve(__dirname, "../src/experimental/source-resolver.ts");
const tempDirs: string[] = [];
afterEach(() => {
@ -65,13 +66,12 @@ function readSessionInfoNames(sessionFile: string): string[] {
async function runCli(args: string[], dirs: CliDirs): Promise<CliResult> {
let stderr = "";
const child = spawn(process.execPath, [cliPath, ...args], {
const child = spawn(process.execPath, ["--import", sourceResolverPath, cliPath, ...args], {
cwd: dirs.projectDir,
env: {
...process.env,
[ENV_AGENT_DIR]: dirs.agentDir,
PI_OFFLINE: "1",
TSX_TSCONFIG_PATH: resolve(__dirname, "../../../tsconfig.json"),
},
stdio: ["ignore", "ignore", "pipe"],
});