I've started to look at the Swift Code Coverage. I wanted to pitch my ideas here before submitting a formal proposal / pull request.
1. enable code coverage during build step (only when building debug configuration)
swift test --enable-code-coverage
This current behavior assumes you will build and test every time.
swift test --enable-code-coverage --skip-build
does not produce the code coverage folder.
swift build --build-tests --enable-code-coverage
There may be a need to run filtered tests
swift test --skip-update skip-build --filter AppTests.OpenApiTests/testReadOpenApiYAML
Rebuilding each time would not be the preferred behavior.
2. Demangled function names
Function name mangling. It does not appear that the tools are revised yet to demangle the function names defined in the json file output.
Provide demangled Swift 5 function names in json
Provide updated tooling to demangle Swift 5 function name
- Specify output director for code coverage results
Output is placed in the .build folder
My .gitignore file excludes the .build folder. In some instances, I may want the code coverage data saved so that I can run analysis during CI/CD without rebuilding and rerunning tests.
swift build --build-tests --enable-code-coverage --code-coverage-dir Tests/coverage
I would then be able to manage/analyze the coverage data before running any further CI/CD steps.