Skip to content

Commit 549248a

Browse files
committed
docs(blog): add 0.35.0 release post
1 parent 20ab298 commit 549248a

1 file changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
date: '2026-04-26'
3+
title: 'Release 0.35.0'
4+
description: 'Configurable spies, custom failure labels, fail-on-risky, GitHub Actions annotations, richer assert_exec, plus key bug fixes.'
5+
coverAlt: 'Configurable spies, custom labels, fail-on-risky, GHA annotations, richer assert_exec, bug fixes'
6+
7+
aside: false
8+
---
9+
10+
# {{ $frontmatter.title }}
11+
12+
<time>{{ $formatDate($frontmatter.date) }}</time>
13+
14+
## New features
15+
16+
### Configurable spies
17+
18+
`bashunit::spy` now accepts an optional exit code or a custom implementation function so spies can simulate real behavior, not just record calls:
19+
20+
::: code-group
21+
```bash [Custom exit code]
22+
function test_spy_with_exit_code() {
23+
spy curl 1
24+
curl https://example.com
25+
assert_general_spy_called_times "curl" 1
26+
assert_equals 1 "$?"
27+
}
28+
```
29+
```bash [Custom implementation]
30+
function fake_curl() {
31+
echo "stubbed body"
32+
return 0
33+
}
34+
35+
function test_spy_with_impl() {
36+
spy curl fake_curl
37+
result=$(curl https://example.com)
38+
assert_equals "stubbed body" "$result"
39+
}
40+
```
41+
:::
42+
43+
### Custom failure labels on assertions
44+
45+
Every assertion now accepts an optional trailing label that overrides the failure title, making failure output much easier to scan ([#77](https://github.com/TypedDevs/bashunit/issues/77)):
46+
47+
```bash
48+
function test_user_is_admin() {
49+
assert_equals "admin" "$role" "user role mismatch"
50+
assert_contains "@" "$email" "email format"
51+
}
52+
```
53+
54+
### Fail on risky tests
55+
56+
Risky tests (zero assertions) were introduced in 0.34.1 as warnings only. Use `--fail-on-risky` or `BASHUNIT_FAIL_ON_RISKY=true` to promote them to hard failures so silently empty tests cannot ship green ([#115](https://github.com/TypedDevs/bashunit/issues/115)):
57+
58+
```bash
59+
bashunit --fail-on-risky tests/
60+
```
61+
62+
### GitHub Actions inline annotations
63+
64+
The new `--log-gha <file>` flag (or `BASHUNIT_LOG_GHA`) emits GitHub Actions workflow commands so failed, risky and incomplete tests appear as inline PR annotations ([#280](https://github.com/TypedDevs/bashunit/issues/280)):
65+
66+
```yaml
67+
- name: Run tests
68+
run: ./bashunit --log-gha gha.log tests/
69+
```
70+
71+
### `assert_exec` for interactive commands and partial output
72+
73+
`assert_exec` gained five flags to feed stdin and assert on substrings of stdout/stderr, perfect for testing interactive prompts ([#301](https://github.com/TypedDevs/bashunit/issues/301)):
74+
75+
- `--stdin` to pipe input into the command
76+
- `--stdout-contains`, `--stdout-not-contains`
77+
- `--stderr-contains`, `--stderr-not-contains`
78+
79+
```bash
80+
function test_prompt_accepts_yes() {
81+
assert_exec \
82+
--stdin "yes" \
83+
--stdout-contains "Confirmed" \
84+
./scripts/confirm.sh
85+
}
86+
```
87+
88+
## Changes
89+
90+
- Parallel test execution is now enabled on Alpine Linux ([#370](https://github.com/TypedDevs/bashunit/issues/370)).
91+
92+
## Bug fixes
93+
94+
- Dim/faint labels render as gray (SGR 90) so keywords like `Expected` and `Tests:` stay colored in GitHub Actions logs ([#323](https://github.com/TypedDevs/bashunit/issues/323)).
95+
- Syntax error in a test file now fails the suite instead of passing silently ([#220](https://github.com/TypedDevs/bashunit/issues/220)).
96+
- `--stop-on-failure` now stops on runtime errors such as `command not found` or `illegal option` ([#383](https://github.com/TypedDevs/bashunit/issues/383)).
97+
- Spying on `echo` or `printf` no longer hangs via infinite recursion ([#607](https://github.com/TypedDevs/bashunit/issues/607)).
98+
- LCOV and HTML coverage reports no longer produce empty output under `set -e` ([#618](https://github.com/TypedDevs/bashunit/issues/618)).
99+
- `clock::now` handles `EPOCHREALTIME` values that use a comma decimal separator.
100+
- Invalid `.env.example` coverage threshold entry fixed; CI now copies `.env.example` to `.env` so config parse errors are caught.
101+
- Coverage no longer counts case patterns with trailing comments (e.g. `*thing) # note`) or loop terminators with redirections/pipes (e.g. `done < file`, `done <<<"$var"`, `done | sort`) as executable lines ([#634](https://github.com/TypedDevs/bashunit/issues/634)).
102+
- `assert_true` and `assert_false` now report empty strings as assertion failures instead of trying to execute them.
103+
104+
---
105+
106+
See the full changelog for [0.35.0](https://github.com/TypedDevs/bashunit/releases/tag/0.35.0) on GitHub.

0 commit comments

Comments
 (0)