Open ggordham opened 6 years ago
This project is no longer being actively maintained by its original auther (see https://github.com/sstephenson/bats/issues/236).
You might want to migrate to the community maintained fork bats-core and report your issue there.
I installed the bats script in /usr/local (following the instructions). The tool was not working, looked like it couldn't find the libexec path scripts. I also had a second issue where bats tests would not find the script I was trying to run.
For the first issue (libexec) I updated the bats script (in /usr/local/bin/bats) line 55: Old Line:
BATS_LIBEXEC="$(abs_dirname "$0")"
New Line:BATS_LIBEXEC="$(abs_dirname "${BASH_SOURCE[0]}")/../libexec"
This would probably work no matter if bats is installed centrally or if it is pulled into a git project since it's all based on relative path to where the bats script is installed.
The second issue was when I was running bats on scripts in my project. The bats test script could not find my scripts for testing. For example:
It wouldn't find my script. I updated my bats test like this: Old:
run myscript.sh
New:run ${BATS_TEST_DIRNAME}/myscript.sh
This seems to be something to do with the working directory. I'm not sure but it might be worth while to add something like:
cd ${BATS_TEST_DIRNAME}
to the bats-exec-test script, maybe between lines 57 and 58? If the path needs to be saved, another option to save it off in a variable or use pushd / popd. The instructions for bats seemed to imply that it would find scripts in the current working directory that bats is executed from.Anyway, let me know if I can provide any other details. Thanks, Gary