bats-assert and bats-file libraries not actually loaded
rfay opened this issue · 2 comments
Although we brew install bats-aassert bats-file
we don't actually load them properly, so they're not available for use. brew info bats-assert
for example tells us:
==> Caveats
To load the bats-assert lib in your bats test:
load '/home/linuxbrew/.linuxbrew/lib/bats-support/load.bash'
load '/home/linuxbrew/.linuxbrew/lib/bats-assert/load.bash'
==> Caveats
To load the bats-file lib in your bats test:
load '/home/linuxbrew/.linuxbrew/lib/bats-support/load.bash'
load '/home/linuxbrew/.linuxbrew/lib/bats-file/load.bash'
Hi @rfay ,
After some search, I found that the "load" call must be made in the test.bats file itself ...
For example, I added :
TEST_BREW_PREFIX="$(brew --prefix)"
load "${TEST_BREW_PREFIX}/lib/bats-support/load.bash"
load "${TEST_BREW_PREFIX}/lib/bats-assert/load.bash"
at the beginning of a tests.bats file and the, the following test works :
@test 'assert_equal()' {
assert_equal 'have' 'have'
}
Adding this these lines in a bats file is what is explained here: https://github.com/ztombol/bats-docs#loading
Maybe you know another way to load the files (I failed to try some source "/home/linuxbrew/.linuxbrew/lib/bats-support/load.bash"
manually ) ?
If not, in my opinion, we should just update the ddev-addon-template README to speak about this.
Moved it over, thanks.