Skip to content

Commit 6138668

Browse files
committed
add blog release for 0.28,0.29,0.30,0.31
1 parent fc7256d commit 6138668

4 files changed

Lines changed: 356 additions & 0 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
date: '2025-12-01'
3+
title: 'Release 0.28.0'
4+
description: 'Introducing subcommand-based CLI, inline filter syntax, and smarter test execution behavior.'
5+
coverAlt: 'Subcommand-based CLI, inline filter syntax, and smarter test execution'
6+
7+
aside: false
8+
---
9+
10+
# {{ $frontmatter.title }}
11+
12+
<time>{{ $formatDate($frontmatter.date) }}</time>
13+
14+
## 🔧 New features
15+
16+
### Subcommand-based CLI architecture
17+
18+
bashunit now uses a subcommand-based CLI design, making the interface cleaner and more intuitive:
19+
20+
::: code-group
21+
```bash [Commands]
22+
bashunit test [path] # Run tests (default)
23+
bashunit bench [path] # Run benchmarks
24+
bashunit doc [filter] # Show assertion documentation
25+
bashunit init [dir] # Initialize a new project
26+
bashunit learn # Interactive tutorial
27+
bashunit upgrade # Upgrade to latest version
28+
```
29+
:::
30+
31+
The previous flags (`--bench`, `--doc`, `--init`, `--learn`, `--upgrade`) continue to work for backward compatibility.
32+
33+
### Inline filter syntax
34+
35+
Run specific tests directly from the command line using the new inline filter syntax:
36+
37+
::: code-group
38+
```bash [By function name]
39+
bashunit tests/example_test.sh::test_my_function
40+
```
41+
```bash [By line number]
42+
bashunit tests/example_test.sh:42
43+
```
44+
:::
45+
46+
This makes it faster to rerun a single failing test during development.
47+
48+
### Stop at first assertion failure
49+
50+
Tests now stop at the first assertion failure by default, matching the behavior of PHPUnit and Jest. This prevents cascading failures and makes debugging easier.
51+
52+
If you prefer to run all assertions regardless of failures, use the new `--run-all` flag or set `BASHUNIT_STOP_ON_ASSERTION_FAILURE=false`.
53+
54+
### Display skipped and incomplete tests
55+
56+
New options to display skipped and incomplete tests at the end of the test run:
57+
58+
::: code-group
59+
```bash [Usage]
60+
bashunit --show-skipped tests/
61+
bashunit --show-incomplete tests/
62+
```
63+
:::
64+
65+
## 🐛 Bug fixes
66+
67+
- Stop executing remaining commands in `set_up`/`tear_down` after first failure
68+
- Count all tests as failed when `set_up_before_script` fails
69+
- Fixed acceptance tests forcing not showing skipped and incomplete tests
70+
71+
## 🌾 Miscellaneous
72+
73+
- Optimize assertion guard: use integer comparison instead of string comparison
74+
- Optimize string operations with `str::strip_ansi` refactoring
75+
76+
---
77+
78+
See the full changelog on <a href="https://github.com/TypedDevs/bashunit/releases/tag/0.28.0">GitHub</a>
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
date: '2025-12-08'
3+
title: 'Release 0.29.0'
4+
description: 'Namespaced internal functions, bootstrap arguments, strict mode, login shell support, and the new assert subcommand.'
5+
coverAlt: 'Namespaced internals, strict mode, and standalone assertions'
6+
7+
aside: false
8+
---
9+
10+
# {{ $frontmatter.title }}
11+
12+
<time>{{ $formatDate($frontmatter.date) }}</time>
13+
14+
## 🔧 New features
15+
16+
### Namespaced internal functions
17+
18+
All internal functions and variables are now prefixed with `bashunit::` to prevent naming collisions with your code:
19+
20+
::: code-group
21+
```bash [Before]
22+
skip "reason"
23+
helper::trim "$value"
24+
```
25+
```bash [After]
26+
bashunit::skip "reason"
27+
bashunit::helper::trim "$value"
28+
```
29+
:::
30+
31+
Internal variables are also prefixed: `_TESTS_PASSED` becomes `_BASHUNIT_TESTS_PASSED`. The public API (`assert_*` functions) remains unchanged.
32+
33+
### Bootstrap argument passing
34+
35+
Pass arguments to your bootstrap script using the `--env` flag:
36+
37+
::: code-group
38+
```bash [Usage]
39+
bashunit --env "bootstrap.sh arg1 arg2" tests/
40+
```
41+
```bash [Environment variable]
42+
BASHUNIT_BOOTSTRAP_ARGS="arg1 arg2" bashunit tests/
43+
```
44+
:::
45+
46+
### Login shell support
47+
48+
Run tests in a login shell context with the new `-l, --login` flag:
49+
50+
::: code-group
51+
```bash [Usage]
52+
bashunit --login tests/
53+
```
54+
:::
55+
56+
This loads your shell profile, useful when testing scripts that depend on login shell configuration.
57+
58+
### Strict mode
59+
60+
Enable strict shell mode (`set -euo pipefail`) for your tests:
61+
62+
::: code-group
63+
```bash [Usage]
64+
bashunit --strict tests/
65+
```
66+
```bash [Configuration]
67+
BASHUNIT_STRICT_MODE=true
68+
```
69+
:::
70+
71+
Strict mode catches unset variables and pipeline failures, helping you write more robust scripts.
72+
73+
### Run all assertions
74+
75+
Override the default stop-on-failure behavior with `-R, --run-all`:
76+
77+
::: code-group
78+
```bash [Usage]
79+
bashunit --run-all tests/
80+
```
81+
:::
82+
83+
### Standalone assert subcommand
84+
85+
Use assertions directly from the command line:
86+
87+
::: code-group
88+
```bash [Usage]
89+
bashunit assert equals "expected" "actual"
90+
bashunit assert contains "needle" "haystack"
91+
```
92+
:::
93+
94+
## 🐛 Bug fixes
95+
96+
- Custom assertions now display correct test function name in failure messages
97+
- Data providers work when `set_up_before_script` changes directory
98+
- Resolved race conditions in parallel test execution
99+
- Test doubles are now strict mode compatible
100+
- Catch intermediate failing commands in `set_up_before_script` and `tear_down_after_script`
101+
102+
## 🌾 Miscellaneous
103+
104+
- Improved `assert` command output: shows `assert <fn>` instead of internal function name
105+
- `--preserve-env` option to skip `.env` loading and use shell environment only
106+
107+
---
108+
109+
See the full changelog on <a href="https://github.com/TypedDevs/bashunit/releases/tag/0.29.0">GitHub</a>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
date: '2025-12-14'
3+
title: 'Release 0.30.0'
4+
description: 'Failures-only mode, no-color option, human-readable test durations, and multiple standalone assertions.'
5+
coverAlt: 'Failures-only mode, no-color option, and display improvements'
6+
7+
aside: false
8+
---
9+
10+
# {{ $frontmatter.title }}
11+
12+
<time>{{ $formatDate($frontmatter.date) }}</time>
13+
14+
## 🔧 New features
15+
16+
### Failures-only mode
17+
18+
Focus on what matters with `--failures-only`, which suppresses passed, skipped, and incomplete tests:
19+
20+
::: code-group
21+
```bash [Usage]
22+
bashunit --failures-only tests/
23+
```
24+
:::
25+
26+
### No-color output
27+
28+
Disable ANSI colors for cleaner logs in CI environments:
29+
30+
::: code-group
31+
```bash [Flag]
32+
bashunit --no-color tests/
33+
```
34+
```bash [Environment variable]
35+
NO_COLOR=1 bashunit tests/
36+
```
37+
:::
38+
39+
### Human-readable test duration
40+
41+
Test durations are now displayed in a more readable format:
42+
43+
::: code-group
44+
```[Output]
45+
✓ Passed: Fast test 12 ms
46+
✓ Passed: Medium test 1.5 s
47+
✓ Passed: Slow test 2m 15s
48+
```
49+
:::
50+
51+
Execution time is shown in minutes when tests run over 60 seconds (e.g., "2m 1s").
52+
53+
### Multiple assertions in standalone mode
54+
55+
Chain multiple assertions in a single command:
56+
57+
::: code-group
58+
```bash [Usage]
59+
bashunit assert "my_command" exit_code "0" contains "success"
60+
```
61+
:::
62+
63+
## 🐛 Bug fixes
64+
65+
- Suppress stdout/stderr during `set_up_before_script` and `tear_down_after_script` (visible in verbose mode)
66+
- Prevent `.env` override in strict mode tests
67+
- Fixed internal flaky tests when running `--strict`
68+
69+
## 🌾 Miscellaneous
70+
71+
- **Breaking change**: `--preserve-env` renamed to `--skip-env-file` for clearer semantics
72+
- **Breaking change**: `BASHUNIT_PRESERVE_ENV` renamed to `BASHUNIT_SKIP_ENV_FILE`
73+
- Added `release.sh` script to automate the release process
74+
75+
---
76+
77+
See the full changelog on <a href="https://github.com/TypedDevs/bashunit/releases/tag/0.30.0">GitHub</a>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
date: '2025-12-19'
3+
title: 'Release 0.31.0'
4+
description: 'Code coverage tracking with LCOV and HTML reports, minimum coverage thresholds, and lifecycle hook visibility.'
5+
coverAlt: 'Code coverage tracking, HTML reports, and lifecycle visibility'
6+
7+
aside: false
8+
---
9+
10+
# {{ $frontmatter.title }}
11+
12+
<time>{{ $formatDate($frontmatter.date) }}</time>
13+
14+
## 🔧 New features
15+
16+
### Code coverage tracking
17+
18+
Track line coverage for your bash scripts using the new coverage options. See the full <a href="/coverage">coverage documentation</a> for details.
19+
20+
::: code-group
21+
```bash [Console only]
22+
bashunit --coverage tests/
23+
```
24+
```bash [LCOV report]
25+
bashunit --coverage-report coverage/lcov.info tests/
26+
```
27+
```bash [HTML report]
28+
bashunit --coverage-report-html coverage/ tests/
29+
```
30+
:::
31+
32+
Coverage is tracked using Bash's DEBUG trap mechanism. You can customize which paths to track and exclude:
33+
34+
::: code-group
35+
```bash [Custom paths]
36+
bashunit --coverage --coverage-paths src/ lib/ tests/
37+
```
38+
```bash [Exclude patterns]
39+
bashunit --coverage --coverage-exclude "tests/*,vendor/*" tests/
40+
```
41+
:::
42+
43+
The report shows covered and uncovered lines with color-coded highlighting, making it easy to identify gaps in your test coverage.
44+
45+
### Minimum coverage threshold
46+
47+
Enforce a minimum coverage percentage with `--coverage-min`:
48+
49+
::: code-group
50+
```bash [Usage]
51+
bashunit --coverage --coverage-min 80 tests/
52+
```
53+
```[Output]
54+
Coverage: 75.5% (below minimum 80%)
55+
Exit code: 1
56+
```
57+
:::
58+
59+
The test run fails if coverage falls below the threshold, useful for CI pipelines.
60+
61+
### Color-coded coverage output
62+
63+
Console coverage output uses color-coded thresholds:
64+
65+
- Below 50%: red
66+
- 50-80%: yellow
67+
- Above 80%: green
68+
69+
### Lifecycle hook visibility
70+
71+
See exactly how long your setup and teardown scripts take:
72+
73+
::: code-group
74+
```[Output]
75+
Running set_up_before_script... done (2.3s)
76+
✓ Passed: My test 45 ms
77+
Running tear_down_after_script... done (0.5s)
78+
```
79+
:::
80+
81+
This helps identify slow setup and teardown operations that may be affecting your test suite performance. The output is suppressed in failures-only and parallel modes.
82+
83+
## 🐛 Bug fixes
84+
85+
- Fixed `bench` command not working in standalone/installed bashunit (missing `benchmark.sh` in build)
86+
- Fixed `helper::get_latest_tag` returning version with `^{}` suffix from annotated git tags
87+
- Skip files with no matching tests when using `--filter`
88+
- Fixed simple output without before/after script timing
89+
90+
---
91+
92+
See the full changelog on <a href="https://github.com/TypedDevs/bashunit/releases/tag/0.31.0">GitHub</a>

0 commit comments

Comments
 (0)