Skip to content

Commit 3064c40

Browse files
la14-1spawn-qa-botclaude
authored
test: remove duplicate and theatrical tests (#2559)
- Consolidate 4 separate SPAWN_PROMPT/SPAWN_MODE env var tests in cmdrun-happy-path.test.ts into 2 tests. Each previously spawned a separate bash subprocess to check a single env var; the consolidated tests check both vars in one subprocess invocation, halving overhead. - Remove redundant KNOWN_FLAGS.has() assertions from steps-flag.test.ts. The findUnknownFlag() call already exercises the Set membership check — the extra .has() assertion was pure duplication. Also removes the now- unused KNOWN_FLAGS import. Co-authored-by: spawn-qa-bot <qa@openrouter.ai> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 515bc16 commit 3064c40

2 files changed

Lines changed: 18 additions & 38 deletions

File tree

packages/cli/src/__tests__/cmdrun-happy-path.test.ts

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -389,22 +389,14 @@ describe("cmdRun happy-path pipeline", () => {
389389
// ── Env var passing via runBash ───────────────────────────────────────────
390390

391391
describe("SPAWN_PROMPT and SPAWN_MODE env var passing", () => {
392-
it("should pass prompt to bash script via SPAWN_PROMPT env var", async () => {
393-
// Use a script that echoes the env var so we can verify it was set
394-
const echoScript = '#!/bin/bash\nset -eo pipefail\ntest "$SPAWN_PROMPT" = "Fix all bugs"';
395-
global.fetch = mockFetchForDownload({
396-
primaryOk: true,
397-
scriptContent: echoScript,
398-
});
399-
await loadManifest(true);
400-
401-
// If SPAWN_PROMPT is set correctly, the test command succeeds (exit 0)
402-
await cmdRun("claude", "sprite", "Fix all bugs");
403-
expect(processExitSpy).not.toHaveBeenCalled();
404-
});
405-
406-
it("should set SPAWN_MODE to non-interactive when prompt is provided", async () => {
407-
const checkScript = '#!/bin/bash\nset -eo pipefail\ntest "$SPAWN_MODE" = "non-interactive"';
392+
it("should set both SPAWN_PROMPT and SPAWN_MODE when prompt is provided", async () => {
393+
// Single script checks both vars — avoids two separate bash invocations
394+
const checkScript = [
395+
"#!/bin/bash",
396+
"set -eo pipefail",
397+
'test "$SPAWN_PROMPT" = "Fix all bugs"',
398+
'test "$SPAWN_MODE" = "non-interactive"',
399+
].join("\n");
408400
global.fetch = mockFetchForDownload({
409401
primaryOk: true,
410402
scriptContent: checkScript,
@@ -415,21 +407,14 @@ describe("cmdRun happy-path pipeline", () => {
415407
expect(processExitSpy).not.toHaveBeenCalled();
416408
});
417409

418-
it("should NOT set SPAWN_PROMPT when no prompt is provided", async () => {
419-
// This script fails if SPAWN_PROMPT is set (non-empty)
420-
const checkScript = '#!/bin/bash\nset -eo pipefail\ntest -z "${SPAWN_PROMPT:-}"';
421-
global.fetch = mockFetchForDownload({
422-
primaryOk: true,
423-
scriptContent: checkScript,
424-
});
425-
await loadManifest(true);
426-
427-
await cmdRun("claude", "sprite");
428-
expect(processExitSpy).not.toHaveBeenCalled();
429-
});
430-
431-
it("should NOT set SPAWN_MODE when no prompt is provided", async () => {
432-
const checkScript = '#!/bin/bash\nset -eo pipefail\ntest -z "${SPAWN_MODE:-}"';
410+
it("should NOT set SPAWN_PROMPT or SPAWN_MODE when no prompt is provided", async () => {
411+
// Single script verifies both vars are unset
412+
const checkScript = [
413+
"#!/bin/bash",
414+
"set -eo pipefail",
415+
'test -z "${SPAWN_PROMPT:-}"',
416+
'test -z "${SPAWN_MODE:-}"',
417+
].join("\n");
433418
global.fetch = mockFetchForDownload({
434419
primaryOk: true,
435420
scriptContent: checkScript,

packages/cli/src/__tests__/steps-flag.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
import { describe, expect, it } from "bun:test";
2-
import { findUnknownFlag, KNOWN_FLAGS } from "../flags";
2+
import { findUnknownFlag } from "../flags";
33
import { getAgentOptionalSteps, validateStepNames } from "../shared/agents";
44

55
describe("--steps and --config flags", () => {
6-
it("should recognize --steps as a known flag", () => {
7-
expect(KNOWN_FLAGS.has("--steps")).toBe(true);
6+
it("should recognize --steps and --config as known flags", () => {
87
expect(
98
findUnknownFlag([
109
"--steps",
1110
]),
1211
).toBeNull();
13-
});
14-
15-
it("should recognize --config as a known flag", () => {
16-
expect(KNOWN_FLAGS.has("--config")).toBe(true);
1712
expect(
1813
findUnknownFlag([
1914
"--config",

0 commit comments

Comments
 (0)