import type { Bash } from "../Bash.js"; import type { ExecResult } from "../types.js"; /** * Asserts that the result exited with code 0 and returns stdout. * Throws with stderr details on failure. */ export declare function assertSuccess(result: ExecResult): string; /** * Asserts that the result exited with a non-zero code. * Optionally checks for a specific exit code or a regex pattern against stderr. * * @param result - The execution result (or a Promise resolving to one) * @param expected - If a number, asserts that specific exit code. If a RegExp, asserts stderr matches. * * @example * ```ts * // Assert any failure * await assertFails(bash.exec("false")); * * // Assert specific exit code * await assertFails(bash.exec("exit 2"), 2); * * // Assert stderr matches a pattern * await assertFails(bash.exec("cat /no/such/file"), /No such file/); * ``` */ export declare function assertFails(result: ExecResult | Promise, expected?: number | RegExp): Promise; /** * Asserts that stdout contains the given substring. */ export declare function assertOutput(result: ExecResult, substring: string): void; /** * Asserts that stderr contains the given substring. */ export declare function assertStderr(result: ExecResult, substring: string): void; /** * Asserts that a file exists in the bash filesystem. * Optionally checks that the file content matches exactly. * * Note: Uses the Bash.exec method (ag-bash virtual shell), not child_process. */ export declare function assertFileExists(bash: Bash, path: string, expectedContent?: string): Promise; /** * Asserts that a file does NOT exist in the bash filesystem. * * Note: Uses the Bash.exec method (ag-bash virtual shell), not child_process. */ export declare function assertFileNotExists(bash: Bash, path: string): Promise;