Drop Deno from the agents and spawn child processes directly
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import process from "node:process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { expect, test } from "vite-plus/test";
|
||||
|
||||
import { output } from "../src/command.ts";
|
||||
|
||||
// Each phase runs as `node src/<phase>.ts` with no build step. Node loads the
|
||||
// whole import graph, stripping types, before the phase reads its first
|
||||
// variable, so failing on that variable proves every module loads.
|
||||
@@ -14,14 +13,13 @@ const PHASES: [phase: string, firstVariable: string][] = [
|
||||
["post", "BOT_AGENTS_MANIFEST"],
|
||||
];
|
||||
|
||||
test.each(PHASES)("Node loads the %s phase", async (phase, firstVariable) => {
|
||||
test.each(PHASES)("Node loads the %s phase", (phase, firstVariable) => {
|
||||
const path = fileURLToPath(new URL(`../src/${phase}.ts`, import.meta.url));
|
||||
const result = await output(process.execPath, {
|
||||
args: [path],
|
||||
const result = spawnSync(process.execPath, [path], {
|
||||
env: { PATH: process.env.PATH ?? "" },
|
||||
clearEnv: true,
|
||||
stdin: "null",
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
encoding: "utf8",
|
||||
});
|
||||
expect(result.success).toBe(false);
|
||||
expect(new TextDecoder().decode(result.stderr)).toContain(`${firstVariable} is not set`);
|
||||
expect(result.status).not.toBe(0);
|
||||
expect(result.stderr).toContain(`${firstVariable} is not set`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user