Performance Improvements and Debugging
Originally published:
Last modified:
Performance improvements
Earlier versions of Best would print output to the terminal after every individual test. This large amount of terminal i/o was not very efficient, and after the test suite grew to about 100 tests, it was evident that the total runtime would continue to grow for every new test.
Instead of printing output from each test to the terminal, that output is now cached to a temporary file, and then the contents of the temporary file are printed once to the terminal at the end.
This change resulted in a 59% performance improvement.
New CLI options
It's now possible to bail early after any test fails using the --bail option. This may be especially useful when you have a larger test suite and want to fail as soon as possible during local development. It could also save time during continuous integration pipelines.
And now you can also print more verbose debugging information from Best using the --debug option.
--bail: Exit early after first failed test.--debug: Show debugging output.
Recent Releases
Roadmap to v1
Hooks are probably the last major hurdle to get through before releasing a stable v1. Bash doesn't really provide a way pass around first class functions, so the hook system may end up depending on eval.
describe "when some condition" {
before_each "some_setup a b c"
it "should do something" {
expect "$(something a b c)"
to_be "something else"
}
}; enddescribe
Of course eval feels a little risky, but a test runner is for running user-provided code, so it's not much riskier than running source ./tests/**/*.test.sh. Regardless of how hooks are implemented, the implementation details will be explained when that is released.
Aside from hooks, we'll also need some formal documentation published, and probably some better --help output, and possibly a man page. Are man pages still a thing? I read man pages all the time. I'll probably add a man page.
With hooks and documentation, Best should be ready for a v1 stable release, with the intent to continue adding more expectations and CLI options over time.
We are aiming for a 2026 v1 release, before the 2027 new year.