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)
current behavior:
swift test --enable-code-coverage
This current behavior assumes you will build and test every time.
attempting:
swift test --enable-code-coverage --skip-build
does not produce the code coverage folder.
Proposed behavior
swift build --build-tests --enable-code-coverage
Why:
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.
"$s3App20Auth0AuthenticatablePAA3JWT10JWTPayloadRzrlE12authenticate5using2on3NIO15EventLoopFutureCyxSgG14Authentication19BearerAuthorizationV_11DatabaseKit0P11Connectable_ptFZ"
Proposed behavior
Provide demangled Swift 5 function names in json
or
Provide updated tooling to demangle Swift 5 function name
- Specify output director for code coverage results
Current behavior:
Output is placed in the .build folder
Problem statement
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.
Proposed behavior
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.
Feedback?