Fix desktop CLI passthrough tty handling (#791)
* 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
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
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"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user