@@ -0,0 +1,53 @@
1+import { expect, test } from "bun:test";
2+import { join } from "node:path";
3+
4+const REPO_ROOT = join(import.meta.dir, "..");
5+
6+async function packDryRun(): Promise<{
7+ exitCode: number;
8+ stdout: string;
9+ stderr: string;
10+}> {
11+ const proc = Bun.spawn(
12+ [process.execPath, "pm", "pack", "--dry-run", "--ignore-scripts"],
13+ {
14+ cwd: REPO_ROOT,
15+ stdin: "ignore",
16+ stdout: "pipe",
17+ stderr: "pipe",
18+ env: process.env,
19+ },
20+ );
21+
22+ const exitCode = await proc.exited;
23+ const stdout = await new Response(proc.stdout).text();
24+ const stderr = await new Response(proc.stderr).text();
25+
26+ return { exitCode, stdout, stderr };
27+}
28+
29+test("package.json bin points to a checked-in mc launcher", async () => {
30+ const pkg = (await Bun.file(join(REPO_ROOT, "package.json")).json()) as {
31+ bin?: Record<string, string>;
32+ };
33+
34+ expect(pkg.bin).toEqual({ mc: "bin/mc.ts" });
35+
36+ const launcher = pkg.bin?.mc;
37+ expect(launcher).toBe("bin/mc.ts");
38+ if (!launcher) {
39+ throw new Error("package.json bin.mc is missing");
40+ }
41+ expect(Bun.file(join(REPO_ROOT, launcher)).size).toBeGreaterThan(0);
42+});
43+
44+test("pack dry-run includes the mc launcher and runtime entrypoint", async () => {
45+ const result = await packDryRun();
46+
47+ expect(result.exitCode).toBe(0);
48+ expect(result.stderr).toBe("");
49+ expect(result.stdout).toContain("packed ");
50+ expect(result.stdout).toContain("bin/mc.ts");
51+ expect(result.stdout).toContain("src/index.ts");
52+ expect(result.stdout).not.toContain("src/package.test.ts");
53+});