mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 00:11:31 +00:00
16 lines
419 B
TypeScript
16 lines
419 B
TypeScript
import type { RuntimeEnv } from "openclaw/plugin-sdk/testing";
|
|
import { vi } from "vitest";
|
|
|
|
export function createRuntimeEnv(options?: { throwOnExit?: boolean }): RuntimeEnv {
|
|
const throwOnExit = options?.throwOnExit ?? true;
|
|
return {
|
|
log: vi.fn(),
|
|
error: vi.fn(),
|
|
exit: throwOnExit
|
|
? vi.fn((code: number): never => {
|
|
throw new Error(`exit ${code}`);
|
|
})
|
|
: vi.fn(),
|
|
};
|
|
}
|