swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
709 stars 47 forks source link

Add support for swift-testing #775

Closed plemarquand closed 1 month ago

plemarquand commented 2 months ago

Support running swift-testing tests the same as XCTests. If a test run has both types, swift-testing tests will be run first followed by XCTests.

First a list of XCTests and swift-testing tests to run is parsed from the test request. Test type is determined by a tag on each vscode.TestItem[], either "XCTest" or "swift-testing".

swift-testing tests are launched by running the binary named PackageTests.swift-testing inside the build debug folder. This binary is run with the --experimental-event-stream-output flag which forwards test events (test started, complete, issue recorded, etc) to a named pipe. The SwiftTestingOutputParser watches this pipe for events as the tests are being run and translates them in to ITestRunner calls to record test progress in VSCode.

There are different named pipe reader implementations between macOS/Linux and Windows.

plemarquand commented 1 month ago

@adam-fowler The related swift-testing changes are merged. If you're trying this out the swift-testing used must be the main branch until their next tagged release (> 0.8).

grynspan commented 1 month ago

I can tag 0.9 any time, although I've been trying to maintain a beginning-of-the-month cadence.

adam-fowler commented 1 month ago

@grynspan We have a few other things to finish before doing the next release of the extension, so you can probably hold off for a two weeks or so before doing a swift-testing release.