import * as fs from "node:fs/promises"; import * as path from "node:path"; import { Bash } from "../Bash.js"; /** * Shell used to run "real bash" for comparison. GitHub's windows-latest * runners have no `/bin/bash` (no WSL on the hosted image) but do ship Git * for Windows, whose bash.exe is added to PATH specifically so `shell: bash` * works in Actions workflows - resolve by bare name there, keep the * absolute path on POSIX (matches every prior invocation exactly, zero risk * of picking up a different bash than before). */ export declare const REAL_BASH_SHELL: string; /** * Check if we're in record mode (recording bash outputs to fixtures) * - "1" = record mode, but skip locked fixtures * - "force" = record mode, overwrite even locked fixtures */ export declare const isRecordMode: boolean; /** * Fixture entry for a single test case */ export interface FixtureEntry { command: string; files: Record; stdout: string; stderr: string; exitCode: number; /** * If true, this fixture has been manually adjusted (e.g., for Linux behavior) * and will not be overwritten during recording unless RECORD_FIXTURES=force */ locked?: boolean; } /** * Fixtures file format - keyed by fixture ID */ export interface FixturesFile { [fixtureId: string]: FixtureEntry; } /** * Write all pending fixtures to disk (call after all tests complete) */ export declare function writeAllFixtures(): Promise; /** * Creates a unique temp directory for testing */ export declare function createTestDir(): Promise; /** * Cleans up the temp directory */ export declare function cleanupTestDir(testDir: string): Promise; /** * Options for comparing outputs */ export interface CompareOptions { compareStderr?: boolean; compareExitCode?: boolean; normalizeWhitespace?: boolean; } /** * Convert a real testDir-relative path into the forward-slash virtual path * the Bash instance returned by setupFiles() actually uses internally. * Callers that need to `env.readFile()`/`env.writeFile()` a path derived * from testDir (as opposed to a real `fs.readFile()`, which should keep * using plain `path.join(testDir, ...)`) must go through this helper * instead of reconstructing the join themselves. */ export declare function virtualPath(testDir: string, filePath: string): string; /** * Sets up test files in both real FS and creates a Bash */ export declare function setupFiles(testDir: string, files: Record): Promise; /** * Runs a command in real bash */ export declare function runRealBash(command: string, cwd: string): Promise<{ stdout: string; stderr: string; exitCode: number; }>; /** * Compares Bash output with recorded bash output (from fixtures) * In record mode, runs real bash and saves the output to fixtures * * @param env - Bash instance * @param testDir - Test directory path * @param command - Command to run * @param options - Comparison options (optional) * @param files - Files that were set up (optional, auto-retrieved from setupFiles registry) * @param testFileUrl - import.meta.url of the test file (optional, falls back to stack trace) */ export declare function compareOutputs(env: Bash, testDir: string, command: string, options?: CompareOptions, files?: Record, testFileUrl?: string): Promise; export { fs, path };