Skip to content

bug: bashunit doc fails on missing default bootstrap instead of showing docs #929

Description

@objctp
Q A
OS macOS (also reproducible on Linux)
Shell & version bash 3.2 / 5.2
bashunit version 0.44.0

Summary

bashunit doc fails with Error: cannot read the bootstrap file: 'tests/bootstrap.sh'. when no bootstrap file exists, instead of displaying the assertion documentation.

Current behavior

Running bashunit doc (the plain form, with no --custom and no --boot/-e/--env) in a project that does not yet have a tests/bootstrap.sh file prints an error and exits with code 1:

$ bashunit doc
Error: cannot read the bootstrap file: 'tests/bootstrap.sh'.

This happens even though the bootstrap is only needed to discover custom assertions. The default BASHUNIT_BOOTSTRAP value (tests/bootstrap.sh) is treated as mandatory before any documentation is printed.

How to reproduce

# Start from a clean project (no bootstrap file)
mkdir my-project && cd my-project
# (no tests/bootstrap.sh present)

# Plain documentation listing, as shown in the official docs:
$ bashunit doc [assert | contain]
# -> Error: cannot read the bootstrap file: 'tests/bootstrap.sh'.
#    exit code 1, no documentation shown

The same error also appears for bashunit doc --custom when no bootstrap exists (it should instead report "No custom assertions found.").

Expected behavior

Per the official doc documentation (https://bashunit.com/command-line#doc), bashunit doc "Displays documentation for assertion functions" and lists all assertions by default — no bootstrap file should be required.

  • bashunit doc → prints all assertion documentation, regardless of whether a bootstrap file exists.
  • bashunit doc --custom → prints "No custom assertions found." when no bootstrap/custom assertions are present (no hard error).
  • Only an explicitly named bootstrap (bashunit doc --boot / -e / --env) should error when the file cannot be read.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions