build: add biome formatter and linter

This commit is contained in:
2026-03-23 08:17:27 +05:30
parent 068db04355
commit 7a164c705c
21 changed files with 1620 additions and 510 deletions
+24 -5
View File
@@ -1,9 +1,20 @@
import { expect, test, mock, beforeEach, afterEach, describe, spyOn } from "bun:test";
import {
afterEach,
beforeEach,
describe,
expect,
mock,
spyOn,
test,
} from "bun:test";
import * as os from "node:os";
import { closeMultiModel } from "../src/core/close";
let originalBun$: typeof Bun.$ = (globalThis as any).Bun?.$;
let mockCommandResponses: Record<string, { ok: boolean; stdout: string; stderr: string }> = {};
const originalBun$: typeof Bun.$ = (globalThis as any).Bun?.$;
let mockCommandResponses: Record<
string,
{ ok: boolean; stdout: string; stderr: string }
> = {};
let executedCommands: string[] = [];
function setupMockBun$() {
@@ -15,7 +26,11 @@ function setupMockBun$() {
if (cmd === "git worktree list --porcelain") {
throw new Error("unexpected error");
}
const response = mockCommandResponses[cmd] ?? { ok: true, stdout: "", stderr: "" };
const response = mockCommandResponses[cmd] ?? {
ok: true,
stdout: "",
stderr: "",
};
return {
quiet: () => ({
nothrow: async () => ({
@@ -46,7 +61,11 @@ describe("closeMultiModel unexpected error handling", () => {
});
test("catches thrown error and returns failure", async () => {
const result = await closeMultiModel({ sessionName: "any-session", cleanupWorktrees: false, force: false });
const result = await closeMultiModel({
sessionName: "any-session",
cleanupWorktrees: false,
force: false,
});
expect(result.success).toBe(false);
expect(result.error).toContain("unexpected error");
});