mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
test(wizard): restore stdin TTY state (#113345)
This commit is contained in:
committed by
GitHub
parent
05e534eae5
commit
e257683390
@@ -1,5 +1,5 @@
|
||||
// Post-install migration tests cover migration prompts and command guidance.
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createWizardPrompter } from "../../test/helpers/wizard-prompter.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { createNonExitingRuntime } from "../runtime.js";
|
||||
@@ -42,6 +42,8 @@ vi.mock("../commands/migrate.js", () => ({ migrateDefaultCommand }));
|
||||
|
||||
import { offerPostInstallMigrations } from "./setup.post-install-migration.js";
|
||||
|
||||
const originalStdinIsTTYDescriptor = Object.getOwnPropertyDescriptor(process.stdin, "isTTY");
|
||||
|
||||
type ProviderMock = {
|
||||
id: string;
|
||||
label: string;
|
||||
@@ -110,6 +112,20 @@ describe("offerPostInstallMigrations", () => {
|
||||
setTTY(true);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (originalStdinIsTTYDescriptor) {
|
||||
Object.defineProperty(process.stdin, "isTTY", originalStdinIsTTYDescriptor);
|
||||
} else {
|
||||
delete (process.stdin as Partial<typeof process.stdin>).isTTY;
|
||||
}
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
expect(Object.getOwnPropertyDescriptor(process.stdin, "isTTY")).toEqual(
|
||||
originalStdinIsTTYDescriptor,
|
||||
);
|
||||
});
|
||||
|
||||
it("returns early when no plugins were installed in this onboarding step", async () => {
|
||||
const config = { plugins: { entries: { codex: { enabled: true } } } } as OpenClawConfig;
|
||||
const result = await offerPostInstallMigrations(
|
||||
|
||||
Reference in New Issue
Block a user