-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverage % changes each time. #82
Comments
Hello @Minituff -- I've looked into this and I'm unable to reproduce the issue. Here's the branch of my Test results:
|
Hey @tomeon, thank you for putting in so much work to help me out with this. I think I may have figured it out. I also ran a few tests similar to your and here are my results:## My main branch (WSL2)
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage/coverage.xml. 254 / 407 LOC (62.41%) covered; 0 / 0 BC (100.00%) covered
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage. 254 / 407 LOC (62.41%) covered.
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage/coverage.xml. 254 / 405 LOC (62.72%) covered; 0 / 0 BC (100.00%) covered
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage. 254 / 405 LOC (62.72%) covered.
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage/coverage.xml. 250 / 401 LOC (62.34%) covered; 0 / 0 BC (100.00%) covered
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage. 250 / 401 LOC (62.34%) covered.
## Then I added your .simplecov file to my main branch (WSL2)
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage/coverage.xml. 579 / 1726 LOC (33.55%) covered
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage. 579 / 1726 LOC (33.55%) covered.
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage/coverage.xml. 608 / 1747 LOC (34.80%) covered
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage. 608 / 1747 LOC (34.8%) covered.
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage/coverage.xml. 638 / 1759 LOC (36.27%) covered
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage. 638 / 1759 LOC (36.27%) covered.
## Your testing branch (WSL2)
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage/coverage.xml. 545 / 1451 LOC (37.56%) covered
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage. 545 / 1451 LOC (37.56%) covered.
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage/coverage.xml. 585 / 1457 LOC (40.15%) covered
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage. 585 / 1457 LOC (40.15%) covered.
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage/coverage.xml. 463 / 1426 LOC (32.47%) covered
Coverage report generated for /bin/bash tests/tests.sh to /mnt/c/Users/James-PC/IdeaProjects/nautical-backup-1/coverage. 463 / 1426 LOC (32.47%) covered. I am using WSL2 (Ubuntu 20.04) on my Windows 11 PC so I tried booting up a Ubuntu VM. Here are the results from my Ubuntu VM:## My main branch (Ubuntu VM)
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage/coverage.xml. 379 / 411 LOC (92.21%) covered; 0 / 0 BC (100.00%) covered
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage. 379 / 411 LOC (92.21%) covered.
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage/coverage.xml. 379 / 411 LOC (92.21%) covered; 0 / 0 BC (100.00%) covered
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage. 379 / 411 LOC (92.21%) covered.
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage/coverage.xml. 379 / 411 LOC (92.21%) covered; 0 / 0 BC (100.00%) covered
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage. 379 / 411 LOC (92.21%) covered.
## Then I added your .simplecov file to my main branch (Ubuntu VM)
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage/coverage.xml. 1306 / 1833 LOC (71.25%) covered
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage. 1306 / 1833 LOC (71.25%) covered.
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage/coverage.xml. 1306 / 1833 LOC (71.25%) covered
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage. 1306 / 1833 LOC (71.25%) covered.
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage/coverage.xml. 1306 / 1833 LOC (71.25%) covered
Coverage report generated for /bin/bash ./tests/tests.sh to /root/projects/nautical-backup/coverage. 1306 / 1833 LOC (71.25%) covered. This is leading my to believe the issue is with WSL2. In retrospect, it might have been a little crazy of me to develop a Bash project on Windows..... I can move my development and tests to full Ubuntu and that should mitigate the problem. I can leave the GitHub issue open if you want to try to figure out why WSL2 is having these issues. |
Not terribly crazier than developing a Bash project, full stop 😜 Would be interesting to know whether the list of files with coverage stats changes between runs. If you've got
|
Ha very true, its too late to turn back now 😜. Looks like the tested files are the same each time. I did have to modify your # .simplecov
SimpleCov.profiles.define 'bashcov' do
load_profile 'rails'
command_name 'Unit Tests'
enable_coverage :branch
primary_coverage :branch
add_filter %r{^/snippets/}
add_filter %r{^/.git/}
add_filter %r{^/tests/}
add_filter "pkg/test.sh"
add_group "Pkg scripts", "/pkg"
# simplecov 0.22.0+
enable_coverage_for_eval if respond_to? :enable_coverage_for_eval
end
# Conditional loading of profiles
if ENV.key? 'SKIP_PROFILE'
puts "Skipping bashcov profile..."
else
puts "Loading bashcov configurations..."
SimpleCov.load_profile 'bashcov'
end
|
@Minituff -- the I don't have a WSL2 environment to investigate this on, but perhaps you could try running Bashcov without a |
Hey @infertux BASHCOV>fa26f0a5-fe3f-465c-96ee-a0600be01651573fa26f0a5-fe3f-465c-96ee-a0600be01651./bash_unitfa26exit 0
+ bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got "uname -m\n_source/bash/release-me/release.sh"). This can occur if your script or its path contains the sequence "fa26f0a5-fe3f-465c-96ee-a0600be01651", or if your script unsets LINENO. Aborting early; coverage report will be incomplete.
Run completed using bashcov 3.1.2 with Bash 3.2, Ruby 3.3.1, and SimpleCov 0.22.0
Coverage report generated for /bin/bash ./bash_unit tests/cli/core.test.sh tests/cli/no-git.test.sh tests/gpg-sign/git-gpg-sign.test.sh tests/plugins/changelog.test.sh tests/plugins/docker.test.sh tests/plugins/git.test.sh tests/plugins/github-release.test.sh tests/plugins/npm-post.test.sh tests/plugins/npm.test.sh tests/plugins/template.test.sh tests/presets/conventional-commits.test.sh tests/presets/workspace.cargo-undefined.test.sh tests/presets/workspace.cargo.test.sh tests/presets/workspace.nodejs-undefined.test.sh tests/presets/workspace.nodejs.test.sh tests/presets/workspace.python-undefined.test.sh tests/presets/workspace.python.test.sh tests/presets/workspace.undefined.test.sh to /Users/dalisoft/Desktop/open_source/bash/release-me/coverage. 307 / 548 LOC (56.02%) covered. Repo lives at here and i'm running command via |
Hello,
I'm new to using Ruby so I apologized if this is a simple question, but every time I run my tests my
coverage\index.html
is giving me a different output.The strange thing is, the output is correct and consistent within my Github Actions pipeline.
My `.simplecov` file
Here is the relevant part of my Gitlab CI workflow
This is the output when I run the tests locally changes each time, but ranges from 50-65%
This is the output generated from my testing pipeline. It's always accurate and consistent (~90%)
Are you able to help me determine why the coverage is not the same when run codecov locally?
How to replicate the issue
git clone [email protected]:Minituff/nautical-backup.git
gem install bashcov simplecov-cobertura simplecov-html
bashcov ./tests/tests.sh && ls -la coverage
My repo is open source so feel free to look around if I did not include something
https://github.com/Minituff/nautical-backup
Thanks!
The text was updated successfully, but these errors were encountered: