You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is good that we can enable code coverage with spm with the swift test --enable-code-coverage flag. But reviewing the coverage is extremely painful and "unswifty", we have to write a shell script to do it, something like this:
swift test --enable-code-coverage
BIN_PATH="$(swift build --show-bin-path)"
XCTEST_PATH="$(find ${BIN_PATH} -name '*.xctest')"
COV_BUILD_FOLDER=$XCTEST_PATHif [[ "$OSTYPE"=="darwin"* ]];then
f="$(basename $XCTEST_PATH .xctest)"
COV_BUILD_FOLDER="${COV_BUILD_FOLDER}/Contents/MacOS/$f"fi
COV_DATA_PATH=".build/debug/codecov/default.profdata"
xcrun llvm-cov show $COV_BUILD_FOLDER -instr-profile=$COV_DATA_PATH -region-coverage-lt=99 -use-color
(might contain some copy paste errors)
This introduces a barrier/friction to using the code coverage.
I brought this up in Swift Forums and @grynspansuggested that I add an issue in this repo...
So what would be amazing is if SPM could do this for us, and enable three different options:
summary
details
exported report (choosing format)
You (maintainers of SPM) most likely have much deeper knowledge about llvm-cov than me, but for other readers I will include link to the script I use, I can call it with:
Summary
./test.sh --summary
which produces this:
With an overview and total coverage report.
Details
./test.sh
(my default)
which produces this:
Which displays every line where I've missed coverage ("exit tests" will help me test the assertionFailure missed lines 🥳).
Possible?
So my first question is, is it even possible to let SPM do this?
Wanted?
And second question is, do you agree that it would be indeed good to include this functionality (being able to display coverage using SPM - remove need to write a script...)?
Expected behavior
Would be nice if SPM cannot only produce the coverage, but also display it.
Actual behavior
SPM cannot display coverage it has produced.
Steps to reproduce
See description,
Swift Package Manager version/commit hash
Swift Package Manager - Swift 5.10.0-dev
Swift & OS version (output of swift --version && uname -a)
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Darwin Alexanders-MacBook-Pro.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 arm64
The text was updated successfully, but these errors were encountered:
Description
It is good that we can enable code coverage with spm with the
swift test --enable-code-coverage
flag. But reviewing the coverage is extremely painful and "unswifty", we have to write a shell script to do it, something like this:(might contain some copy paste errors)
This introduces a barrier/friction to using the code coverage.
I brought this up in Swift Forums and @grynspan suggested that I add an issue in this repo...
So what would be amazing is if SPM could do this for us, and enable three different options:
You (maintainers of SPM) most likely have much deeper knowledge about llvm-cov than me, but for other readers I will include link to the script I use, I can call it with:
Summary
which produces this:
With an overview and total coverage report.
Details
(my default)
which produces this:
Which displays every line where I've missed coverage ("exit tests" will help me test the
assertionFailure
missed lines 🥳).Possible?
So my first question is, is it even possible to let SPM do this?
Wanted?
And second question is, do you agree that it would be indeed good to include this functionality (being able to display coverage using SPM - remove need to write a script...)?
Expected behavior
Would be nice if SPM cannot only produce the coverage, but also display it.
Actual behavior
SPM cannot display coverage it has produced.
Steps to reproduce
See description,
Swift Package Manager version/commit hash
Swift Package Manager - Swift 5.10.0-dev
Swift & OS version (output of
swift --version && uname -a
)The text was updated successfully, but these errors were encountered: