diff --git a/just/npm.just b/just/npm.just index cedceda..6f8b09c 100644 --- a/just/npm.just +++ b/just/npm.just @@ -37,7 +37,7 @@ npm-test-trap-sandbox: npm test --prefix tools/trap-sandbox/ # Run Node-based tool integration tests. -npm-test-integration: npm-test-integration-mcp-bridge npm-test-integration-trap-sandbox +npm-test-integration: stage npm-test-integration-mcp-bridge npm-test-integration-trap-sandbox npm-test-integration-mcp-bridge: npm run test:integration --prefix tools/mcp-bridge diff --git a/tools/mcp-bridge/test-integration/harness.ts b/tools/mcp-bridge/test-integration/harness.ts index d4ed622..e3e906d 100644 --- a/tools/mcp-bridge/test-integration/harness.ts +++ b/tools/mcp-bridge/test-integration/harness.ts @@ -1,4 +1,5 @@ import { spawn } from "node:child_process"; +import { existsSync } from "node:fs"; import { mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { dirname, join } from "node:path"; @@ -142,10 +143,15 @@ export function startCraftos( args.push("--id", String(opts.computerId)); } if (opts.mountRepo) { + if (!existsSync(join(REPO_ROOT, ".stage/apis"))) { + throw new Error( + ".stage/ is missing — run `just stage` (or use `just test-integration`) before the integration tests.", + ); + } args.push( "--mount-ro", `/trapos=${REPO_ROOT}`, - "--mount-ro", `/apis=${join(REPO_ROOT, "apis")}`, - "--mount-ro", `/programs=${join(REPO_ROOT, "programs")}`, + "--mount-ro", `/apis=${join(REPO_ROOT, ".stage/apis")}`, + "--mount-ro", `/programs=${join(REPO_ROOT, ".stage/programs")}`, ); } if (process.platform === "darwin") { diff --git a/tools/trap-sandbox/test-integration/harness.ts b/tools/trap-sandbox/test-integration/harness.ts index 6da11d0..fc7ec7f 100644 --- a/tools/trap-sandbox/test-integration/harness.ts +++ b/tools/trap-sandbox/test-integration/harness.ts @@ -1,5 +1,6 @@ import { spawn } from "node:child_process"; import { createServer } from "node:http"; +import { existsSync } from "node:fs"; import { mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { dirname, join } from "node:path"; @@ -148,14 +149,19 @@ export function startCraftos( const dataDir = await mkdtemp(join(tmpdir(), "trap-sandbox-it-")); const watchdog = setTimeout(() => controller.abort(), timeoutMs); try { + if (!existsSync(join(REPO_ROOT, ".stage/apis"))) { + throw new Error( + ".stage/ is missing — run `just stage` (or use `just test-integration`) before the integration tests.", + ); + } const args: string[] = [ "--directory", dataDir, "--headless", "--mount-ro", `/staging=${LUA_DIR}`, "--mount-ro", `/trapos=${REPO_ROOT}`, - "--mount-ro", `/apis=${join(REPO_ROOT, "apis")}`, - "--mount-ro", `/servers=${join(REPO_ROOT, "servers")}`, - "--mount-ro", `/programs=${join(REPO_ROOT, "programs")}`, + "--mount-ro", `/apis=${join(REPO_ROOT, ".stage/apis")}`, + "--mount-ro", `/servers=${join(REPO_ROOT, ".stage/servers")}`, + "--mount-ro", `/programs=${join(REPO_ROOT, ".stage/programs")}`, ]; if (opts.computerId !== undefined) { args.push("--id", String(opts.computerId));