diff --git a/fix-3962-tsconfig-imports-4 b/fix-3962-tsconfig-imports-4 new file mode 160000 index 0000000000..f355f51c35 --- /dev/null +++ b/fix-3962-tsconfig-imports-4 @@ -0,0 +1 @@ +Subproject commit f355f51c35f1dc6dbfe7e81044190e13372a37dc diff --git a/otto-cli/b0156-profile-ts-test-2026-05-16 b/otto-cli/b0156-profile-ts-test-2026-05-16 new file mode 160000 index 0000000000..f355f51c35 --- /dev/null +++ b/otto-cli/b0156-profile-ts-test-2026-05-16 @@ -0,0 +1 @@ +Subproject commit f355f51c35f1dc6dbfe7e81044190e13372a37dc diff --git a/tools/profile.test.ts b/tools/profile.test.ts new file mode 100644 index 0000000000..6fa5dc0d6d --- /dev/null +++ b/tools/profile.test.ts @@ -0,0 +1,93 @@ +// profile.test.ts — smoke tests for the DBSP profiling helper CLI. +// +// Scope: VALIDATES CLI DISPATCH AND ARG-PARSING, NOT external tool +// invocations. The `counters` / `trace` / `gcdump` / `bench` / +// `coverage` / `install` branches shell out to `dotnet-counters`, +// `dotnet-trace`, etc., which are not guaranteed to be installed +// on every developer machine or CI runner. This suite covers only +// the help / unknown-command / missing-arg paths that exit early +// before any external process is launched. +// +// Closes one acceptance bullet for B-0156: "Each TS sibling has at +// least one `bun test` covering its primary entry path." + +import { describe, expect, test } from "bun:test"; +import { spawnSync } from "node:child_process"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const PROFILE_TS = resolve( + dirname(fileURLToPath(import.meta.url)), + "profile.ts", +); + +function runProfile(args: readonly string[]): { + status: number; + stdout: string; + stderr: string; +} { + const result = spawnSync("bun", [PROFILE_TS, ...args], { + encoding: "utf8", + timeout: 10_000, + }); + return { + status: result.status ?? -1, + stdout: result.stdout ?? "", + stderr: result.stderr ?? "", + }; +} + +describe("tools/profile.ts CLI dispatch", () => { + test("no args prints help and exits 0", () => { + const result = runProfile([]); + expect(result.status).toBe(0); + expect(result.stdout).toContain("DBSP profiling helper"); + }); + + test("--help exits 0 and prints help text", () => { + const result = runProfile(["--help"]); + expect(result.status).toBe(0); + expect(result.stdout).toContain("DBSP profiling helper"); + }); + + test("-h exits 0 and prints help text", () => { + const result = runProfile(["-h"]); + expect(result.status).toBe(0); + expect(result.stdout).toContain("DBSP profiling helper"); + }); + + test("help lists all canonical subcommands", () => { + const result = runProfile(["--help"]); + expect(result.status).toBe(0); + for (const cmd of ["install", "counters", "trace", "gcdump", "bench", "coverage"]) { + expect(result.stdout).toContain(cmd); + } + }); + + test("unknown command exits 64 (EX_USAGE) and prints help", () => { + const result = runProfile(["not-a-real-command"]); + expect(result.status).toBe(64); + expect(result.stdout).toContain("DBSP profiling helper"); + }); + + test("counters without pid exits 64 with usage on stderr", () => { + const result = runProfile(["counters"]); + expect(result.status).toBe(64); + expect(result.stderr).toContain("usage:"); + expect(result.stderr).toContain("counters"); + }); + + test("trace without pid exits 64 with usage on stderr", () => { + const result = runProfile(["trace"]); + expect(result.status).toBe(64); + expect(result.stderr).toContain("usage:"); + expect(result.stderr).toContain("trace"); + }); + + test("gcdump without pid exits 64 with usage on stderr", () => { + const result = runProfile(["gcdump"]); + expect(result.status).toBe(64); + expect(result.stderr).toContain("usage:"); + expect(result.stderr).toContain("gcdump"); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 3870b40455..3469657630 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,7 @@ "isolatedModules": true, "moduleDetection": "force", "skipLibCheck": true, - "types": ["bun"] + "types": ["bun", "bun-types"] }, "include": ["**/*.ts"], "exclude": [ diff --git a/zeta-lior-preserve-4649 b/zeta-lior-preserve-4649 new file mode 160000 index 0000000000..385ab1ffb4 --- /dev/null +++ b/zeta-lior-preserve-4649 @@ -0,0 +1 @@ +Subproject commit 385ab1ffb44e43af7bd564d090f28170e789717d diff --git a/zeta-lior-preserve-4650 b/zeta-lior-preserve-4650 new file mode 160000 index 0000000000..92510d6f24 --- /dev/null +++ b/zeta-lior-preserve-4650 @@ -0,0 +1 @@ +Subproject commit 92510d6f24b443cf1e341a556dd8fdc69893c193 diff --git a/zeta-lior-preserve-4651 b/zeta-lior-preserve-4651 new file mode 160000 index 0000000000..99d831dd10 --- /dev/null +++ b/zeta-lior-preserve-4651 @@ -0,0 +1 @@ +Subproject commit 99d831dd10f1d04526572e041517acf6afd1fc47 diff --git a/zeta-lior-preserve-4652 b/zeta-lior-preserve-4652 new file mode 160000 index 0000000000..b3605731dc --- /dev/null +++ b/zeta-lior-preserve-4652 @@ -0,0 +1 @@ +Subproject commit b3605731dc57d9a9db93a5919488533a16870dbb