Closed sschmid closed 3 weeks ago
Unfortunately, it probably comes down to #145, i.e., a real parser for shell scripts. As to why these two cases differ, I can't say. Seems like strange behavior from bash I'd say.
As a workaround, I excluded those patterns with --exclude-line
.
kcov --include-path=src --exclude-line='done <,for' /__w/bee/bee/coverage test/bats/bin/bats test
While not solving the underlying issue, it's good enough for me 👍
That's an option I didn't even remember existed :-)
Hi @SimonKagstrom,
I hope you're doing well.
I ran into issues where certain lines being reported as not covered when using kcov, bash and bats. I extracted samples to reproduce:
I attached the coverage report to the kcov-coverage GitHub action artifacts:
The kcov-coverage sample also includes for loops which are covered as expected. In my actual project they are not.
example 1: https://coveralls.io/builds/53486336/source?filename=src%2Fbee-run.bash#L147 example 2: https://coveralls.io/builds/53486336/source?filename=src%2Fbee-run.bash#L155
When scolling through the report you will find multiple locations where for or while loops are not covered.
This is how I use kcov: see GitHub action ci.yml https://github.com/sschmid/kcov-coverage/blob/main/.github/workflows/ci.yml
Do you have an idea what is going on or how I can fix this?