mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-31 03:41:51 +00:00
test: align cli runtime mocks with output runtime
This commit is contained in:
@@ -37,6 +37,9 @@ vi.mock("../../runtime.js", () => ({
|
||||
exit: (code: number) => {
|
||||
throw new Error(`__exit__:${code}`);
|
||||
},
|
||||
writeStdout: (value: string) => runtimeLogs.push(value),
|
||||
writeJson: (value: unknown, space = 2) =>
|
||||
runtimeLogs.push(JSON.stringify(value, null, space > 0 ? space : undefined)),
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@@ -27,15 +27,15 @@ export const defaultRuntime: LifecycleRuntimeHarness = {
|
||||
runtimeLogs.push(args.map((arg) => String(arg)).join(" "));
|
||||
},
|
||||
error: vi.fn(),
|
||||
exit: vi.fn((code: number) => {
|
||||
throw new Error(`__exit__:${code}`);
|
||||
}),
|
||||
writeStdout: vi.fn((value: string) => {
|
||||
runtimeLogs.push(value.endsWith("\n") ? value.slice(0, -1) : value);
|
||||
}),
|
||||
writeJson: vi.fn((value: unknown, space = 2) => {
|
||||
runtimeLogs.push(JSON.stringify(value, null, space > 0 ? space : undefined));
|
||||
}),
|
||||
exit: vi.fn((code: number) => {
|
||||
throw new Error(`__exit__:${code}`);
|
||||
}),
|
||||
};
|
||||
|
||||
export const service: LifecycleServiceHarness = {
|
||||
|
||||
Reference in New Issue
Block a user