{"draft":null,"from":41,"to":42,"files":[{"path":"client/test/launch.test.ts","added":39,"removed":2,"diff":"--- a/client/test/launch.test.ts\n+++ b/client/test/launch.test.ts\n@@ -3,16 +3,31 @@\n \n import assert from \"node:assert/strict\";\n import { execFileSync, spawnSync } from \"node:child_process\";\n-import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from \"node:fs\";\n+import {\n+\tcopyFileSync,\n+\texistsSync,\n+\tmkdirSync,\n+\tmkdtempSync,\n+\treaddirSync,\n+\treadFileSync,\n+\trmSync,\n+\tutimesSync,\n+\twriteFileSync,\n+} from \"node:fs\";\n import { tmpdir } from \"node:os\";\n import { join } from \"node:path\";\n-import { describe, it } from \"node:test\";\n+import { after, describe, it } from \"node:test\";\n \n const LAUNCH = new URL(\"../launch.mjs\", import.meta.url);\n+const roots: string[] = [];\n+after(() => {\n+\tfor (const root of roots) rmSync(root, { recursive: true, force: true });\n+});\n \n /** A checkout on main with one commit, launch.mjs and a stand-in client/abso.ts that names itself. */\n function checkout(): { repo: string; home: string; head: string } {\n \tconst root = mkdtempSync(join(tmpdir(), \"abso-launch-\"));\n+\troots.push(root);\n \tconst repo = join(root, \"repo\");\n \tconst home = join(root, \"home\");\n \tmkdirSync(join(repo, \"client\"), { recursive: true });\n@@ -127,6 +142,28 @@\n \t\tassert.equal(existsSync(lock), true);\n \t});\n \n+\tit(\"takes over a lock a dead run left behind, and removes it after\", () => {\n+\t\tconst c = checkout();\n+\t\tconst lock = join(c.home, \".abso\", \"client-update.lock\");\n+\t\tmkdirSync(lock);\n+\t\tconst old = new Date(Date.now() - 11 * 60 * 1000);\n+\t\tutimesSync(lock, old, old);\n+\t\tassert.equal(launch(c, [], { ABSO_LAUNCH_UPDATE: \"1\" }).status, 0);\n+\t\tassert.deepEqual(\n+\t\t\treaddirSync(join(c.home, \".abso\")).filter((f) => f.includes(\"lock\")),\n+\t\t\t[],\n+\t\t);\n+\t});\n+\n+\tit(\"reads the commit in a git worktree, where .git is a file\", () => {\n+\t\tconst c = checkout();\n+\t\tconst wt = join(c.repo, \"..\", \"wt\");\n+\t\texecFileSync(\"git\", [\"-C\", c.repo, \"worktree\", \"add\", \"-q\", \"--detach\", wt, \"HEAD\"]);\n+\t\tbundle(wt, NAMES_ITSELF, c.head);\n+\t\tconst r = launch({ repo: wt, home: c.home }, [\"status\"]);\n+\t\tassert.match(r.stdout, /^bundle /);\n+\t});\n+\n \tit(\"keeps the background step quiet when it can't fetch or build\", () => {\n \t\tconst c = checkout();\n \t\tconst r = launch(c, [], { ABSO_LAUNCH_UPDATE: \"1\" });"}],"unmatched":[]}