|
| 1 | +--- |
| 2 | +date: '2026-07-20' |
| 3 | +title: 'Release 0.42.0' |
| 4 | +description: 'A reliability release: replay only the last failures with --rerun-failed, cap parallelism with --jobs auto, a watcher-free watch fallback, big speed-ups, and a wave of correctness fixes to lifecycle hooks, nested runs, the build and the installer.' |
| 5 | +coverAlt: 'Rerun-failed, jobs auto, watch fallback, performance work and correctness fixes across hooks, build and installer' |
| 6 | + |
| 7 | +aside: false |
| 8 | +--- |
| 9 | + |
| 10 | +# {{ $frontmatter.title }} |
| 11 | + |
| 12 | +<time>{{ $formatDate($frontmatter.date) }}</time> |
| 13 | + |
| 14 | +This is a big reliability release. New workflow features sit on top of a large round of correctness work — several of the fixes came out of a single audit that uncovered one problem after another in the build, the runner and the installer. |
| 15 | + |
| 16 | +## New features |
| 17 | + |
| 18 | +### Replay only what just failed with `--rerun-failed` |
| 19 | + |
| 20 | +Every run now records its failing tests to `.bashunit/last-failed`. Passing `--rerun-failed` (or `BASHUNIT_RERUN_FAILED=true`) replays exactly those tests instead of the whole suite — a much tighter edit-run loop while you fix a handful of failures. A fully green run clears the cache, an empty cache falls back to running everything, and it composes with `--filter`, `--tag` and `--parallel`. Add `.bashunit/` to your `.gitignore` ([#776](https://github.com/TypedDevs/bashunit/issues/776)). |
| 21 | + |
| 22 | +```bash |
| 23 | +bashunit tests/ # a few tests fail |
| 24 | +bashunit --rerun-failed tests/ # replay just those |
| 25 | +``` |
| 26 | + |
| 27 | +### Cap parallel concurrency with `--jobs auto` |
| 28 | + |
| 29 | +`--jobs auto` (or `-j auto`) caps parallel workers at the machine's CPU core count, portable across Linux, macOS and BSD. The default stays unlimited ([#766](https://github.com/TypedDevs/bashunit/issues/766)). |
| 30 | + |
| 31 | +### `watch` works without a file watcher installed |
| 32 | + |
| 33 | +The `watch` subcommand no longer requires `inotifywait` or `fswatch`. When neither is present it falls back to pure-shell polling instead of exiting, with the interval set by `BASHUNIT_WATCH_INTERVAL` (default `2` seconds) ([#779](https://github.com/TypedDevs/bashunit/issues/779)). |
| 34 | + |
| 35 | +### Shell tab-completion |
| 36 | + |
| 37 | +bashunit now ships bash and zsh tab-completion scripts under `completions/` — subcommands, `test` flags with value hints, and assertion names — kept in sync with the CLI by an anti-drift CI test ([#778](https://github.com/TypedDevs/bashunit/issues/778)). |
| 38 | + |
| 39 | +## Performance |
| 40 | + |
| 41 | +- **Multi-file runs are no longer quadratic in the number of files.** Each file's test functions are unset once it has been processed, so test subshells stop forking an ever-growing shell. bashunit's own 63-file unit suite dropped from ~64s to ~22s sequential, and ~26s to ~7s in parallel ([#829](https://github.com/TypedDevs/bashunit/issues/829)). |
| 42 | +- **`bashunit doc` is ~100× faster.** It used to fork an `echo | sed` pipe per line of the assertion docs; a single `awk` pass now prints the same output in about 50ms instead of ~5s ([#832](https://github.com/TypedDevs/bashunit/issues/832)). |
| 43 | +- More broadly, the hot paths are now near fork-free, snapshot and `--tag` scans are cached, and failure rendering is single-pass. On Bash 3.2: 100×10 `assert_equals` ~1.50s → ~0.76s, 500 snapshot assertions ~7.5s → ~3.0s. |
| 44 | + |
| 45 | +## Bug fixes |
| 46 | + |
| 47 | +- **Failing lifecycle hooks are now consistent.** A failing `set_up_before_script` or `set_up` used to behave three different ways depending on the shape of the hook and the Bash version — sometimes silently ignored, sometimes counted wrong with no message. Now every test in the file is marked failed with the hook's error, the totals stay consistent, and the suite continues to the next file. A strict test file can no longer abort the whole run mid-suite ([#836](https://github.com/TypedDevs/bashunit/issues/836)). |
| 48 | +- **Run-mode flags no longer leak into nested runs.** Flags like `--parallel`, `--simple`, `--strict`, `--retry`, `--seed` and the report paths were exported into the environment, so a script under test that itself called bashunit silently inherited the parent's configuration. They are now this-process-only; `BASHUNIT_*=…` configuration is unchanged ([#834](https://github.com/TypedDevs/bashunit/issues/834), [#837](https://github.com/TypedDevs/bashunit/issues/837)). |
| 49 | +- **`install.sh` fails fast.** A failed download, clone, build or copy now aborts with a clear error instead of reporting success — a failed beta clone could previously run the build in the caller's directory ([#840](https://github.com/TypedDevs/bashunit/issues/840)). |
| 50 | +- **`./build.sh --verify` actually gates now**, exiting non-zero when the built binary fails the suite, and the verification run no longer crashes mid-suite ([#834](https://github.com/TypedDevs/bashunit/issues/834)). |
| 51 | +- `./bashunit bench` works again when run from a repository checkout ([#834](https://github.com/TypedDevs/bashunit/issues/834)). |
| 52 | +- Snapshot placeholders (`::ignore::`) now work on systems without perl; multi-line placeholders still need it ([#823](https://github.com/TypedDevs/bashunit/issues/823)). |
| 53 | +- Runs no longer leak a scratch directory under `$TMPDIR/bashunit/run/` — it is cleaned up on exit, including for `--version`/`--help`, subcommands and Ctrl-C ([#811](https://github.com/TypedDevs/bashunit/issues/811)). |
| 54 | +- `--test-timeout` no longer occasionally reports a fast test as timed out. |
| 55 | + |
| 56 | +## Changes |
| 57 | + |
| 58 | +- **`build.sh` was hardened**: it runs under `set -euo pipefail`, derives the bundled file list from the entrypoint's own `source` order (one source of truth), guards against duplicate embeds and missing doc markers, drops `eval`, and gates every build behind a `bash -n` syntax check ([#834](https://github.com/TypedDevs/bashunit/issues/834)). |
| 59 | +- Per-test timing now defaults to `auto`: shown only when the shell has a fork-free clock, so a plain run stays fast on Bash 3.2. `--profile`, `--verbose` and the reports always measure ([#765](https://github.com/TypedDevs/bashunit/issues/765)). |
| 60 | +- `assert_equals`/`assert_same` failures with multiline values now render a git word-diff below the header (opt out with `BASHUNIT_NO_DIFF=true`) ([#777](https://github.com/TypedDevs/bashunit/issues/777)). |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +See the full changelog for [0.42.0](https://github.com/TypedDevs/bashunit/releases/tag/0.42.0) on GitHub. |
0 commit comments