-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Code coverage output not working with latest swift-testing and 6.0 toolchain #7674
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
Comments
Thank you for the report. We're aware of this issue but did not yet have an issue tracking it. Until it's fixed, you should be able to work around it by passing Transferring the issue to swift-package-manager repo, since the anticipated fix will be needed there. |
Tracked internally as rdar://130019309 |
Thank you! I used the |
Great! Glad the workaround was successful. We'll be keeping this issue open to track fixing this problem in SwiftPM. (Of course, you may also continue using that flag if you want, even after the fix lands.) |
This should be resolved with #7766. |
Resolved by #7789. |
Description
In Swift 5.10 we used the XCTest scaffold with swift-testing, then ran the tests with
swift test --enable-code-coverage
to get code coverage results, and this worked fine. However, when running the swift-testing tests directly with the latest Swift 6.0 toolchain, this code coverage output shows that no lines are covered.Is this something that is planned on being implemented, or perhaps just not quite working yet in the new testing framework?
To confirm that this was not just the app I was developing (proprietary), I created a simple sample app that has a single function and tests it using the swift-testing framework. I will upload it so it can be used to see that the codecov report is showing no code coverage.
Expected behavior
Building the app with
swift testing --enable-code-coverage
generates the codecov output JSON with lines covered by tests.Actual behavior
Got a codecov output JSON file showing that 0 lines are covered. For example:
Steps to reproduce
main-snapshot-2024-06-13
), runswift test --enable-code-coverage
..build/debug/codecov
and open theswift-testing-example.json
file. It may be useful to prettify the JSON to make it more readable.main.swift
and themyTestFunction
show 0 lines covered, wheras we would expect at least a few lines to be covered by the tests in the Tests/ directory.swift-testing version/commit hash
0.10.0/69d59cfc76e5daf498ca61f5af409f594768eef9
Swift & OS version (output of
swift --version ; uname -a
)Swift version 6.0-dev (LLVM 57177aa1b91540b, Swift 8be62863326595c)
Target: x86_64-unknown-linux-gnu
Linux server 6.1.0-21-amd64 swiftlang/swift-testing#1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: