* Fix desktop CLI passthrough tty handling * Fix desktop daemon manager test drift * Update daemon stop test after main merge * test(cli): isolate npx cache per CLI test
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { runDesktopStartup } from "./desktop-startup";
|
|
|
|
describe("desktop startup", () => {
|
|
it("runs CLI passthrough before GUI login-shell env inheritance", async () => {
|
|
const calls: string[] = [];
|
|
await runDesktopStartup({
|
|
hasPendingOpenProjectPath: false,
|
|
runCliPassthroughIfRequested: vi.fn(async () => {
|
|
calls.push("cli");
|
|
return true;
|
|
}),
|
|
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
|
|
bootstrapGui: vi.fn(async () => {
|
|
calls.push("gui");
|
|
}),
|
|
});
|
|
|
|
expect(calls).toEqual(["cli"]);
|
|
});
|
|
|
|
it("keeps login-shell env inheritance on normal GUI startup", async () => {
|
|
const calls: string[] = [];
|
|
await runDesktopStartup({
|
|
hasPendingOpenProjectPath: false,
|
|
runCliPassthroughIfRequested: vi.fn(async () => {
|
|
calls.push("cli");
|
|
return false;
|
|
}),
|
|
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
|
|
bootstrapGui: vi.fn(async () => {
|
|
calls.push("gui");
|
|
}),
|
|
});
|
|
|
|
expect(calls).toEqual(["cli", "env", "gui"]);
|
|
});
|
|
|
|
it("does not route open-project launches through CLI passthrough", async () => {
|
|
const runCliPassthroughIfRequested = vi.fn(async () => true);
|
|
const calls: string[] = [];
|
|
|
|
await runDesktopStartup({
|
|
hasPendingOpenProjectPath: true,
|
|
runCliPassthroughIfRequested,
|
|
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
|
|
bootstrapGui: vi.fn(async () => {
|
|
calls.push("gui");
|
|
}),
|
|
});
|
|
|
|
expect(runCliPassthroughIfRequested).not.toHaveBeenCalled();
|
|
expect(calls).toEqual(["env", "gui"]);
|
|
});
|
|
});
|