Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4f24731
ref(console): reuse one duration formatter instead of an inline copy
Chemaclass Jul 24, 2026
8ebcbd3
docs: remove work-in-motion narration and fix stale branch-kind comment
Chemaclass Jul 24, 2026
6186450
fix(runner): fail loudly on internal errors instead of swallowing them
Chemaclass Jul 24, 2026
68a2753
ref(env): consolidate shared data contracts into single sources of truth
Chemaclass Jul 24, 2026
2ec94a5
ref: remove superseded internal helpers and an unreachable runner branch
Chemaclass Jul 24, 2026
8312bbb
ref(src): break the env/globals and parallel/state call cycles
Chemaclass Jul 24, 2026
77914ec
merge: error-hiding fixes (Gimli) into staging
Chemaclass Jul 24, 2026
938dc01
ref: remove dead helpers and an unreferenced fixture
Chemaclass Jul 24, 2026
6ecbb99
Merge branch 'worktree-agent-ac8975473afa60392' into cleanup/staging
Chemaclass Jul 24, 2026
fd982ec
test(assert): pin the assertion-label fallback for non-test frames
Chemaclass Jul 24, 2026
9d573f0
merge: legacy removals (Boromir) into staging
Chemaclass Jul 24, 2026
caa58bc
ref(assert): collapse the repeated failure-reporting block into fail_…
Chemaclass Jul 24, 2026
27e87e7
fix(assert): report assert_arrays_equal failures with the assertion's…
Chemaclass Jul 24, 2026
bc981b8
merge: dead-code removals (Gandalf) into staging
Chemaclass Jul 24, 2026
aace07f
merge: comment cleanup (Galadriel) into staging
Chemaclass Jul 24, 2026
246be12
fix(helpers): expand glob paths without eval
Chemaclass Jul 24, 2026
bfb9534
fix(assert): fail closed when an exit-code operand is not an integer
Chemaclass Jul 24, 2026
af3c132
fix(assert): guard empty variadic actual under set -u on bash 3.x
Chemaclass Jul 24, 2026
3e2af14
fix(runner): treat an unparseable result payload as zero, not a crash
Chemaclass Jul 24, 2026
757c392
ref(doubles): replace [[ =~ ]] with a bash 3.0 case glob
Chemaclass Jul 24, 2026
1852e2b
ref(runner): name the repeated stop-on-failure branch
Chemaclass Jul 24, 2026
c4cf583
merge: assertion dedup (Frodo) into staging
Chemaclass Jul 24, 2026
6dcbb5e
merge: weak-typing fixes (Legolas) into staging
Chemaclass Jul 24, 2026
c46e61d
docs: update changelog
Chemaclass Jul 25, 2026
ec6b129
fix(env): stop .env.example from clobbering caller-set variables
Chemaclass Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/architecture-map.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ bashunit (entry) sources all src/*.sh; version gate; early flag scan
│ parallel: + write .result via mktemp
└─ console_results::print_successful_test / _failed_ / …
└─ str::rpad + strip_ansi align per-test time (pure bash)
└─ [--parallel] wait; parallel::aggregate_test_results over *.result files
└─ [--parallel] wait; state::aggregate_parallel_results over *.result files
└─ console_results::render_result totals; deferred failure/skip blocks
└─ rerun::persist; env::cleanup_run_output_dir; exit code
```
Expand Down
9 changes: 8 additions & 1 deletion .env.example
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,13 @@
# bashunit Configuration
# Copy this file to .env and customize as needed
# All values shown are defaults (leave empty to use default)
#
# Do NOT add a variable here just to document it. .env is loaded with
# `set -o allexport; source .env`, so every line is an unconditional assignment:
# listing a name makes an empty value OVERRIDE one the caller exported or set on
# the command line (`BASHUNIT_OUTPUT_FORMAT=tap ./bashunit` stops working).
# Settings that must stay overridable are documented in docs/configuration.md
# instead. `.bashunitrc` does not have this problem — it applies only when unset.
################################################################################

#───────────────────────────────────────────────────────────────────────────────
Expand All@@ -19,7 +26,7 @@ BASHUNIT_HEADER_ASCII_ART= # Default: false
BASHUNIT_SIMPLE_OUTPUT= # Default: false (use dots instead of test names)
BASHUNIT_VERBOSE= # Default: false (show environment variables)
BASHUNIT_NO_OUTPUT= # Default: false (suppress all output)
BASHUNIT_SHOW_EXECUTION_TIME= # Default: true
BASHUNIT_SHOW_EXECUTION_TIME= # Default: auto (true|false|auto; auto skips per-test times when the clock forks)
BASHUNIT_SHOW_SKIPPED= # Default: false (show skipped test details)
BASHUNIT_SHOW_INCOMPLETE= # Default: false (show incomplete test details)
BASHUNIT_FAILURES_ONLY= # Default: false (only show failures)
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,23 @@
### Added
- Per-line execution hit counts in the text report: `BASHUNIT_COVERAGE_SHOW_LINE_HITS=true` prints a `Line Hits` block listing each covered line as `<lineno>:<count>` per file. The LCOV report already carried the same counts in its `DA:<line>,<count>` records; those are now pinned by tests (#856)

### Changed
- The `--parallel` unsupported-OS warning no longer claims Alpine is excluded: Alpine has been a supported parallel platform since the race conditions were fixed, the message was simply never updated

### Fixed
- `.env.example` documented `BASHUNIT_SHOW_EXECUTION_TIME` as defaulting to `true`; the actual default has been `auto` since #765
- bashunit now aborts with an actionable error when its scratch directories under `TMPDIR` cannot be created. Previously the run continued with every failure/skip collector writing nowhere, so a failing suite still exited non-zero but lost its assertion detail and leaked raw `src/runner.sh: line N: ...: Not a directory` errors instead of reporting the cause
- A test file whose `set_up_before_script` changes directory no longer silently drops the remaining files from the run when the original working directory has become unreachable; the run aborts with a clear error instead
- `release.sh` reports a failed rollback as failed instead of always printing "Rollback complete", and aborts when neither the tar nor the `cp` sandbox copy produced a usable project copy
- `assert_arrays_equal` no longer reports the internal label `Bashunit::assert::label` when it fails outside a test function (for example from a `set_up` hook); it now reports `Assert arrays equal`, matching every other assertion
- The exit-code assertions (`assert_exit_code`, `assert_successful_code`, `assert_unsuccessful_code`, `assert_general_error`, `assert_command_not_found`) counted the assertion as **passed** when given a non-integer exit code: `[ x -ne y ]` exits 2 rather than 1 on an unparseable operand, and that was read as "equal". They now fail closed
- A test path containing both a glob and a space (`./bashunit "my tests/*"`) is no longer word-split into bogus search roots, which silently discovered zero tests; the path is also no longer passed through `eval`
- The variadic assertions (`assert_contains` and friends) called with the actual value omitted now report a clean failed assertion on Bash 3.2 instead of aborting the run with `unbound variable` under `--strict`
- An unreadable or truncated parallel `.result` file is now counted as a failed test instead of aborting aggregation with an arithmetic syntax error

### Removed
- Dead internal code with no remaining callers: the pre-cache fallback branch of the runner's `call_test_functions` (unreachable since the per-file function list became mandatory), `bashunit::state::calculate_total_assertions` (superseded by `bashunit::runner::compute_total_assertions`), `bashunit::coverage::get_line_hits` (superseded by `bashunit::coverage::get_all_line_hits`), `bashunit::helper::trim` and `bashunit::dependencies::has_adjtimex`. All are internal (sub-namespaced) helpers, not part of the documented public API

## [0.43.0](https://github.com/TypedDevs/bashunit/compare/0.42.0...0.43.0) - 2026-07-24

### Added
Expand Down
25 changes: 23 additions & 2 deletions release.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -326,8 +326,15 @@ function release::rollback::restore_files() {

function release::rollback::auto() {
release::log_error "Release failed. Initiating rollback..."
release::rollback::restore_files || true
release::log_info "Rollback complete. Files restored to pre-release state."
# `if` (not `|| true`) so a failed restore is reported as such: announcing
# "Rollback complete" over a restore that never happened sends the operator
# away from a half-released working tree.
if release::rollback::restore_files; then
release::log_info "Rollback complete. Files restored to pre-release state."
else
release::log_error "Rollback FAILED: files were not restored from backup."
release::log_error "The working tree may be left in a half-released state."
fi
release::log_info "Manual rollback command if needed: ./release.sh --rollback"
}

Expand DownExpand Up@@ -400,6 +407,20 @@ function release::sandbox::create() {
"$SANDBOX_DIR/node_modules" "$SANDBOX_DIR/.tasks" "$SANDBOX_DIR/tmp"
release::log_verbose "Copied project files to sandbox (cp)"
fi

# Neither copy method reports a conclusive exit code (the tar pipe silences
# its own stderr, and `cp -r` may trip over transient files), so assert the
# postcondition explicitly. A sandbox rehearsal on an empty directory would
# otherwise "pass" every step it never actually ran.
if [ ! -f "$SANDBOX_DIR/bashunit" ]; then
release::log_error "Failed to copy the project into the sandbox: $SANDBOX_DIR"
release::log_error "Neither the tar pipe nor the cp fallback produced a usable copy."
# Default the constant: when release.sh is sourced from a function (the unit
# tests do), its top-level `declare -r` is function-local and long gone by
# now — a bare `exit $EXIT_EXECUTION_ERROR` would then exit 0 and turn this
# fatal error into a silent pass.
exit "${EXIT_EXECUTION_ERROR:-2}"
fi
}

function release::sandbox::setup_git() {
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
ref: codebase quality sweep — dedup, dead code, cycles and defensive-code audit by Chemaclass · Pull Request #862 · TypedDevs/bashunit · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4f24731
ref(console): reuse one duration formatter instead of an inline copy
Chemaclass Jul 24, 2026
8ebcbd3
docs: remove work-in-motion narration and fix stale branch-kind comment
Chemaclass Jul 24, 2026
6186450
fix(runner): fail loudly on internal errors instead of swallowing them
Chemaclass Jul 24, 2026
68a2753
ref(env): consolidate shared data contracts into single sources of truth
Chemaclass Jul 24, 2026
2ec94a5
ref: remove superseded internal helpers and an unreachable runner branch
Chemaclass Jul 24, 2026
8312bbb
ref(src): break the env/globals and parallel/state call cycles
Chemaclass Jul 24, 2026
77914ec
merge: error-hiding fixes (Gimli) into staging
Chemaclass Jul 24, 2026
938dc01
ref: remove dead helpers and an unreferenced fixture
Chemaclass Jul 24, 2026
6ecbb99
Merge branch 'worktree-agent-ac8975473afa60392' into cleanup/staging
Chemaclass Jul 24, 2026
fd982ec
test(assert): pin the assertion-label fallback for non-test frames
Chemaclass Jul 24, 2026
9d573f0
merge: legacy removals (Boromir) into staging
Chemaclass Jul 24, 2026
caa58bc
ref(assert): collapse the repeated failure-reporting block into fail_…
Chemaclass Jul 24, 2026
27e87e7
fix(assert): report assert_arrays_equal failures with the assertion's…
Chemaclass Jul 24, 2026
bc981b8
merge: dead-code removals (Gandalf) into staging
Chemaclass Jul 24, 2026
aace07f
merge: comment cleanup (Galadriel) into staging
Chemaclass Jul 24, 2026
246be12
fix(helpers): expand glob paths without eval
Chemaclass Jul 24, 2026
bfb9534
fix(assert): fail closed when an exit-code operand is not an integer
Chemaclass Jul 24, 2026
af3c132
fix(assert): guard empty variadic actual under set -u on bash 3.x
Chemaclass Jul 24, 2026
3e2af14
fix(runner): treat an unparseable result payload as zero, not a crash
Chemaclass Jul 24, 2026
757c392
ref(doubles): replace [[ =~ ]] with a bash 3.0 case glob
Chemaclass Jul 24, 2026
1852e2b
ref(runner): name the repeated stop-on-failure branch
Chemaclass Jul 24, 2026
c4cf583
merge: assertion dedup (Frodo) into staging
Chemaclass Jul 24, 2026
6dcbb5e
merge: weak-typing fixes (Legolas) into staging
Chemaclass Jul 24, 2026
c46e61d
docs: update changelog
Chemaclass Jul 25, 2026
ec6b129
fix(env): stop .env.example from clobbering caller-set variables
Chemaclass Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/architecture-map.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ bashunit (entry) sources all src/*.sh; version gate; early flag scan
│ parallel: + write .result via mktemp
└─ console_results::print_successful_test / _failed_ / …
└─ str::rpad + strip_ansi align per-test time (pure bash)
└─ [--parallel] wait; parallel::aggregate_test_results over *.result files
└─ [--parallel] wait; state::aggregate_parallel_results over *.result files
└─ console_results::render_result totals; deferred failure/skip blocks
└─ rerun::persist; env::cleanup_run_output_dir; exit code
```
Expand Down
9 changes: 8 additions & 1 deletion .env.example
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,13 @@
# bashunit Configuration
# Copy this file to .env and customize as needed
# All values shown are defaults (leave empty to use default)
#
# Do NOT add a variable here just to document it. .env is loaded with
# `set -o allexport; source .env`, so every line is an unconditional assignment:
# listing a name makes an empty value OVERRIDE one the caller exported or set on
# the command line (`BASHUNIT_OUTPUT_FORMAT=tap ./bashunit` stops working).
# Settings that must stay overridable are documented in docs/configuration.md
# instead. `.bashunitrc` does not have this problem — it applies only when unset.
################################################################################

#───────────────────────────────────────────────────────────────────────────────
Expand All@@ -19,7 +26,7 @@ BASHUNIT_HEADER_ASCII_ART= # Default: false
BASHUNIT_SIMPLE_OUTPUT= # Default: false (use dots instead of test names)
BASHUNIT_VERBOSE= # Default: false (show environment variables)
BASHUNIT_NO_OUTPUT= # Default: false (suppress all output)
BASHUNIT_SHOW_EXECUTION_TIME= # Default: true
BASHUNIT_SHOW_EXECUTION_TIME= # Default: auto (true|false|auto; auto skips per-test times when the clock forks)
BASHUNIT_SHOW_SKIPPED= # Default: false (show skipped test details)
BASHUNIT_SHOW_INCOMPLETE= # Default: false (show incomplete test details)
BASHUNIT_FAILURES_ONLY= # Default: false (only show failures)
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,23 @@
### Added
- Per-line execution hit counts in the text report: `BASHUNIT_COVERAGE_SHOW_LINE_HITS=true` prints a `Line Hits` block listing each covered line as `<lineno>:<count>` per file. The LCOV report already carried the same counts in its `DA:<line>,<count>` records; those are now pinned by tests (#856)

### Changed
- The `--parallel` unsupported-OS warning no longer claims Alpine is excluded: Alpine has been a supported parallel platform since the race conditions were fixed, the message was simply never updated

### Fixed
- `.env.example` documented `BASHUNIT_SHOW_EXECUTION_TIME` as defaulting to `true`; the actual default has been `auto` since #765
- bashunit now aborts with an actionable error when its scratch directories under `TMPDIR` cannot be created. Previously the run continued with every failure/skip collector writing nowhere, so a failing suite still exited non-zero but lost its assertion detail and leaked raw `src/runner.sh: line N: ...: Not a directory` errors instead of reporting the cause
- A test file whose `set_up_before_script` changes directory no longer silently drops the remaining files from the run when the original working directory has become unreachable; the run aborts with a clear error instead
- `release.sh` reports a failed rollback as failed instead of always printing "Rollback complete", and aborts when neither the tar nor the `cp` sandbox copy produced a usable project copy
- `assert_arrays_equal` no longer reports the internal label `Bashunit::assert::label` when it fails outside a test function (for example from a `set_up` hook); it now reports `Assert arrays equal`, matching every other assertion
- The exit-code assertions (`assert_exit_code`, `assert_successful_code`, `assert_unsuccessful_code`, `assert_general_error`, `assert_command_not_found`) counted the assertion as **passed** when given a non-integer exit code: `[ x -ne y ]` exits 2 rather than 1 on an unparseable operand, and that was read as "equal". They now fail closed
- A test path containing both a glob and a space (`./bashunit "my tests/*"`) is no longer word-split into bogus search roots, which silently discovered zero tests; the path is also no longer passed through `eval`
- The variadic assertions (`assert_contains` and friends) called with the actual value omitted now report a clean failed assertion on Bash 3.2 instead of aborting the run with `unbound variable` under `--strict`
- An unreadable or truncated parallel `.result` file is now counted as a failed test instead of aborting aggregation with an arithmetic syntax error

### Removed
- Dead internal code with no remaining callers: the pre-cache fallback branch of the runner's `call_test_functions` (unreachable since the per-file function list became mandatory), `bashunit::state::calculate_total_assertions` (superseded by `bashunit::runner::compute_total_assertions`), `bashunit::coverage::get_line_hits` (superseded by `bashunit::coverage::get_all_line_hits`), `bashunit::helper::trim` and `bashunit::dependencies::has_adjtimex`. All are internal (sub-namespaced) helpers, not part of the documented public API

## [0.43.0](https://github.com/TypedDevs/bashunit/compare/0.42.0...0.43.0) - 2026-07-24

### Added
Expand Down
25 changes: 23 additions & 2 deletions release.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -326,8 +326,15 @@ function release::rollback::restore_files() {

function release::rollback::auto() {
release::log_error "Release failed. Initiating rollback..."
release::rollback::restore_files || true
release::log_info "Rollback complete. Files restored to pre-release state."
# `if` (not `|| true`) so a failed restore is reported as such: announcing
# "Rollback complete" over a restore that never happened sends the operator
# away from a half-released working tree.
if release::rollback::restore_files; then
release::log_info "Rollback complete. Files restored to pre-release state."
else
release::log_error "Rollback FAILED: files were not restored from backup."
release::log_error "The working tree may be left in a half-released state."
fi
release::log_info "Manual rollback command if needed: ./release.sh --rollback"
}

Expand DownExpand Up@@ -400,6 +407,20 @@ function release::sandbox::create() {
"$SANDBOX_DIR/node_modules" "$SANDBOX_DIR/.tasks" "$SANDBOX_DIR/tmp"
release::log_verbose "Copied project files to sandbox (cp)"
fi

# Neither copy method reports a conclusive exit code (the tar pipe silences
# its own stderr, and `cp -r` may trip over transient files), so assert the
# postcondition explicitly. A sandbox rehearsal on an empty directory would
# otherwise "pass" every step it never actually ran.
if [ ! -f "$SANDBOX_DIR/bashunit" ]; then
release::log_error "Failed to copy the project into the sandbox: $SANDBOX_DIR"
release::log_error "Neither the tar pipe nor the cp fallback produced a usable copy."
# Default the constant: when release.sh is sourced from a function (the unit
# tests do), its top-level `declare -r` is function-local and long gone by
# now — a bare `exit $EXIT_EXECUTION_ERROR` would then exit 0 and turn this
# fatal error into a silent pass.
exit "${EXIT_EXECUTION_ERROR:-2}"
fi
}

function release::sandbox::setup_git() {
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ref: codebase quality sweep — dedup, dead code, cycles and defensive-code audit by Chemaclass · Pull Request #862 · TypedDevs/bashunit · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4f24731
ref(console): reuse one duration formatter instead of an inline copy
Chemaclass Jul 24, 2026
8ebcbd3
docs: remove work-in-motion narration and fix stale branch-kind comment
Chemaclass Jul 24, 2026
6186450
fix(runner): fail loudly on internal errors instead of swallowing them
Chemaclass Jul 24, 2026
68a2753
ref(env): consolidate shared data contracts into single sources of truth
Chemaclass Jul 24, 2026
2ec94a5
ref: remove superseded internal helpers and an unreachable runner branch
Chemaclass Jul 24, 2026
8312bbb
ref(src): break the env/globals and parallel/state call cycles
Chemaclass Jul 24, 2026
77914ec
merge: error-hiding fixes (Gimli) into staging
Chemaclass Jul 24, 2026
938dc01
ref: remove dead helpers and an unreferenced fixture
Chemaclass Jul 24, 2026
6ecbb99
Merge branch 'worktree-agent-ac8975473afa60392' into cleanup/staging
Chemaclass Jul 24, 2026
fd982ec
test(assert): pin the assertion-label fallback for non-test frames
Chemaclass Jul 24, 2026
9d573f0
merge: legacy removals (Boromir) into staging
Chemaclass Jul 24, 2026
caa58bc
ref(assert): collapse the repeated failure-reporting block into fail_…
Chemaclass Jul 24, 2026
27e87e7
fix(assert): report assert_arrays_equal failures with the assertion's…
Chemaclass Jul 24, 2026
bc981b8
merge: dead-code removals (Gandalf) into staging
Chemaclass Jul 24, 2026
aace07f
merge: comment cleanup (Galadriel) into staging
Chemaclass Jul 24, 2026
246be12
fix(helpers): expand glob paths without eval
Chemaclass Jul 24, 2026
bfb9534
fix(assert): fail closed when an exit-code operand is not an integer
Chemaclass Jul 24, 2026
af3c132
fix(assert): guard empty variadic actual under set -u on bash 3.x
Chemaclass Jul 24, 2026
3e2af14
fix(runner): treat an unparseable result payload as zero, not a crash
Chemaclass Jul 24, 2026
757c392
ref(doubles): replace [[ =~ ]] with a bash 3.0 case glob
Chemaclass Jul 24, 2026
1852e2b
ref(runner): name the repeated stop-on-failure branch
Chemaclass Jul 24, 2026
c4cf583
merge: assertion dedup (Frodo) into staging
Chemaclass Jul 24, 2026
6dcbb5e
merge: weak-typing fixes (Legolas) into staging
Chemaclass Jul 24, 2026
c46e61d
docs: update changelog
Chemaclass Jul 25, 2026
ec6b129
fix(env): stop .env.example from clobbering caller-set variables
Chemaclass Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/architecture-map.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ bashunit (entry) sources all src/*.sh; version gate; early flag scan
│ parallel: + write .result via mktemp
└─ console_results::print_successful_test / _failed_ / …
└─ str::rpad + strip_ansi align per-test time (pure bash)
└─ [--parallel] wait; parallel::aggregate_test_results over *.result files
└─ [--parallel] wait; state::aggregate_parallel_results over *.result files
└─ console_results::render_result totals; deferred failure/skip blocks
└─ rerun::persist; env::cleanup_run_output_dir; exit code
```
Expand Down
9 changes: 8 additions & 1 deletion .env.example
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,13 @@
# bashunit Configuration
# Copy this file to .env and customize as needed
# All values shown are defaults (leave empty to use default)
#
# Do NOT add a variable here just to document it. .env is loaded with
# `set -o allexport; source .env`, so every line is an unconditional assignment:
# listing a name makes an empty value OVERRIDE one the caller exported or set on
# the command line (`BASHUNIT_OUTPUT_FORMAT=tap ./bashunit` stops working).
# Settings that must stay overridable are documented in docs/configuration.md
# instead. `.bashunitrc` does not have this problem — it applies only when unset.
################################################################################

#───────────────────────────────────────────────────────────────────────────────
Expand All@@ -19,7 +26,7 @@ BASHUNIT_HEADER_ASCII_ART= # Default: false
BASHUNIT_SIMPLE_OUTPUT= # Default: false (use dots instead of test names)
BASHUNIT_VERBOSE= # Default: false (show environment variables)
BASHUNIT_NO_OUTPUT= # Default: false (suppress all output)
BASHUNIT_SHOW_EXECUTION_TIME= # Default: true
BASHUNIT_SHOW_EXECUTION_TIME= # Default: auto (true|false|auto; auto skips per-test times when the clock forks)
BASHUNIT_SHOW_SKIPPED= # Default: false (show skipped test details)
BASHUNIT_SHOW_INCOMPLETE= # Default: false (show incomplete test details)
BASHUNIT_FAILURES_ONLY= # Default: false (only show failures)
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,23 @@
### Added
- Per-line execution hit counts in the text report: `BASHUNIT_COVERAGE_SHOW_LINE_HITS=true` prints a `Line Hits` block listing each covered line as `<lineno>:<count>` per file. The LCOV report already carried the same counts in its `DA:<line>,<count>` records; those are now pinned by tests (#856)

### Changed
- The `--parallel` unsupported-OS warning no longer claims Alpine is excluded: Alpine has been a supported parallel platform since the race conditions were fixed, the message was simply never updated

### Fixed
- `.env.example` documented `BASHUNIT_SHOW_EXECUTION_TIME` as defaulting to `true`; the actual default has been `auto` since #765
- bashunit now aborts with an actionable error when its scratch directories under `TMPDIR` cannot be created. Previously the run continued with every failure/skip collector writing nowhere, so a failing suite still exited non-zero but lost its assertion detail and leaked raw `src/runner.sh: line N: ...: Not a directory` errors instead of reporting the cause
- A test file whose `set_up_before_script` changes directory no longer silently drops the remaining files from the run when the original working directory has become unreachable; the run aborts with a clear error instead
- `release.sh` reports a failed rollback as failed instead of always printing "Rollback complete", and aborts when neither the tar nor the `cp` sandbox copy produced a usable project copy
- `assert_arrays_equal` no longer reports the internal label `Bashunit::assert::label` when it fails outside a test function (for example from a `set_up` hook); it now reports `Assert arrays equal`, matching every other assertion
- The exit-code assertions (`assert_exit_code`, `assert_successful_code`, `assert_unsuccessful_code`, `assert_general_error`, `assert_command_not_found`) counted the assertion as **passed** when given a non-integer exit code: `[ x -ne y ]` exits 2 rather than 1 on an unparseable operand, and that was read as "equal". They now fail closed
- A test path containing both a glob and a space (`./bashunit "my tests/*"`) is no longer word-split into bogus search roots, which silently discovered zero tests; the path is also no longer passed through `eval`
- The variadic assertions (`assert_contains` and friends) called with the actual value omitted now report a clean failed assertion on Bash 3.2 instead of aborting the run with `unbound variable` under `--strict`
- An unreadable or truncated parallel `.result` file is now counted as a failed test instead of aborting aggregation with an arithmetic syntax error

### Removed
- Dead internal code with no remaining callers: the pre-cache fallback branch of the runner's `call_test_functions` (unreachable since the per-file function list became mandatory), `bashunit::state::calculate_total_assertions` (superseded by `bashunit::runner::compute_total_assertions`), `bashunit::coverage::get_line_hits` (superseded by `bashunit::coverage::get_all_line_hits`), `bashunit::helper::trim` and `bashunit::dependencies::has_adjtimex`. All are internal (sub-namespaced) helpers, not part of the documented public API

## [0.43.0](https://github.com/TypedDevs/bashunit/compare/0.42.0...0.43.0) - 2026-07-24

### Added
Expand Down
25 changes: 23 additions & 2 deletions release.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -326,8 +326,15 @@ function release::rollback::restore_files() {

function release::rollback::auto() {
release::log_error "Release failed. Initiating rollback..."
release::rollback::restore_files || true
release::log_info "Rollback complete. Files restored to pre-release state."
# `if` (not `|| true`) so a failed restore is reported as such: announcing
# "Rollback complete" over a restore that never happened sends the operator
# away from a half-released working tree.
if release::rollback::restore_files; then
release::log_info "Rollback complete. Files restored to pre-release state."
else
release::log_error "Rollback FAILED: files were not restored from backup."
release::log_error "The working tree may be left in a half-released state."
fi
release::log_info "Manual rollback command if needed: ./release.sh --rollback"
}

Expand DownExpand Up@@ -400,6 +407,20 @@ function release::sandbox::create() {
"$SANDBOX_DIR/node_modules" "$SANDBOX_DIR/.tasks" "$SANDBOX_DIR/tmp"
release::log_verbose "Copied project files to sandbox (cp)"
fi

# Neither copy method reports a conclusive exit code (the tar pipe silences
# its own stderr, and `cp -r` may trip over transient files), so assert the
# postcondition explicitly. A sandbox rehearsal on an empty directory would
# otherwise "pass" every step it never actually ran.
if [ ! -f "$SANDBOX_DIR/bashunit" ]; then
release::log_error "Failed to copy the project into the sandbox: $SANDBOX_DIR"
release::log_error "Neither the tar pipe nor the cp fallback produced a usable copy."
# Default the constant: when release.sh is sourced from a function (the unit
# tests do), its top-level `declare -r` is function-local and long gone by
# now — a bare `exit $EXIT_EXECUTION_ERROR` would then exit 0 and turn this
# fatal error into a silent pass.
exit "${EXIT_EXECUTION_ERROR:-2}"
fi
}

function release::sandbox::setup_git() {
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ref: codebase quality sweep — dedup, dead code, cycles and defensive-code audit by Chemaclass · Pull Request #862 · TypedDevs/bashunit · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4f24731
ref(console): reuse one duration formatter instead of an inline copy
Chemaclass Jul 24, 2026
8ebcbd3
docs: remove work-in-motion narration and fix stale branch-kind comment
Chemaclass Jul 24, 2026
6186450
fix(runner): fail loudly on internal errors instead of swallowing them
Chemaclass Jul 24, 2026
68a2753
ref(env): consolidate shared data contracts into single sources of truth
Chemaclass Jul 24, 2026
2ec94a5
ref: remove superseded internal helpers and an unreachable runner branch
Chemaclass Jul 24, 2026
8312bbb
ref(src): break the env/globals and parallel/state call cycles
Chemaclass Jul 24, 2026
77914ec
merge: error-hiding fixes (Gimli) into staging
Chemaclass Jul 24, 2026
938dc01
ref: remove dead helpers and an unreferenced fixture
Chemaclass Jul 24, 2026
6ecbb99
Merge branch 'worktree-agent-ac8975473afa60392' into cleanup/staging
Chemaclass Jul 24, 2026
fd982ec
test(assert): pin the assertion-label fallback for non-test frames
Chemaclass Jul 24, 2026
9d573f0
merge: legacy removals (Boromir) into staging
Chemaclass Jul 24, 2026
caa58bc
ref(assert): collapse the repeated failure-reporting block into fail_…
Chemaclass Jul 24, 2026
27e87e7
fix(assert): report assert_arrays_equal failures with the assertion's…
Chemaclass Jul 24, 2026
bc981b8
merge: dead-code removals (Gandalf) into staging
Chemaclass Jul 24, 2026
aace07f
merge: comment cleanup (Galadriel) into staging
Chemaclass Jul 24, 2026
246be12
fix(helpers): expand glob paths without eval
Chemaclass Jul 24, 2026
bfb9534
fix(assert): fail closed when an exit-code operand is not an integer
Chemaclass Jul 24, 2026
af3c132
fix(assert): guard empty variadic actual under set -u on bash 3.x
Chemaclass Jul 24, 2026
3e2af14
fix(runner): treat an unparseable result payload as zero, not a crash
Chemaclass Jul 24, 2026
757c392
ref(doubles): replace [[ =~ ]] with a bash 3.0 case glob
Chemaclass Jul 24, 2026
1852e2b
ref(runner): name the repeated stop-on-failure branch
Chemaclass Jul 24, 2026
c4cf583
merge: assertion dedup (Frodo) into staging
Chemaclass Jul 24, 2026
6dcbb5e
merge: weak-typing fixes (Legolas) into staging
Chemaclass Jul 24, 2026
c46e61d
docs: update changelog
Chemaclass Jul 25, 2026
ec6b129
fix(env): stop .env.example from clobbering caller-set variables
Chemaclass Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/architecture-map.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ bashunit (entry) sources all src/*.sh; version gate; early flag scan
│ parallel: + write .result via mktemp
└─ console_results::print_successful_test / _failed_ / …
└─ str::rpad + strip_ansi align per-test time (pure bash)
└─ [--parallel] wait; parallel::aggregate_test_results over *.result files
└─ [--parallel] wait; state::aggregate_parallel_results over *.result files
└─ console_results::render_result totals; deferred failure/skip blocks
└─ rerun::persist; env::cleanup_run_output_dir; exit code
```
Expand Down
9 changes: 8 additions & 1 deletion .env.example
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,13 @@
# bashunit Configuration
# Copy this file to .env and customize as needed
# All values shown are defaults (leave empty to use default)
#
# Do NOT add a variable here just to document it. .env is loaded with
# `set -o allexport; source .env`, so every line is an unconditional assignment:
# listing a name makes an empty value OVERRIDE one the caller exported or set on
# the command line (`BASHUNIT_OUTPUT_FORMAT=tap ./bashunit` stops working).
# Settings that must stay overridable are documented in docs/configuration.md
# instead. `.bashunitrc` does not have this problem — it applies only when unset.
################################################################################

#───────────────────────────────────────────────────────────────────────────────
Expand All@@ -19,7 +26,7 @@ BASHUNIT_HEADER_ASCII_ART= # Default: false
BASHUNIT_SIMPLE_OUTPUT= # Default: false (use dots instead of test names)
BASHUNIT_VERBOSE= # Default: false (show environment variables)
BASHUNIT_NO_OUTPUT= # Default: false (suppress all output)
BASHUNIT_SHOW_EXECUTION_TIME= # Default: true
BASHUNIT_SHOW_EXECUTION_TIME= # Default: auto (true|false|auto; auto skips per-test times when the clock forks)
BASHUNIT_SHOW_SKIPPED= # Default: false (show skipped test details)
BASHUNIT_SHOW_INCOMPLETE= # Default: false (show incomplete test details)
BASHUNIT_FAILURES_ONLY= # Default: false (only show failures)
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,23 @@
### Added
- Per-line execution hit counts in the text report: `BASHUNIT_COVERAGE_SHOW_LINE_HITS=true` prints a `Line Hits` block listing each covered line as `<lineno>:<count>` per file. The LCOV report already carried the same counts in its `DA:<line>,<count>` records; those are now pinned by tests (#856)

### Changed
- The `--parallel` unsupported-OS warning no longer claims Alpine is excluded: Alpine has been a supported parallel platform since the race conditions were fixed, the message was simply never updated

### Fixed
- `.env.example` documented `BASHUNIT_SHOW_EXECUTION_TIME` as defaulting to `true`; the actual default has been `auto` since #765
- bashunit now aborts with an actionable error when its scratch directories under `TMPDIR` cannot be created. Previously the run continued with every failure/skip collector writing nowhere, so a failing suite still exited non-zero but lost its assertion detail and leaked raw `src/runner.sh: line N: ...: Not a directory` errors instead of reporting the cause
- A test file whose `set_up_before_script` changes directory no longer silently drops the remaining files from the run when the original working directory has become unreachable; the run aborts with a clear error instead
- `release.sh` reports a failed rollback as failed instead of always printing "Rollback complete", and aborts when neither the tar nor the `cp` sandbox copy produced a usable project copy
- `assert_arrays_equal` no longer reports the internal label `Bashunit::assert::label` when it fails outside a test function (for example from a `set_up` hook); it now reports `Assert arrays equal`, matching every other assertion
- The exit-code assertions (`assert_exit_code`, `assert_successful_code`, `assert_unsuccessful_code`, `assert_general_error`, `assert_command_not_found`) counted the assertion as **passed** when given a non-integer exit code: `[ x -ne y ]` exits 2 rather than 1 on an unparseable operand, and that was read as "equal". They now fail closed
- A test path containing both a glob and a space (`./bashunit "my tests/*"`) is no longer word-split into bogus search roots, which silently discovered zero tests; the path is also no longer passed through `eval`
- The variadic assertions (`assert_contains` and friends) called with the actual value omitted now report a clean failed assertion on Bash 3.2 instead of aborting the run with `unbound variable` under `--strict`
- An unreadable or truncated parallel `.result` file is now counted as a failed test instead of aborting aggregation with an arithmetic syntax error

### Removed
- Dead internal code with no remaining callers: the pre-cache fallback branch of the runner's `call_test_functions` (unreachable since the per-file function list became mandatory), `bashunit::state::calculate_total_assertions` (superseded by `bashunit::runner::compute_total_assertions`), `bashunit::coverage::get_line_hits` (superseded by `bashunit::coverage::get_all_line_hits`), `bashunit::helper::trim` and `bashunit::dependencies::has_adjtimex`. All are internal (sub-namespaced) helpers, not part of the documented public API

## [0.43.0](https://github.com/TypedDevs/bashunit/compare/0.42.0...0.43.0) - 2026-07-24

### Added
Expand Down
25 changes: 23 additions & 2 deletions release.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -326,8 +326,15 @@ function release::rollback::restore_files() {

function release::rollback::auto() {
release::log_error "Release failed. Initiating rollback..."
release::rollback::restore_files || true
release::log_info "Rollback complete. Files restored to pre-release state."
# `if` (not `|| true`) so a failed restore is reported as such: announcing
# "Rollback complete" over a restore that never happened sends the operator
# away from a half-released working tree.
if release::rollback::restore_files; then
release::log_info "Rollback complete. Files restored to pre-release state."
else
release::log_error "Rollback FAILED: files were not restored from backup."
release::log_error "The working tree may be left in a half-released state."
fi
release::log_info "Manual rollback command if needed: ./release.sh --rollback"
}

Expand DownExpand Up@@ -400,6 +407,20 @@ function release::sandbox::create() {
"$SANDBOX_DIR/node_modules" "$SANDBOX_DIR/.tasks" "$SANDBOX_DIR/tmp"
release::log_verbose "Copied project files to sandbox (cp)"
fi

# Neither copy method reports a conclusive exit code (the tar pipe silences
# its own stderr, and `cp -r` may trip over transient files), so assert the
# postcondition explicitly. A sandbox rehearsal on an empty directory would
# otherwise "pass" every step it never actually ran.
if [ ! -f "$SANDBOX_DIR/bashunit" ]; then
release::log_error "Failed to copy the project into the sandbox: $SANDBOX_DIR"
release::log_error "Neither the tar pipe nor the cp fallback produced a usable copy."
# Default the constant: when release.sh is sourced from a function (the unit
# tests do), its top-level `declare -r` is function-local and long gone by
# now — a bare `exit $EXIT_EXECUTION_ERROR` would then exit 0 and turn this
# fatal error into a silent pass.
exit "${EXIT_EXECUTION_ERROR:-2}"
fi
}

function release::sandbox::setup_git() {
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' ref: codebase quality sweep — dedup, dead code, cycles and defensive-code audit by Chemaclass · Pull Request #862 · TypedDevs/bashunit · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4f24731
ref(console): reuse one duration formatter instead of an inline copy
Chemaclass Jul 24, 2026
8ebcbd3
docs: remove work-in-motion narration and fix stale branch-kind comment
Chemaclass Jul 24, 2026
6186450
fix(runner): fail loudly on internal errors instead of swallowing them
Chemaclass Jul 24, 2026
68a2753
ref(env): consolidate shared data contracts into single sources of truth
Chemaclass Jul 24, 2026
2ec94a5
ref: remove superseded internal helpers and an unreachable runner branch
Chemaclass Jul 24, 2026
8312bbb
ref(src): break the env/globals and parallel/state call cycles
Chemaclass Jul 24, 2026
77914ec
merge: error-hiding fixes (Gimli) into staging
Chemaclass Jul 24, 2026
938dc01
ref: remove dead helpers and an unreferenced fixture
Chemaclass Jul 24, 2026
6ecbb99
Merge branch 'worktree-agent-ac8975473afa60392' into cleanup/staging
Chemaclass Jul 24, 2026
fd982ec
test(assert): pin the assertion-label fallback for non-test frames
Chemaclass Jul 24, 2026
9d573f0
merge: legacy removals (Boromir) into staging
Chemaclass Jul 24, 2026
caa58bc
ref(assert): collapse the repeated failure-reporting block into fail_…
Chemaclass Jul 24, 2026
27e87e7
fix(assert): report assert_arrays_equal failures with the assertion's…
Chemaclass Jul 24, 2026
bc981b8
merge: dead-code removals (Gandalf) into staging
Chemaclass Jul 24, 2026
aace07f
merge: comment cleanup (Galadriel) into staging
Chemaclass Jul 24, 2026
246be12
fix(helpers): expand glob paths without eval
Chemaclass Jul 24, 2026
bfb9534
fix(assert): fail closed when an exit-code operand is not an integer
Chemaclass Jul 24, 2026
af3c132
fix(assert): guard empty variadic actual under set -u on bash 3.x
Chemaclass Jul 24, 2026
3e2af14
fix(runner): treat an unparseable result payload as zero, not a crash
Chemaclass Jul 24, 2026
757c392
ref(doubles): replace [[ =~ ]] with a bash 3.0 case glob
Chemaclass Jul 24, 2026
1852e2b
ref(runner): name the repeated stop-on-failure branch
Chemaclass Jul 24, 2026
c4cf583
merge: assertion dedup (Frodo) into staging
Chemaclass Jul 24, 2026
6dcbb5e
merge: weak-typing fixes (Legolas) into staging
Chemaclass Jul 24, 2026
c46e61d
docs: update changelog
Chemaclass Jul 25, 2026
ec6b129
fix(env): stop .env.example from clobbering caller-set variables
Chemaclass Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/architecture-map.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ bashunit (entry) sources all src/*.sh; version gate; early flag scan
│ parallel: + write .result via mktemp
└─ console_results::print_successful_test / _failed_ / …
└─ str::rpad + strip_ansi align per-test time (pure bash)
└─ [--parallel] wait; parallel::aggregate_test_results over *.result files
└─ [--parallel] wait; state::aggregate_parallel_results over *.result files
└─ console_results::render_result totals; deferred failure/skip blocks
└─ rerun::persist; env::cleanup_run_output_dir; exit code
```
Expand Down
9 changes: 8 additions & 1 deletion .env.example
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,13 @@
# bashunit Configuration
# Copy this file to .env and customize as needed
# All values shown are defaults (leave empty to use default)
#
# Do NOT add a variable here just to document it. .env is loaded with
# `set -o allexport; source .env`, so every line is an unconditional assignment:
# listing a name makes an empty value OVERRIDE one the caller exported or set on
# the command line (`BASHUNIT_OUTPUT_FORMAT=tap ./bashunit` stops working).
# Settings that must stay overridable are documented in docs/configuration.md
# instead. `.bashunitrc` does not have this problem — it applies only when unset.
################################################################################

#───────────────────────────────────────────────────────────────────────────────
Expand All@@ -19,7 +26,7 @@ BASHUNIT_HEADER_ASCII_ART= # Default: false
BASHUNIT_SIMPLE_OUTPUT= # Default: false (use dots instead of test names)
BASHUNIT_VERBOSE= # Default: false (show environment variables)
BASHUNIT_NO_OUTPUT= # Default: false (suppress all output)
BASHUNIT_SHOW_EXECUTION_TIME= # Default: true
BASHUNIT_SHOW_EXECUTION_TIME= # Default: auto (true|false|auto; auto skips per-test times when the clock forks)
BASHUNIT_SHOW_SKIPPED= # Default: false (show skipped test details)
BASHUNIT_SHOW_INCOMPLETE= # Default: false (show incomplete test details)
BASHUNIT_FAILURES_ONLY= # Default: false (only show failures)
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,23 @@
### Added
- Per-line execution hit counts in the text report: `BASHUNIT_COVERAGE_SHOW_LINE_HITS=true` prints a `Line Hits` block listing each covered line as `<lineno>:<count>` per file. The LCOV report already carried the same counts in its `DA:<line>,<count>` records; those are now pinned by tests (#856)

### Changed
- The `--parallel` unsupported-OS warning no longer claims Alpine is excluded: Alpine has been a supported parallel platform since the race conditions were fixed, the message was simply never updated

### Fixed
- `.env.example` documented `BASHUNIT_SHOW_EXECUTION_TIME` as defaulting to `true`; the actual default has been `auto` since #765
- bashunit now aborts with an actionable error when its scratch directories under `TMPDIR` cannot be created. Previously the run continued with every failure/skip collector writing nowhere, so a failing suite still exited non-zero but lost its assertion detail and leaked raw `src/runner.sh: line N: ...: Not a directory` errors instead of reporting the cause
- A test file whose `set_up_before_script` changes directory no longer silently drops the remaining files from the run when the original working directory has become unreachable; the run aborts with a clear error instead
- `release.sh` reports a failed rollback as failed instead of always printing "Rollback complete", and aborts when neither the tar nor the `cp` sandbox copy produced a usable project copy
- `assert_arrays_equal` no longer reports the internal label `Bashunit::assert::label` when it fails outside a test function (for example from a `set_up` hook); it now reports `Assert arrays equal`, matching every other assertion
- The exit-code assertions (`assert_exit_code`, `assert_successful_code`, `assert_unsuccessful_code`, `assert_general_error`, `assert_command_not_found`) counted the assertion as **passed** when given a non-integer exit code: `[ x -ne y ]` exits 2 rather than 1 on an unparseable operand, and that was read as "equal". They now fail closed
- A test path containing both a glob and a space (`./bashunit "my tests/*"`) is no longer word-split into bogus search roots, which silently discovered zero tests; the path is also no longer passed through `eval`
- The variadic assertions (`assert_contains` and friends) called with the actual value omitted now report a clean failed assertion on Bash 3.2 instead of aborting the run with `unbound variable` under `--strict`
- An unreadable or truncated parallel `.result` file is now counted as a failed test instead of aborting aggregation with an arithmetic syntax error

### Removed
- Dead internal code with no remaining callers: the pre-cache fallback branch of the runner's `call_test_functions` (unreachable since the per-file function list became mandatory), `bashunit::state::calculate_total_assertions` (superseded by `bashunit::runner::compute_total_assertions`), `bashunit::coverage::get_line_hits` (superseded by `bashunit::coverage::get_all_line_hits`), `bashunit::helper::trim` and `bashunit::dependencies::has_adjtimex`. All are internal (sub-namespaced) helpers, not part of the documented public API

## [0.43.0](https://github.com/TypedDevs/bashunit/compare/0.42.0...0.43.0) - 2026-07-24

### Added
Expand Down
25 changes: 23 additions & 2 deletions release.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -326,8 +326,15 @@ function release::rollback::restore_files() {

function release::rollback::auto() {
release::log_error "Release failed. Initiating rollback..."
release::rollback::restore_files || true
release::log_info "Rollback complete. Files restored to pre-release state."
# `if` (not `|| true`) so a failed restore is reported as such: announcing
# "Rollback complete" over a restore that never happened sends the operator
# away from a half-released working tree.
if release::rollback::restore_files; then
release::log_info "Rollback complete. Files restored to pre-release state."
else
release::log_error "Rollback FAILED: files were not restored from backup."
release::log_error "The working tree may be left in a half-released state."
fi
release::log_info "Manual rollback command if needed: ./release.sh --rollback"
}

Expand DownExpand Up@@ -400,6 +407,20 @@ function release::sandbox::create() {
"$SANDBOX_DIR/node_modules" "$SANDBOX_DIR/.tasks" "$SANDBOX_DIR/tmp"
release::log_verbose "Copied project files to sandbox (cp)"
fi

# Neither copy method reports a conclusive exit code (the tar pipe silences
# its own stderr, and `cp -r` may trip over transient files), so assert the
# postcondition explicitly. A sandbox rehearsal on an empty directory would
# otherwise "pass" every step it never actually ran.
if [ ! -f "$SANDBOX_DIR/bashunit" ]; then
release::log_error "Failed to copy the project into the sandbox: $SANDBOX_DIR"
release::log_error "Neither the tar pipe nor the cp fallback produced a usable copy."
# Default the constant: when release.sh is sourced from a function (the unit
# tests do), its top-level `declare -r` is function-local and long gone by
# now — a bare `exit $EXIT_EXECUTION_ERROR` would then exit 0 and turn this
# fatal error into a silent pass.
exit "${EXIT_EXECUTION_ERROR:-2}"
fi
}

function release::sandbox::setup_git() {
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ref: codebase quality sweep — dedup, dead code, cycles and defensive-code audit by Chemaclass · Pull Request #862 · TypedDevs/bashunit · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4f24731
ref(console): reuse one duration formatter instead of an inline copy
Chemaclass Jul 24, 2026
8ebcbd3
docs: remove work-in-motion narration and fix stale branch-kind comment
Chemaclass Jul 24, 2026
6186450
fix(runner): fail loudly on internal errors instead of swallowing them
Chemaclass Jul 24, 2026
68a2753
ref(env): consolidate shared data contracts into single sources of truth
Chemaclass Jul 24, 2026
2ec94a5
ref: remove superseded internal helpers and an unreachable runner branch
Chemaclass Jul 24, 2026
8312bbb
ref(src): break the env/globals and parallel/state call cycles
Chemaclass Jul 24, 2026
77914ec
merge: error-hiding fixes (Gimli) into staging
Chemaclass Jul 24, 2026
938dc01
ref: remove dead helpers and an unreferenced fixture
Chemaclass Jul 24, 2026
6ecbb99
Merge branch 'worktree-agent-ac8975473afa60392' into cleanup/staging
Chemaclass Jul 24, 2026
fd982ec
test(assert): pin the assertion-label fallback for non-test frames
Chemaclass Jul 24, 2026
9d573f0
merge: legacy removals (Boromir) into staging
Chemaclass Jul 24, 2026
caa58bc
ref(assert): collapse the repeated failure-reporting block into fail_…
Chemaclass Jul 24, 2026
27e87e7
fix(assert): report assert_arrays_equal failures with the assertion's…
Chemaclass Jul 24, 2026
bc981b8
merge: dead-code removals (Gandalf) into staging
Chemaclass Jul 24, 2026
aace07f
merge: comment cleanup (Galadriel) into staging
Chemaclass Jul 24, 2026
246be12
fix(helpers): expand glob paths without eval
Chemaclass Jul 24, 2026
bfb9534
fix(assert): fail closed when an exit-code operand is not an integer
Chemaclass Jul 24, 2026
af3c132
fix(assert): guard empty variadic actual under set -u on bash 3.x
Chemaclass Jul 24, 2026
3e2af14
fix(runner): treat an unparseable result payload as zero, not a crash
Chemaclass Jul 24, 2026
757c392
ref(doubles): replace [[ =~ ]] with a bash 3.0 case glob
Chemaclass Jul 24, 2026
1852e2b
ref(runner): name the repeated stop-on-failure branch
Chemaclass Jul 24, 2026
c4cf583
merge: assertion dedup (Frodo) into staging
Chemaclass Jul 24, 2026
6dcbb5e
merge: weak-typing fixes (Legolas) into staging
Chemaclass Jul 24, 2026
c46e61d
docs: update changelog
Chemaclass Jul 25, 2026
ec6b129
fix(env): stop .env.example from clobbering caller-set variables
Chemaclass Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/architecture-map.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ bashunit (entry) sources all src/*.sh; version gate; early flag scan
│ parallel: + write .result via mktemp
└─ console_results::print_successful_test / _failed_ / …
└─ str::rpad + strip_ansi align per-test time (pure bash)
└─ [--parallel] wait; parallel::aggregate_test_results over *.result files
└─ [--parallel] wait; state::aggregate_parallel_results over *.result files
└─ console_results::render_result totals; deferred failure/skip blocks
└─ rerun::persist; env::cleanup_run_output_dir; exit code
```
Expand Down
9 changes: 8 additions & 1 deletion .env.example
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,13 @@
# bashunit Configuration
# Copy this file to .env and customize as needed
# All values shown are defaults (leave empty to use default)
#
# Do NOT add a variable here just to document it. .env is loaded with
# `set -o allexport; source .env`, so every line is an unconditional assignment:
# listing a name makes an empty value OVERRIDE one the caller exported or set on
# the command line (`BASHUNIT_OUTPUT_FORMAT=tap ./bashunit` stops working).
# Settings that must stay overridable are documented in docs/configuration.md
# instead. `.bashunitrc` does not have this problem — it applies only when unset.
################################################################################

#───────────────────────────────────────────────────────────────────────────────
Expand All@@ -19,7 +26,7 @@ BASHUNIT_HEADER_ASCII_ART= # Default: false
BASHUNIT_SIMPLE_OUTPUT= # Default: false (use dots instead of test names)
BASHUNIT_VERBOSE= # Default: false (show environment variables)
BASHUNIT_NO_OUTPUT= # Default: false (suppress all output)
BASHUNIT_SHOW_EXECUTION_TIME= # Default: true
BASHUNIT_SHOW_EXECUTION_TIME= # Default: auto (true|false|auto; auto skips per-test times when the clock forks)
BASHUNIT_SHOW_SKIPPED= # Default: false (show skipped test details)
BASHUNIT_SHOW_INCOMPLETE= # Default: false (show incomplete test details)
BASHUNIT_FAILURES_ONLY= # Default: false (only show failures)
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,23 @@
### Added
- Per-line execution hit counts in the text report: `BASHUNIT_COVERAGE_SHOW_LINE_HITS=true` prints a `Line Hits` block listing each covered line as `<lineno>:<count>` per file. The LCOV report already carried the same counts in its `DA:<line>,<count>` records; those are now pinned by tests (#856)

### Changed
- The `--parallel` unsupported-OS warning no longer claims Alpine is excluded: Alpine has been a supported parallel platform since the race conditions were fixed, the message was simply never updated

### Fixed
- `.env.example` documented `BASHUNIT_SHOW_EXECUTION_TIME` as defaulting to `true`; the actual default has been `auto` since #765
- bashunit now aborts with an actionable error when its scratch directories under `TMPDIR` cannot be created. Previously the run continued with every failure/skip collector writing nowhere, so a failing suite still exited non-zero but lost its assertion detail and leaked raw `src/runner.sh: line N: ...: Not a directory` errors instead of reporting the cause
- A test file whose `set_up_before_script` changes directory no longer silently drops the remaining files from the run when the original working directory has become unreachable; the run aborts with a clear error instead
- `release.sh` reports a failed rollback as failed instead of always printing "Rollback complete", and aborts when neither the tar nor the `cp` sandbox copy produced a usable project copy
- `assert_arrays_equal` no longer reports the internal label `Bashunit::assert::label` when it fails outside a test function (for example from a `set_up` hook); it now reports `Assert arrays equal`, matching every other assertion
- The exit-code assertions (`assert_exit_code`, `assert_successful_code`, `assert_unsuccessful_code`, `assert_general_error`, `assert_command_not_found`) counted the assertion as **passed** when given a non-integer exit code: `[ x -ne y ]` exits 2 rather than 1 on an unparseable operand, and that was read as "equal". They now fail closed
- A test path containing both a glob and a space (`./bashunit "my tests/*"`) is no longer word-split into bogus search roots, which silently discovered zero tests; the path is also no longer passed through `eval`
- The variadic assertions (`assert_contains` and friends) called with the actual value omitted now report a clean failed assertion on Bash 3.2 instead of aborting the run with `unbound variable` under `--strict`
- An unreadable or truncated parallel `.result` file is now counted as a failed test instead of aborting aggregation with an arithmetic syntax error

### Removed
- Dead internal code with no remaining callers: the pre-cache fallback branch of the runner's `call_test_functions` (unreachable since the per-file function list became mandatory), `bashunit::state::calculate_total_assertions` (superseded by `bashunit::runner::compute_total_assertions`), `bashunit::coverage::get_line_hits` (superseded by `bashunit::coverage::get_all_line_hits`), `bashunit::helper::trim` and `bashunit::dependencies::has_adjtimex`. All are internal (sub-namespaced) helpers, not part of the documented public API

## [0.43.0](https://github.com/TypedDevs/bashunit/compare/0.42.0...0.43.0) - 2026-07-24

### Added
Expand Down
25 changes: 23 additions & 2 deletions release.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -326,8 +326,15 @@ function release::rollback::restore_files() {

function release::rollback::auto() {
release::log_error "Release failed. Initiating rollback..."
release::rollback::restore_files || true
release::log_info "Rollback complete. Files restored to pre-release state."
# `if` (not `|| true`) so a failed restore is reported as such: announcing
# "Rollback complete" over a restore that never happened sends the operator
# away from a half-released working tree.
if release::rollback::restore_files; then
release::log_info "Rollback complete. Files restored to pre-release state."
else
release::log_error "Rollback FAILED: files were not restored from backup."
release::log_error "The working tree may be left in a half-released state."
fi
release::log_info "Manual rollback command if needed: ./release.sh --rollback"
}

Expand DownExpand Up@@ -400,6 +407,20 @@ function release::sandbox::create() {
"$SANDBOX_DIR/node_modules" "$SANDBOX_DIR/.tasks" "$SANDBOX_DIR/tmp"
release::log_verbose "Copied project files to sandbox (cp)"
fi

# Neither copy method reports a conclusive exit code (the tar pipe silences
# its own stderr, and `cp -r` may trip over transient files), so assert the
# postcondition explicitly. A sandbox rehearsal on an empty directory would
# otherwise "pass" every step it never actually ran.
if [ ! -f "$SANDBOX_DIR/bashunit" ]; then
release::log_error "Failed to copy the project into the sandbox: $SANDBOX_DIR"
release::log_error "Neither the tar pipe nor the cp fallback produced a usable copy."
# Default the constant: when release.sh is sourced from a function (the unit
# tests do), its top-level `declare -r` is function-local and long gone by
# now — a bare `exit $EXIT_EXECUTION_ERROR` would then exit 0 and turn this
# fatal error into a silent pass.
exit "${EXIT_EXECUTION_ERROR:-2}"
fi
}

function release::sandbox::setup_git() {
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ref: codebase quality sweep — dedup, dead code, cycles and defensive-code audit by Chemaclass · Pull Request #862 · TypedDevs/bashunit · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4f24731
ref(console): reuse one duration formatter instead of an inline copy
Chemaclass Jul 24, 2026
8ebcbd3
docs: remove work-in-motion narration and fix stale branch-kind comment
Chemaclass Jul 24, 2026
6186450
fix(runner): fail loudly on internal errors instead of swallowing them
Chemaclass Jul 24, 2026
68a2753
ref(env): consolidate shared data contracts into single sources of truth
Chemaclass Jul 24, 2026
2ec94a5
ref: remove superseded internal helpers and an unreachable runner branch
Chemaclass Jul 24, 2026
8312bbb
ref(src): break the env/globals and parallel/state call cycles
Chemaclass Jul 24, 2026
77914ec
merge: error-hiding fixes (Gimli) into staging
Chemaclass Jul 24, 2026
938dc01
ref: remove dead helpers and an unreferenced fixture
Chemaclass Jul 24, 2026
6ecbb99
Merge branch 'worktree-agent-ac8975473afa60392' into cleanup/staging
Chemaclass Jul 24, 2026
fd982ec
test(assert): pin the assertion-label fallback for non-test frames
Chemaclass Jul 24, 2026
9d573f0
merge: legacy removals (Boromir) into staging
Chemaclass Jul 24, 2026
caa58bc
ref(assert): collapse the repeated failure-reporting block into fail_…
Chemaclass Jul 24, 2026
27e87e7
fix(assert): report assert_arrays_equal failures with the assertion's…
Chemaclass Jul 24, 2026
bc981b8
merge: dead-code removals (Gandalf) into staging
Chemaclass Jul 24, 2026
aace07f
merge: comment cleanup (Galadriel) into staging
Chemaclass Jul 24, 2026
246be12
fix(helpers): expand glob paths without eval
Chemaclass Jul 24, 2026
bfb9534
fix(assert): fail closed when an exit-code operand is not an integer
Chemaclass Jul 24, 2026
af3c132
fix(assert): guard empty variadic actual under set -u on bash 3.x
Chemaclass Jul 24, 2026
3e2af14
fix(runner): treat an unparseable result payload as zero, not a crash
Chemaclass Jul 24, 2026
757c392
ref(doubles): replace [[ =~ ]] with a bash 3.0 case glob
Chemaclass Jul 24, 2026
1852e2b
ref(runner): name the repeated stop-on-failure branch
Chemaclass Jul 24, 2026
c4cf583
merge: assertion dedup (Frodo) into staging
Chemaclass Jul 24, 2026
6dcbb5e
merge: weak-typing fixes (Legolas) into staging
Chemaclass Jul 24, 2026
c46e61d
docs: update changelog
Chemaclass Jul 25, 2026
ec6b129
fix(env): stop .env.example from clobbering caller-set variables
Chemaclass Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/architecture-map.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ bashunit (entry) sources all src/*.sh; version gate; early flag scan
│ parallel: + write .result via mktemp
└─ console_results::print_successful_test / _failed_ / …
└─ str::rpad + strip_ansi align per-test time (pure bash)
└─ [--parallel] wait; parallel::aggregate_test_results over *.result files
└─ [--parallel] wait; state::aggregate_parallel_results over *.result files
└─ console_results::render_result totals; deferred failure/skip blocks
└─ rerun::persist; env::cleanup_run_output_dir; exit code
```
Expand Down
9 changes: 8 additions & 1 deletion .env.example
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,13 @@
# bashunit Configuration
# Copy this file to .env and customize as needed
# All values shown are defaults (leave empty to use default)
#
# Do NOT add a variable here just to document it. .env is loaded with
# `set -o allexport; source .env`, so every line is an unconditional assignment:
# listing a name makes an empty value OVERRIDE one the caller exported or set on
# the command line (`BASHUNIT_OUTPUT_FORMAT=tap ./bashunit` stops working).
# Settings that must stay overridable are documented in docs/configuration.md
# instead. `.bashunitrc` does not have this problem — it applies only when unset.
################################################################################

#───────────────────────────────────────────────────────────────────────────────
Expand All@@ -19,7 +26,7 @@ BASHUNIT_HEADER_ASCII_ART= # Default: false
BASHUNIT_SIMPLE_OUTPUT= # Default: false (use dots instead of test names)
BASHUNIT_VERBOSE= # Default: false (show environment variables)
BASHUNIT_NO_OUTPUT= # Default: false (suppress all output)
BASHUNIT_SHOW_EXECUTION_TIME= # Default: true
BASHUNIT_SHOW_EXECUTION_TIME= # Default: auto (true|false|auto; auto skips per-test times when the clock forks)
BASHUNIT_SHOW_SKIPPED= # Default: false (show skipped test details)
BASHUNIT_SHOW_INCOMPLETE= # Default: false (show incomplete test details)
BASHUNIT_FAILURES_ONLY= # Default: false (only show failures)
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,23 @@
### Added
- Per-line execution hit counts in the text report: `BASHUNIT_COVERAGE_SHOW_LINE_HITS=true` prints a `Line Hits` block listing each covered line as `<lineno>:<count>` per file. The LCOV report already carried the same counts in its `DA:<line>,<count>` records; those are now pinned by tests (#856)

### Changed
- The `--parallel` unsupported-OS warning no longer claims Alpine is excluded: Alpine has been a supported parallel platform since the race conditions were fixed, the message was simply never updated

### Fixed
- `.env.example` documented `BASHUNIT_SHOW_EXECUTION_TIME` as defaulting to `true`; the actual default has been `auto` since #765
- bashunit now aborts with an actionable error when its scratch directories under `TMPDIR` cannot be created. Previously the run continued with every failure/skip collector writing nowhere, so a failing suite still exited non-zero but lost its assertion detail and leaked raw `src/runner.sh: line N: ...: Not a directory` errors instead of reporting the cause
- A test file whose `set_up_before_script` changes directory no longer silently drops the remaining files from the run when the original working directory has become unreachable; the run aborts with a clear error instead
- `release.sh` reports a failed rollback as failed instead of always printing "Rollback complete", and aborts when neither the tar nor the `cp` sandbox copy produced a usable project copy
- `assert_arrays_equal` no longer reports the internal label `Bashunit::assert::label` when it fails outside a test function (for example from a `set_up` hook); it now reports `Assert arrays equal`, matching every other assertion
- The exit-code assertions (`assert_exit_code`, `assert_successful_code`, `assert_unsuccessful_code`, `assert_general_error`, `assert_command_not_found`) counted the assertion as **passed** when given a non-integer exit code: `[ x -ne y ]` exits 2 rather than 1 on an unparseable operand, and that was read as "equal". They now fail closed
- A test path containing both a glob and a space (`./bashunit "my tests/*"`) is no longer word-split into bogus search roots, which silently discovered zero tests; the path is also no longer passed through `eval`
- The variadic assertions (`assert_contains` and friends) called with the actual value omitted now report a clean failed assertion on Bash 3.2 instead of aborting the run with `unbound variable` under `--strict`
- An unreadable or truncated parallel `.result` file is now counted as a failed test instead of aborting aggregation with an arithmetic syntax error

### Removed
- Dead internal code with no remaining callers: the pre-cache fallback branch of the runner's `call_test_functions` (unreachable since the per-file function list became mandatory), `bashunit::state::calculate_total_assertions` (superseded by `bashunit::runner::compute_total_assertions`), `bashunit::coverage::get_line_hits` (superseded by `bashunit::coverage::get_all_line_hits`), `bashunit::helper::trim` and `bashunit::dependencies::has_adjtimex`. All are internal (sub-namespaced) helpers, not part of the documented public API

## [0.43.0](https://github.com/TypedDevs/bashunit/compare/0.42.0...0.43.0) - 2026-07-24

### Added
Expand Down
25 changes: 23 additions & 2 deletions release.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -326,8 +326,15 @@ function release::rollback::restore_files() {

function release::rollback::auto() {
release::log_error "Release failed. Initiating rollback..."
release::rollback::restore_files || true
release::log_info "Rollback complete. Files restored to pre-release state."
# `if` (not `|| true`) so a failed restore is reported as such: announcing
# "Rollback complete" over a restore that never happened sends the operator
# away from a half-released working tree.
if release::rollback::restore_files; then
release::log_info "Rollback complete. Files restored to pre-release state."
else
release::log_error "Rollback FAILED: files were not restored from backup."
release::log_error "The working tree may be left in a half-released state."
fi
release::log_info "Manual rollback command if needed: ./release.sh --rollback"
}

Expand DownExpand Up@@ -400,6 +407,20 @@ function release::sandbox::create() {
"$SANDBOX_DIR/node_modules" "$SANDBOX_DIR/.tasks" "$SANDBOX_DIR/tmp"
release::log_verbose "Copied project files to sandbox (cp)"
fi

# Neither copy method reports a conclusive exit code (the tar pipe silences
# its own stderr, and `cp -r` may trip over transient files), so assert the
# postcondition explicitly. A sandbox rehearsal on an empty directory would
# otherwise "pass" every step it never actually ran.
if [ ! -f "$SANDBOX_DIR/bashunit" ]; then
release::log_error "Failed to copy the project into the sandbox: $SANDBOX_DIR"
release::log_error "Neither the tar pipe nor the cp fallback produced a usable copy."
# Default the constant: when release.sh is sourced from a function (the unit
# tests do), its top-level `declare -r` is function-local and long gone by
# now — a bare `exit $EXIT_EXECUTION_ERROR` would then exit 0 and turn this
# fatal error into a silent pass.
exit "${EXIT_EXECUTION_ERROR:-2}"
fi
}

function release::sandbox::setup_git() {
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); ref: codebase quality sweep — dedup, dead code, cycles and defensive-code audit by Chemaclass · Pull Request #862 · TypedDevs/bashunit · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4f24731
ref(console): reuse one duration formatter instead of an inline copy
Chemaclass Jul 24, 2026
8ebcbd3
docs: remove work-in-motion narration and fix stale branch-kind comment
Chemaclass Jul 24, 2026
6186450
fix(runner): fail loudly on internal errors instead of swallowing them
Chemaclass Jul 24, 2026
68a2753
ref(env): consolidate shared data contracts into single sources of truth
Chemaclass Jul 24, 2026
2ec94a5
ref: remove superseded internal helpers and an unreachable runner branch
Chemaclass Jul 24, 2026
8312bbb
ref(src): break the env/globals and parallel/state call cycles
Chemaclass Jul 24, 2026
77914ec
merge: error-hiding fixes (Gimli) into staging
Chemaclass Jul 24, 2026
938dc01
ref: remove dead helpers and an unreferenced fixture
Chemaclass Jul 24, 2026
6ecbb99
Merge branch 'worktree-agent-ac8975473afa60392' into cleanup/staging
Chemaclass Jul 24, 2026
fd982ec
test(assert): pin the assertion-label fallback for non-test frames
Chemaclass Jul 24, 2026
9d573f0
merge: legacy removals (Boromir) into staging
Chemaclass Jul 24, 2026
caa58bc
ref(assert): collapse the repeated failure-reporting block into fail_…
Chemaclass Jul 24, 2026
27e87e7
fix(assert): report assert_arrays_equal failures with the assertion's…
Chemaclass Jul 24, 2026
bc981b8
merge: dead-code removals (Gandalf) into staging
Chemaclass Jul 24, 2026
aace07f
merge: comment cleanup (Galadriel) into staging
Chemaclass Jul 24, 2026
246be12
fix(helpers): expand glob paths without eval
Chemaclass Jul 24, 2026
bfb9534
fix(assert): fail closed when an exit-code operand is not an integer
Chemaclass Jul 24, 2026
af3c132
fix(assert): guard empty variadic actual under set -u on bash 3.x
Chemaclass Jul 24, 2026
3e2af14
fix(runner): treat an unparseable result payload as zero, not a crash
Chemaclass Jul 24, 2026
757c392
ref(doubles): replace [[ =~ ]] with a bash 3.0 case glob
Chemaclass Jul 24, 2026
1852e2b
ref(runner): name the repeated stop-on-failure branch
Chemaclass Jul 24, 2026
c4cf583
merge: assertion dedup (Frodo) into staging
Chemaclass Jul 24, 2026
6dcbb5e
merge: weak-typing fixes (Legolas) into staging
Chemaclass Jul 24, 2026
c46e61d
docs: update changelog
Chemaclass Jul 25, 2026
ec6b129
fix(env): stop .env.example from clobbering caller-set variables
Chemaclass Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/architecture-map.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ bashunit (entry) sources all src/*.sh; version gate; early flag scan
│ parallel: + write .result via mktemp
└─ console_results::print_successful_test / _failed_ / …
└─ str::rpad + strip_ansi align per-test time (pure bash)
└─ [--parallel] wait; parallel::aggregate_test_results over *.result files
└─ [--parallel] wait; state::aggregate_parallel_results over *.result files
└─ console_results::render_result totals; deferred failure/skip blocks
└─ rerun::persist; env::cleanup_run_output_dir; exit code
```
Expand Down
9 changes: 8 additions & 1 deletion .env.example
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,13 @@
# bashunit Configuration
# Copy this file to .env and customize as needed
# All values shown are defaults (leave empty to use default)
#
# Do NOT add a variable here just to document it. .env is loaded with
# `set -o allexport; source .env`, so every line is an unconditional assignment:
# listing a name makes an empty value OVERRIDE one the caller exported or set on
# the command line (`BASHUNIT_OUTPUT_FORMAT=tap ./bashunit` stops working).
# Settings that must stay overridable are documented in docs/configuration.md
# instead. `.bashunitrc` does not have this problem — it applies only when unset.
################################################################################

#───────────────────────────────────────────────────────────────────────────────
Expand All@@ -19,7 +26,7 @@ BASHUNIT_HEADER_ASCII_ART= # Default: false
BASHUNIT_SIMPLE_OUTPUT= # Default: false (use dots instead of test names)
BASHUNIT_VERBOSE= # Default: false (show environment variables)
BASHUNIT_NO_OUTPUT= # Default: false (suppress all output)
BASHUNIT_SHOW_EXECUTION_TIME= # Default: true
BASHUNIT_SHOW_EXECUTION_TIME= # Default: auto (true|false|auto; auto skips per-test times when the clock forks)
BASHUNIT_SHOW_SKIPPED= # Default: false (show skipped test details)
BASHUNIT_SHOW_INCOMPLETE= # Default: false (show incomplete test details)
BASHUNIT_FAILURES_ONLY= # Default: false (only show failures)
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,23 @@
### Added
- Per-line execution hit counts in the text report: `BASHUNIT_COVERAGE_SHOW_LINE_HITS=true` prints a `Line Hits` block listing each covered line as `<lineno>:<count>` per file. The LCOV report already carried the same counts in its `DA:<line>,<count>` records; those are now pinned by tests (#856)

### Changed
- The `--parallel` unsupported-OS warning no longer claims Alpine is excluded: Alpine has been a supported parallel platform since the race conditions were fixed, the message was simply never updated

### Fixed
- `.env.example` documented `BASHUNIT_SHOW_EXECUTION_TIME` as defaulting to `true`; the actual default has been `auto` since #765
- bashunit now aborts with an actionable error when its scratch directories under `TMPDIR` cannot be created. Previously the run continued with every failure/skip collector writing nowhere, so a failing suite still exited non-zero but lost its assertion detail and leaked raw `src/runner.sh: line N: ...: Not a directory` errors instead of reporting the cause
- A test file whose `set_up_before_script` changes directory no longer silently drops the remaining files from the run when the original working directory has become unreachable; the run aborts with a clear error instead
- `release.sh` reports a failed rollback as failed instead of always printing "Rollback complete", and aborts when neither the tar nor the `cp` sandbox copy produced a usable project copy
- `assert_arrays_equal` no longer reports the internal label `Bashunit::assert::label` when it fails outside a test function (for example from a `set_up` hook); it now reports `Assert arrays equal`, matching every other assertion
- The exit-code assertions (`assert_exit_code`, `assert_successful_code`, `assert_unsuccessful_code`, `assert_general_error`, `assert_command_not_found`) counted the assertion as **passed** when given a non-integer exit code: `[ x -ne y ]` exits 2 rather than 1 on an unparseable operand, and that was read as "equal". They now fail closed
- A test path containing both a glob and a space (`./bashunit "my tests/*"`) is no longer word-split into bogus search roots, which silently discovered zero tests; the path is also no longer passed through `eval`
- The variadic assertions (`assert_contains` and friends) called with the actual value omitted now report a clean failed assertion on Bash 3.2 instead of aborting the run with `unbound variable` under `--strict`
- An unreadable or truncated parallel `.result` file is now counted as a failed test instead of aborting aggregation with an arithmetic syntax error

### Removed
- Dead internal code with no remaining callers: the pre-cache fallback branch of the runner's `call_test_functions` (unreachable since the per-file function list became mandatory), `bashunit::state::calculate_total_assertions` (superseded by `bashunit::runner::compute_total_assertions`), `bashunit::coverage::get_line_hits` (superseded by `bashunit::coverage::get_all_line_hits`), `bashunit::helper::trim` and `bashunit::dependencies::has_adjtimex`. All are internal (sub-namespaced) helpers, not part of the documented public API

## [0.43.0](https://github.com/TypedDevs/bashunit/compare/0.42.0...0.43.0) - 2026-07-24

### Added
Expand Down
25 changes: 23 additions & 2 deletions release.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -326,8 +326,15 @@ function release::rollback::restore_files() {

function release::rollback::auto() {
release::log_error "Release failed. Initiating rollback..."
release::rollback::restore_files || true
release::log_info "Rollback complete. Files restored to pre-release state."
# `if` (not `|| true`) so a failed restore is reported as such: announcing
# "Rollback complete" over a restore that never happened sends the operator
# away from a half-released working tree.
if release::rollback::restore_files; then
release::log_info "Rollback complete. Files restored to pre-release state."
else
release::log_error "Rollback FAILED: files were not restored from backup."
release::log_error "The working tree may be left in a half-released state."
fi
release::log_info "Manual rollback command if needed: ./release.sh --rollback"
}

Expand DownExpand Up@@ -400,6 +407,20 @@ function release::sandbox::create() {
"$SANDBOX_DIR/node_modules" "$SANDBOX_DIR/.tasks" "$SANDBOX_DIR/tmp"
release::log_verbose "Copied project files to sandbox (cp)"
fi

# Neither copy method reports a conclusive exit code (the tar pipe silences
# its own stderr, and `cp -r` may trip over transient files), so assert the
# postcondition explicitly. A sandbox rehearsal on an empty directory would
# otherwise "pass" every step it never actually ran.
if [ ! -f "$SANDBOX_DIR/bashunit" ]; then
release::log_error "Failed to copy the project into the sandbox: $SANDBOX_DIR"
release::log_error "Neither the tar pipe nor the cp fallback produced a usable copy."
# Default the constant: when release.sh is sourced from a function (the unit
# tests do), its top-level `declare -r` is function-local and long gone by
# now — a bare `exit $EXIT_EXECUTION_ERROR` would then exit 0 and turn this
# fatal error into a silent pass.
exit "${EXIT_EXECUTION_ERROR:-2}"
fi
}

function release::sandbox::setup_git() {
Expand Down
Loading
Loading