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(() => {
@ -23,13 +24,12 @@ function createTempDir(): string {
async function runCli(args: string[], cwd: string, agentDir: string): Promise<{ code: number | null; stderr: string }> {
let stderr = "";
const code = await new Promise<number | null>((resolvePromise, reject) => {
const child = spawn(process.execPath, [cliPath, ...args], {
const child = spawn(process.execPath, ["--import", sourceResolverPath, cliPath, ...args], {
cwd,
env: {
...process.env,
[ENV_AGENT_DIR]: agentDir,
PI_OFFLINE: "1",
TSX_TSCONFIG_PATH: resolve(__dirname, "../../../tsconfig.json"),
},
stdio: ["ignore", "ignore", "pipe"],
});