infertux / bashcov

Code coverage tool for Bash
MIT License
151 stars 20 forks source link

0% coverage with BATS on Mac #51

Closed tralston closed 1 year ago

tralston commented 5 years ago

Similar to #48, I get the following output:

$ bashcov -s /usr/local/bin/bats tests
bashcov: warning: you are using a version of Bash that does not support BASH_XTRACEFD. All xtrace output will print to standard error, and your script's output on standard error will not be printed to the console.
 ✓ test something

1 test, 0 failures
bashcov: warning: /private/var/folders/15/3v34mvyj0xl17rhb89m70px00000gn/T/bats.13239.src was executed but has been deleted since then - it won't be reported in coverage.
Run completed using bashcov 1.8.2 with Bash 3.2, Ruby 2.6.0, and SimpleCov 0.15.1.
Coverage report generated for /bin/bash /usr/local/bin/bats tests to /private/tmp/tmp/coverage. 0.0 / 0.0 LOC (100.0%) covered.

Notice the last bit of the last line: 0.0 / 0.0 LOC (100.0%) covered. I tried running this from an absolute bats location, to avoid #48, but I get 0% coverage. It looks like BATS is running properly, but bashcov is not tracing any of the files.

Now if I run the command without BATS, i.e. bashcov -s ./hello.sh 1, then it works great and I get an accurate coverage metric. My testing is solely BATS, and don't think it should be necessary to write another script file to run the BATS tests (even tried that, and it's still not working 100% as I'd expect it to).

Please help!

infertux commented 1 year ago

Bashcov 3.0 has been released which may fix this issue. Please run gem update bashcov and open this issue again if the problem persists.