Skip to content

Releases: TypedDevs/bashunit

0.31.0

19 Dec 16:57
0.31.0
fc7256d

Choose a tag to compare

Adds timed setup/teardown hooks, introduces Bash code coverage with reports and thresholds, and fixes bench tests.

✨ Improvements

  • Display set_up_before_script and tear_down_after_script execution with duration
    • Shows "Running hook_name... done (Xs)" during test runs
    • Helps identify slow setup/teardown operations
    • Suppressed in failures-only and parallel modes
  • Add code coverage tracking with --coverage flag
    • Tracks line coverage using Bash DEBUG trap mechanism
    • Configurable source paths via --coverage-paths (default: src/)
    • Configurable exclusions via --coverage-exclude (default: tests/*,vendor/*,*_test.sh,*Test.sh)
    • LCOV format output via --coverage-report (default: coverage/lcov.info)
    • HTML coverage report via --coverage-report-html <dir> with line-by-line highlighting
    • Minimum coverage threshold via --coverage-min (fails if below)
    • Console-only mode with --no-coverage-report
    • Color-coded console output with configurable thresholds (50%/80%)

🐛 Bug Fixes

  • Fix bench command not working in standalone/installed bashunit (missing benchmark.sh in build)
  • Fix helper::get_latest_tag returning version with ^{} suffix from annotated git tags

👥 Contributors

🔐 Checksum

a674f92ff2e44b905a0bcb00944ac35e89cdce0d2a6074c2eb829976116b0c9d bin/bashunit

Full Changelog: 0.30.0...0.31.0

0.30.0

14 Dec 20:46
0.30.0
c1caf05

Choose a tag to compare

Better test output (human-readable duration, --failures-only, --no-color), multiple standalone assertions, and release automation. Breaking: --preserve-env renamed to --skip-env-file.

✨ Improvements

  • Display execution time in minutes format when tests run over 60 seconds (e.g., "2m 1s")
  • Display individual test duration in human-readable format (ms, s, or m s) instead of always milliseconds
  • Add --failures-only flag to suppress passed/skipped/incomplete tests and show only failures
  • Add --no-color flag to disable ANSI color output (also supports NO_COLOR env var per no-color.org standard)
  • Add multiple assertions support in standalone mode: bashunit assert "cmd" exit_code "1" contains "error"
  • Add release.sh script to automate the release process with dry-run support

🛠️ Changes

  • BREAKING: Rename --preserve-env flag to --skip-env-file for clearer semantics
  • BREAKING: Rename BASHUNIT_PRESERVE_ENV environment variable to BASHUNIT_SKIP_ENV_FILE
  • Improve documentation for --skip-env-file clarifying that shell functions are not inherited
  • Add tip to Bootstrap documentation promoting it as the solution for function availability in tests
  • Clarify that exit code assertions check $? instead of executing commands

🐛 Bug Fixes

  • Internal flaky tests when running --strict
  • Visible stdout/stderr during normal execution set_up_before_script and tear_down_after_script

👥 Contributors

@Chemaclass @JesusValeraDev

🔐 Checksum

1cdb44f844f8decf9943c2b8e18679b4497e3bd798ce4aa9605cfde3d357706f bin/bashunit

Full Changelog: 0.29.0...0.30.0

0.29.0

08 Dec 20:33
bc6c5a4

Choose a tag to compare

Added bootstrap argument passing, stricter and more controllable execution modes, and safer internals through full namespacing.

✨ Improvements

  • Add bootstrap argument passing support via --env "file.sh arg1 arg2"
  • Add --preserve-env flag to skip .env loading and use shell environment only
  • Add -l, --login flag to run tests in login shell context
  • Add --strict flag to enable strict shell mode (set -euo pipefail) for tests
  • Add BASHUNIT_STRICT_MODE configuration option (default: false)
  • Add -R, --run-all flag to run all assertions even when one fails
  • Add BASHUNIT_STOP_ON_ASSERTION_FAILURE configuration option (default: true)

🛠️ Changes

  • BREAKING: Namespace all internal functions and variables to prevent collisions with user code
    • All helper functions now use bashunit:: prefix (e.g., skipbashunit::skip)
    • All internal functions now use bashunit:: prefix (e.g., helper::trimbashunit::helper::trim)
    • All internal variables now use _BASHUNIT_ prefix (e.g., _TESTS_PASSED_BASHUNIT_TESTS_PASSED)
    • All assert_* functions remain unchanged (public API)

🐛 Bug Fixes

  • Improve assert command output: show assert <fn> instead of internal function name in failure messages
  • Custom assertions now display the correct test function name in failure messages
  • Data providers now work when set_up_before_script changes directory
  • Subsequent test files now run when set_up_before_script changes directory
  • Catch intermediate failing commands in set_up_before_script and tear_down_after_script

👥 Contributors

@Chemaclass @JesusValeraDev @cnaples79

🔐 Checksum

90d5afc07222920777d6c47af657d1d7a80a0055eaaa506c9c814f6b224da102 bin/bashunit

Full Changelog: 0.28.0...0.29.0

0.28.0

30 Nov 23:13
3332295

Choose a tag to compare

Added inline test filtering, a redesigned subcommand-based CLI, safer lifecycle behavior, and runner performance.

✨ Improvements

  • Added inline filter syntax to run specific tests directly from a file:
    • path::function_name — run only the matching test function
    • path:line_number — execute the test located at the specified line
  • Added --show-skipped and --show-incomplete options to surface test outcomes that previously remained hidden
    • Displays skipped and incomplete tests in a dedicated summary section

🛠️ Changes

  • BREAKING: Introduced a modern subcommand-based CLI architecture
    Provides clearer workflows and replaces several legacy flags:
    • bashunit test [path] — run tests (default; backward-compatible with bashunit [path])
    • bashunit bench [path] — run benchmarks (replaces --bench)
    • bashunit doc [filter] — show assertion documentation (replaces --doc)
    • bashunit init [dir] — bootstrap a project (replaces --init)
    • bashunit learn — interactive tutorial (replaces --learn)
    • bashunit upgrade — upgrade to the latest version (replaces --upgrade)
  • BREAKING: Tests now stop at the first assertion failure within a test function
    • Aligns with PHPUnit and Jest default behavior
    • Skips remaining assertions in the same test after a failure
    • Independent test functions continue to run normally

🐞 Bug Fixes

  • Lifecycle hooks (set_up, tear_down) now stop executing remaining commands after the first failure
  • If set_up_before_script fails, all tests are correctly marked as failed

⚡ Performance

  • Optimized assertion guard logic using integer comparison instead of string comparison for faster evaluation

👥 Contributors

@Chemaclass @JesusValeraDev

🔐 Checksum

31cbc589a0938e33cd5eacd8028afbb681601b40696af5989e7a788dab208b79 bin/bashunit

Full Changelog: 0.27.0...0.28.0

0.27.0

26 Nov 00:28
828ac2b

Choose a tag to compare

Added a fully interactive learning mode, expanded documentation with practical examples, fixed argument handling in mocks and lifecycle hook behavior, simplified CI runners, and delivered several performance optimizations for faster and more reliable execution.

✨ Improvements

  • Added --learn interactive tutorial featuring 10 progressive lessons for guided, hands-on Bash testing practice
  • Added Common Patterns documentation with real-world examples for structuring tests, using hooks, and organizing suites

🐛 Bug Fixes

  • Fixed mocked functions so they properly receive passed arguments
  • Fixed lifecycle hooks to correctly capture intermediate failing commands inside set_up and tear_down

🛠️ Changes

  • Simplified CI matrix:
    • Use only *-latest runners for Ubuntu and macOS
    • Removed deprecated macos-13 runner

⚡ Performance

  • Optimized temporary directory handling by initializing it once at startup instead of per temp file
  • Replaced tail subprocesses with native Bash redirection for parallel result aggregation
  • Cached internal state values to avoid repeated subshell calls, improving overall responsiveness

👥 Contributors

@Chemaclass @JesusValeraDev

🔐 Checksum

b9362d720a46eb600d42ba18e6944521822ca397d1eaa1d0240fca8ce3fb859d bin/bashunit

Full Changelog: 0.26.0...0.27.0

0.26.0

02 Nov 21:30
14baf6f

Choose a tag to compare

Added assert_unsuccessful_code, removed redundant function scans, replaced slow commands with Bash expansion, and fixed test_file, data_set spacing, and Python compatibility in clock::now.

✨ Improvements

  • Added assert_unsuccessful_code to verify that commands return a non-zero exit code
  • Removed redundant declare -F | awk calls previously executed for each test and bench file
  • Replaced tail and process commands with native Bash parameter expansion, improving speed

🐛 Bug Fixes

  • Fixed missing test_file variable in bench tests
  • Fixed data_set handling when arguments include spaces
  • Fixed compatibility with older Python versions used in clock::now

👥 Contributors

Full Changelog: 0.25.0...0.26.0

🔐 Checksum

7ff253ec2cb665d560fd92d314687f0d6a256f9f9f13c57b3c4747d056e659af bin/bashunit

0.25.0

05 Oct 14:22
80dffc5

Choose a tag to compare

What's changed

TL;DR: Added AI dev integration guides, improved lifecycle hooks, and fixed multiple assertion and data provider issues.

✨ Improvements

  • Add AI developer tools integration and internal guidelines
    • Introduce copilot-instructions.md for AI-assisted development
    • Add AGENTS.md to describe integration patterns for external developer tools
    • Define .tasks/ (versioned) and .task/ (ignored) task storage policies

🐛 Bug Fixes

  • Fix include set_test_title helper in the single-file library
  • Fix lifecycle hooks capture and report flow
    • set_up, tear_down, set_up_before_script, and tear_down_after_script
  • Fix false negatives in assert_have_been_called_with when using pipes
  • Fix trailing whitespace loss in the final argument of data_set
  • Fix unbound variable error in parse_data_provider_args when set -u is enabled
  • Fix incorrect bashunit::assertion_failed test name on failure
  • Fix test name interpolation during failure reporting

👥 Contributors

@Chemaclass @evalverde-vw @jsitnicki @mattness

Full Changelog: 0.24.0...0.25.0

0.24.0

14 Sep 15:32
2ecfee3

Choose a tag to compare

What's changed

TL;DR: Improved argument matching in assertions, clearer docs, and multiple bug fixes for data providers and temp cleanup.

✨ Improvements

  • Improve assert_have_been_called_with arg matching #474
  • Rename helper functions to helper prefix #475

📖 Documentation

  • Make Windows install clearer #477
  • Workaround docs for global name collisions #481

🐛 Bug Fixes

  • Fix support for whitespace in data providers #479
  • Always correctly clean up temp contents #483
  • Clean parallel temp folder after test run #484
  • Fix support for tabs in data set values #485
  • Fix support for newlines in data providers #487

👥 Contributors

@Chemaclass @antonio-gg-dev @CosmeValera @carlfriedrich

🆕 New Contributors

Full Changelog: 0.23.0...0.24.0

0.23.0

03 Aug 12:57
966de2f

Choose a tag to compare

What's Changed

🏅 New Features

  • Add support for .bash test files #459
  • Add set_test_title to allow custom test titles #472
  • Add new assert_exec #469

🐛 Bug Fixes

  • Add fallback for clock with seconds resolution only #471

🏗️ Miscellaneous

  • Update docs for mock usage #462
  • Add minimum supported Bash version 3.2 check #460
  • Skip report tracking unless requested #473

🫂 Contributors

@Chemaclass @drupol @akinomyoga

Full Changelog: 0.22.3...0.23.0

7043c1818016f330ee12671a233f89906f0d373f3b2aa231a8c40123be5a222b bashunit

0.22.3

27 Jul 02:28
35fba18

Choose a tag to compare

What's Changed

🐛 Bug Fixes

🫂 Contributors

@Chemaclass

Full Changelog: 0.22.2...0.22.3

checksum: efae498584b4f11cd05e4acbba586009e391259fdbfac391844b75b7552e00d7 bin/bashunit