pub mod jest;
pub mod playwright;
pub mod pytest;
pub mod ruby;
pub mod vitest;

/// Route test-runner output to the right compressor.
pub fn compress_test_runner(prog: &str, raw: &str, exit_code: i32) -> String {
    match prog {
        "pytest" | "py.test" => pytest::compress_pytest(raw, exit_code),
        "jest" | "mocha" => jest::compress_jest(raw, exit_code),
        "vitest" => vitest::compress_vitest(raw, exit_code),
        "playwright" | "playwright-test" => playwright::compress_playwright(raw, exit_code),
        "rspec" => ruby::compress_rspec(raw, exit_code),
        "minitest" => ruby::compress_minitest(raw, exit_code),
        "rake" => ruby::compress_rake(raw),
        _ => pytest::compress_pytest(raw, exit_code),
    }
}

// Legacy single-arg shims used by existing FilterMesh nodes.
pub fn compress_pytest(raw: &str) -> String {
    pytest::compress_pytest(raw, 0)
}

pub fn compress_jest(raw: &str) -> String {
    jest::compress_jest(raw, 0)
}
