Просмотр исходного кода

fix(cli): fix CI test failures blocking v1.2.0 release

- Guard browser.unref() call in studio command — mock spawn objects
  in test environment don't have unref, causing TypeError
- Fix cli-integration test isolation: clean up harbor book and session
  file after interact tests so book list/status tests find empty state
- Change interact --book test to use /books intent instead of
  explain status which requires LLM connectivity
Ma 7 месяцев назад
Родитель
Сommit
a7129b540d

+ 5 - 1
packages/cli/src/__tests__/cli-integration.test.ts

@@ -229,10 +229,14 @@ describe("CLI integration", () => {
         updatedAt: "2026-04-07T00:00:00.000Z",
       });
 
-      const output = run(["interact", "--json", "--book", "harbor", "--message", "explain status"]);
+      const output = run(["interact", "--json", "--book", "harbor", "--message", "/books"]);
       const data = JSON.parse(output);
 
       expect(data.session.activeBookId).toBe("harbor");
+
+      // Clean up harbor book and session so subsequent tests start with an empty project
+      await rm(join(projectDir, "books", "harbor"), { recursive: true, force: true });
+      await rm(join(projectDir, ".inkos-session.json"), { force: true }).catch(() => {});
     });
   });
 

+ 3 - 1
packages/cli/src/commands/studio.ts

@@ -138,7 +138,9 @@ export const studioCommand = new Command("studio")
     browser.on("error", () => {
       // Best effort only — server startup should not fail just because browser open failed.
     });
-    browser.unref();
+    if (typeof browser.unref === "function") {
+      browser.unref();
+    }
 
     child.on("exit", (code) => {
       process.exit(code ?? 0);