import { FakeClock } from "../runtime/clock.js"; import type { LogLevel } from "../logger.js"; import { type Capability, type Host, type HostNetwork, type HostSubprocess, type MakeHostArgs, type OperatingSystem } from "./host.js"; /** What a memory host holds and records. A test reads these after a run. */ export type MemoryHostState = { /** Every file, keyed by its absolute path with `/` separators. */ files: Record; /** Every directory that exists, keyed the same way. */ dirs: Record; /** What `terminal.print`, `writeOut`, and `writeErr` were given, in order. */ output: string[]; /** Lines `readLine` hands out, in order. Empty when the test gave none. */ inputLines: string[]; /** What `settings.log` was given. */ logged: { level: LogLevel; text: string; }[]; /** The variables `settings.read` and `env.get` answer from. */ variables: Record; clock: FakeClock; }; export type MemoryHostOptions = { /** Defaults to every capability. */ capabilities?: Capability[]; /** Files to start with, by absolute path. Text is stored as UTF-8. */ files?: Record; /** The variables `settings.read` and `env.get` answer from. */ variables?: Record; /** Lines `readLine` hands out. */ inputLines?: string[]; /** What `network.fetch` answers with. Without one, every request is * refused with an error that names the URL. */ fetch?: HostNetwork["fetch"]; /** What runs commands. Without one, every command is refused with an * error that names the program. */ subprocess?: HostSubprocess; cwd?: string; homeDir?: string; /** What `system.installDir` answers; null without. */ installDir?: string; operatingSystem?: OperatingSystem; clock?: FakeClock; onUse?: MakeHostArgs["onUse"]; onCallable?: MakeHostArgs["onCallable"]; }; export type MemoryHost = Host & { state: MemoryHostState; }; export declare function memoryHost(options?: MemoryHostOptions): MemoryHost;