Compare commits

..

2 Commits

4 changed files with 8 additions and 8 deletions

View File

@ -56,7 +56,7 @@ Options:
-u, --update Rewrite expected output in-place with actual output
-k, --keep Keep temp directories after run
--clean-env Start with empty environment
--bin <path> Prepend <path> to PATH
--path <path> Prepend <path> to PATH (repeatable)
--timeout <dur> Per-command timeout (default: "10s")
-v, --verbose Print each command as it runs
--parallel Run files in parallel

View File

@ -61,7 +61,7 @@ The following environment variables are set for every command:
| Variable | Value |
|---|---|
| `HOME` | the temp directory |
| `PATH` | inherited from host (or prepended via `--bin`) |
| `PATH` | inherited from host (or prepended via `--path`) |
| `CUE_DIR` | the temp directory |
All other environment variables are inherited from the host unless explicitly
@ -99,7 +99,7 @@ and subdirectories. Each command in each shout file is run sequentially
| `--update` / `-u` | Rewrite expected output in-place with actual output |
| `--keep` / `-k` | Keep temp directories after run (printed to stderr) |
| `--clean-env` | Start with empty environment (only `PATH` and `CUE_DIR` set) |
| `--bin <path>` | Prepend `<path>` to `PATH` |
| `--path <path>` | Prepend `<path>` to `PATH` (repeatable) |
| `--timeout <dur>` | Per-command timeout, e.g. `500ms`, `10s`, `1m` (default: `10s`) |
| `--verbose` / `-v` | Print each command as it runs |
| `--parallel` | Run files in parallel (implies all files run regardless of failures) |

View File

@ -50,7 +50,7 @@ program
.option("-u, --update", "Rewrite expected output in-place with actual output")
.option("-k, --keep", "Keep temp directories after run")
.option("--clean-env", "Start with empty environment")
.option("--bin <path>", "Prepend <path> to PATH")
.option("--path <path>", "Prepend <path> to PATH (repeatable)", (val: string, acc: string[]) => [...acc, val])
.option("--timeout <dur>", "Per-command timeout", "10s")
.option("-v, --verbose", "Print each command as it runs")
.option("--parallel", "Run files in parallel")
@ -95,7 +95,7 @@ $ true
const fileResult = await runFile(parsed, {
cleanEnv: opts.cleanEnv ?? false,
binPath: opts.bin,
pathDirs: opts.path,
timeout: timeoutMs,
verbose: opts.verbose ?? false,
onCommand: opts.verbose

View File

@ -19,7 +19,7 @@ export type FileResult = {
type RunOptions = {
cleanEnv: boolean
binPath?: string
pathDirs?: string[]
timeout: number
verbose: boolean
onCommand?: (cmd: Command) => void
@ -128,8 +128,8 @@ export async function runFile(
env["HOME"] = tmpDir
env["CUE_DIR"] = tmpDir
if (options.binPath) {
env["PATH"] = options.binPath + ":" + (env["PATH"] ?? "")
if (options.pathDirs?.length) {
env["PATH"] = options.pathDirs.join(":") + ":" + (env["PATH"] ?? "")
}
try {