mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 02:20:38 +00:00
* style: update chat layout and spacing for improved UI consistency - Adjusted margin and padding for .chat-thread and .content--chat to enhance layout. - Consolidated CSS selectors for better readability and maintainability. - Introduced new test for log parsing functionality to ensure accurate message extraction. * UI: polish agent skills, chat images, and sidebar status * test: stabilize vitest helper export types * UI: address review feedback on agents refresh and chat styles * test: update outbound gateway client fixture values * test: narrow shared ip fixtures to IPv4
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import fs from "node:fs/promises";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
import { vi } from "vitest";
|
|
import type { PortUsage } from "../../infra/ports-types.js";
|
|
import type { killProcessTree as killProcessTreeImpl } from "../../process/kill-tree.js";
|
|
import type { MockFn } from "../../test-utils/vitest-mock-fn.js";
|
|
|
|
export const schtasksResponses: Array<{ code: number; stdout: string; stderr: string }> = [];
|
|
export const schtasksCalls: string[][] = [];
|
|
|
|
export const inspectPortUsage: MockFn<(port: number) => Promise<PortUsage>> = vi.fn();
|
|
export const killProcessTree: MockFn<typeof killProcessTreeImpl> = vi.fn();
|
|
|
|
export async function withWindowsEnv(
|
|
prefix: string,
|
|
run: (params: { tmpDir: string; env: Record<string, string> }) => Promise<void>,
|
|
) {
|
|
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), prefix));
|
|
const env = {
|
|
USERPROFILE: tmpDir,
|
|
APPDATA: path.join(tmpDir, "AppData", "Roaming"),
|
|
OPENCLAW_PROFILE: "default",
|
|
OPENCLAW_GATEWAY_PORT: "18789",
|
|
};
|
|
try {
|
|
await run({ tmpDir, env });
|
|
} finally {
|
|
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
}
|
|
}
|
|
|
|
export function resetSchtasksBaseMocks() {
|
|
schtasksResponses.length = 0;
|
|
schtasksCalls.length = 0;
|
|
inspectPortUsage.mockReset();
|
|
killProcessTree.mockReset();
|
|
}
|