Swift 5.7 --build-tests --enable-code-coverage

In Swift 5.6 and earlier it was possible to separate build and test logs completely — build a package and tests in one command, then execute the tests capturing coverage into another:

% swift build --build-tests --enable-code-coverage
% swift test --skip-build --enable-code-coverage

With Swift 5.7 this is no longer possible as swift build --build-tests no longer supports --enabled-code-coverage:

% swift build --build-tests --enable-code-coverage
error: Unknown option '--enable-code-coverage'

Removing it causes --skip-build to fail to find the coverage:

% swift build --build-tests
% swift test --skip-build --enable-code-coverage
error: The folder “codecov” doesn’t exist.

The following works but the package is then built in both commands:

% swift build --build-tests
% swift test --enable-code-coverage

The simple swift test works well but the log then contains build and test execution:

% swift test --enable-code-coverage
1 Like