Skip to content

Commit b787be2

Browse files
authored
Ensure build output is printed on swift-testing compiler error (#919)
When performing a swift-testing test run with code that fails to compile the build output was being discarded. This made it hard to see why tests weren't being run. This was happening because swift-testing tests don't have their run started until the .swift-testing binary has sent all of its `test` events, which enumerate the parameterized test cases. This means that build output is witheld until the run starts. If there is a compile error, unless we call `testRunStarted()` to flush the buffer of test result output, nothing is printed to the Test Results panel and build output is lost.
1 parent 5753a7b commit b787be2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/TestExplorer/TestRunner.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,13 @@ export class TestRunner {
532532
if (error !== 1) {
533533
this.testRun.appendOutput(`\r\nError: ${getErrorDescription(error)}`);
534534
} else {
535+
// swift-testing tests don't have their run started until the .swift-testing binary has
536+
// sent all of its `test` events, which enumerate the parameterized test cases. This means that
537+
// build output is witheld until the run starts. If there is a compile error, unless we call
538+
// `testRunStarted()` to flush the buffer of test result output, the build error will be silently
539+
// discarded. If the test run has already started this is a no-op so its safe to call it multiple times.
540+
this.testRun.testRunStarted();
541+
535542
this.swiftTestOutputParser.close();
536543
}
537544
} finally {

0 commit comments

Comments
 (0)