Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/integration/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test";
import { existsSync, mkdirSync, readdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";

import { initProject } from "../../src/helpers/init-project";
import { safeRmSync } from "../test-utils";
import { runCli, createTempProject } from "./cli-harness";

Expand Down Expand Up @@ -80,11 +81,13 @@ describe("init integration", () => {
});

test("init is idempotent — second run succeeds and does not duplicate example ADR", async () => {
await runCli(["init", "--editor", "claude"], tempDir, isolatedEnv());
// First init via direct call (avoids a second subprocess cold-start on Windows CI)
await initProject(tempDir, { editor: "claude" });

const adrsDir = join(tempDir, ".archgate", "adrs");
const adrsBefore = readdirSync(adrsDir).filter((f) => f.endsWith(".md"));

// Second init via CLI — the actual idempotency assertion
const result = await runCli(
["init", "--editor", "claude"],
tempDir,
Expand Down
Loading