Skip to content

Watch subcommand fails with "bashunit::watch::run: command not found" (src/watch.sh missing from release build) #735

Description

@jjshinobi
Q A
OS macOS / Linux
Shell & version bash 5.3
bashunit version 0.40.0

Summary

The watch subcommand is broken in the released build. The distributable
single-file bashunit contains the call site of bashunit::watch::run
(from src/main.sh) but not its definition (from src/watch.sh), so any
bashunit watch invocation calls an undefined function.

This affects the official release artifact itself, so it reproduces regardless of
install method — both the Homebrew build and the GitHub release download fail.
It is not a missing-dependency issue: it fails before inotifywait / fswatch
is ever used (both were installed when reproducing).

The function exists in source (src/watch.sh) but is missing from the built
binary, i.e. a build/bundling gap. This looks like the same class of issue fixed
in 0.31.0 ("bench command not working in standalone/installed bashunit (missing
benchmark.sh in build)").

Current behavior

/path/to/bashunit: line 13243: bashunit::watch::run: command not found

Evidence from the released binary — bashunit::watch::run is referenced exactly
once (the call site) and never defined:

$ grep -n 'bashunit::watch::run' bashunit
13243:  bashunit::watch::run "$path" "${extra_args[@]+"${extra_args[@]}"}"

$ grep -c 'function bashunit::watch::run' bashunit
0

For contrast, the polling helper used by test --watch
(bashunit::main::watch_loop) is bundled and works:

$ grep -c 'function bashunit::main::watch_loop' bashunit
1

Checked every release since the watch subcommand was introduced (0.34.0);
none define bashunit::watch::run in the release binary:

Version function bashunit::watch::run definitions
0.40.0 0
0.39.1 0
0.38.0 0
0.37.0 0
0.36.0 0
0.35.0 0
0.34.0 0

How to reproduce

# Using the released binary (Homebrew or the GitHub release download)
bashunit watch
# or
bashunit watch tests/

Expected behavior

watch starts the file-event watcher (inotifywait on Linux / fswatch on
macOS) and re-runs tests when files change.


Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions