Skip to content

Commit 9a0b61c

Browse files
committed
docs: update changelog
1 parent f66e411 commit 9a0b61c

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
### Added
66
- Better code coverage HTML report
7+
- Auto-discover coverage paths from test file names when `BASHUNIT_COVERAGE_PATHS` is not set
8+
- `tests/unit/assert_test.sh` automatically tracks `src/assert.sh`
9+
- Removes need for manual `--coverage-paths` configuration in most cases
10+
11+
### Fixed
12+
- Coverage now excludes control flow keywords (`then`, `else`, `fi`, `do`, `done`, `esac`, `;;`, case patterns) from line tracking
713

814
## [0.31.0](https://github.com/TypedDevs/bashunit/compare/0.30.0...0.31.0) - 2025-12-19
915

docs/coverage.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The DEBUG trap adds overhead to test execution. For large test suites, consider
5454
| Option | Description |
5555
|--------|-------------|
5656
| `--coverage` | Enable code coverage tracking |
57-
| `--coverage-paths <paths>` | Comma-separated paths to track (default: `src/`) |
57+
| `--coverage-paths <paths>` | Comma-separated paths to track (default: auto-discover from test files) |
5858
| `--coverage-exclude <patterns>` | Comma-separated exclusion patterns |
5959
| `--coverage-report <file>` | LCOV report output path (default: `coverage/lcov.info`) |
6060
| `--coverage-report-html <dir>` | Generate HTML coverage report with line-by-line details |
@@ -65,6 +65,21 @@ The DEBUG trap adds overhead to test execution. For large test suites, consider
6565
Coverage is automatically enabled when using `--coverage-report`, `--coverage-report-html`, or `--coverage-min`. You don't need to specify `--coverage` explicitly with these options.
6666
:::
6767

68+
### Auto-Discovery
69+
70+
When `BASHUNIT_COVERAGE_PATHS` is not set, bashunit automatically discovers source files based on your test file names:
71+
72+
| Test File | Discovers |
73+
|-----------|-----------|
74+
| `tests/unit/assert_test.sh` | `src/assert.sh`, `src/assert_*.sh` |
75+
| `tests/unit/helperTest.sh` | `src/helper.sh`, `src/helper*.sh` |
76+
77+
This convention follows the common pattern of naming test files after their source files with a `_test.sh` or `Test.sh` suffix.
78+
79+
::: tip Zero Configuration
80+
For most projects following standard naming conventions, you can simply run `bashunit tests/ --coverage` without any path configuration.
81+
:::
82+
6883
### Environment Variables
6984

7085
You can also configure coverage via environment variables in your `.env` file:
@@ -329,6 +344,8 @@ These lines are not counted toward coverage:
329344
- Comment lines (including shebang `#!/usr/bin/env bash`)
330345
- Function declaration lines (`function foo() {`)
331346
- Lines with only braces (`{` or `}`)
347+
- Control flow keywords (`then`, `else`, `fi`, `do`, `done`, `esac`, `in`)
348+
- Case statement patterns (`--option)`, `*)`) and terminators (`;;`, `;&`, `;;&`)
332349

333350
## Limitations
334351

0 commit comments

Comments
 (0)