#!/usr/bin/env nu
# CLI tests (nu/tests/). Needs nutest on NU_LIB_DIRS (devShell).

use nutest

def main [
    suite?: string  # e.g. vm_test → nu/tests/vm_test.nu
] {
    let repo_root = ($env.FILE_PWD | path dirname)
    let tests_path = ($repo_root | path join "nu" "tests")
    if $suite == null {
        nutest run-tests --path $tests_path --fail --returns table
    } else {
        nutest run-tests --path $tests_path --fail --match-suites $suite --returns table
    }
}
