@@ -25,6 +25,8 @@ import { BuildFlags } from "../toolchain/BuildFlags";
2525import { TestLibrary } from "../TestExplorer/TestRunner" ;
2626import { DisposableFileCollection } from "../utilities/tempFolder" ;
2727import { TargetType } from "../SwiftPackage" ;
28+ import { TestingDebugConfigurationFactory } from "../debugger/buildConfig" ;
29+ import { TestKind } from "../TestExplorer/TestKind" ;
2830
2931interface CodeCovFile {
3032 testLibrary : TestLibrary ;
@@ -140,24 +142,26 @@ export class TestCoverage {
140142 * Exports a `.profdata` file using `llvm-cov export`, returning the result as a `Buffer`.
141143 */
142144 private async exportProfdata ( types : TestLibrary [ ] , mergedProfileFile : string ) : Promise < Buffer > {
143- const packageName = this . folderContext . swiftPackage . name ;
144- const buildDirectory = BuildFlags . buildDirectoryFromWorkspacePath (
145- this . folderContext . folder . fsPath ,
146- true
147- ) ;
148-
149- const coveredBinaries : string [ ] = [ ] ;
145+ const coveredBinaries = new Set < string > ( ) ;
150146 if ( types . includes ( TestLibrary . xctest ) ) {
151- let xcTestBinary = `${ buildDirectory } /debug/${ packageName } PackageTests.xctest` ;
147+ let xcTestBinary = await TestingDebugConfigurationFactory . testExecutableOutputPath (
148+ this . folderContext ,
149+ TestKind . coverage ,
150+ TestLibrary . xctest
151+ ) ;
152152 if ( process . platform === "darwin" ) {
153- xcTestBinary += `/Contents/MacOS/${ packageName } PackageTests` ;
153+ xcTestBinary += `/Contents/MacOS/${ this . folderContext . swiftPackage . name } PackageTests` ;
154154 }
155- coveredBinaries . push ( xcTestBinary ) ;
155+ coveredBinaries . add ( xcTestBinary ) ;
156156 }
157157
158158 if ( types . includes ( TestLibrary . swiftTesting ) ) {
159- const swiftTestBinary = `${ buildDirectory } /debug/${ packageName } PackageTests.swift-testing` ;
160- coveredBinaries . push ( swiftTestBinary ) ;
159+ const swiftTestBinary = await TestingDebugConfigurationFactory . testExecutableOutputPath (
160+ this . folderContext ,
161+ TestKind . coverage ,
162+ TestLibrary . swiftTesting
163+ ) ;
164+ coveredBinaries . add ( swiftTestBinary ) ;
161165 }
162166
163167 let buffer = Buffer . alloc ( 0 ) ;
0 commit comments