chore(vendor): import pi 0.85.1
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: d981de1229ef899957bbe968bc8dcda02a21f477
This commit is contained in:
1 parent
5ebc7018c3
commit
4def357d09
1669 files changed
+397627
No files matched your search
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
import { Container } from "@earendil-works/pi-tui";
|
||||
import { beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import type { AgentSessionRuntimeDiagnostic } from "../../../src/core/agent-session-services.ts";
|
||||
import { InteractiveMode } from "../../../src/modes/interactive/interactive-mode.ts";
|
||||
import { initTheme } from "../../../src/modes/interactive/theme/theme.ts";
|
||||
import { createHarness } from "../harness.ts";
|
||||
|
||||
function render(container: Container): string {
|
||||
return container.children.flatMap((child) => child.render(120)).join("\n");
|
||||
}
|
||||
|
||||
describe("issue #7829 invalid settings warning", () => {
|
||||
beforeAll(() => initTheme("dark"));
|
||||
|
||||
it("renders startup diagnostics inside the transcript", async () => {
|
||||
const harness = await createHarness();
|
||||
const previousOffline = process.env.PI_OFFLINE;
|
||||
process.env.PI_OFFLINE = "1";
|
||||
try {
|
||||
const chatContainer = new Container();
|
||||
const startupDiagnostics: AgentSessionRuntimeDiagnostic[] = [
|
||||
{
|
||||
type: "warning",
|
||||
message: "Invalid settings file /tmp/settings.json: malformed JSON",
|
||||
},
|
||||
];
|
||||
const context = {
|
||||
init: vi.fn(async () => {}),
|
||||
options: { startupDiagnostics },
|
||||
chatContainer,
|
||||
outputPad: 1,
|
||||
ui: { requestRender: vi.fn() },
|
||||
version: "test",
|
||||
showWarning: (InteractiveMode.prototype as unknown as { showWarning(message: string): void }).showWarning,
|
||||
session: harness.session,
|
||||
checkForPackageUpdates: vi.fn().mockResolvedValue([]),
|
||||
checkTmuxKeyboardSetup: vi.fn().mockResolvedValue(undefined),
|
||||
maybeWarnAboutAnthropicSubscriptionAuth: vi.fn(),
|
||||
getUserInput: vi.fn(() => new Promise<string>(() => {})),
|
||||
};
|
||||
const run = (InteractiveMode.prototype as unknown as { run(this: typeof context): Promise<void> }).run;
|
||||
|
||||
void run.call(context);
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(render(chatContainer)).toContain(
|
||||
"Warning: Invalid settings file /tmp/settings.json: malformed JSON",
|
||||
);
|
||||
});
|
||||
} finally {
|
||||
if (previousOffline === undefined) delete process.env.PI_OFFLINE;
|
||||
else process.env.PI_OFFLINE = previousOffline;
|
||||
harness.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user