@@ -25,6 +25,8 @@ import { BuildFlags } from "../toolchain/BuildFlags";
25
25
import { TestLibrary } from "../TestExplorer/TestRunner" ;
26
26
import { DisposableFileCollection } from "../utilities/tempFolder" ;
27
27
import { TargetType } from "../SwiftPackage" ;
28
+ import { TestingDebugConfigurationFactory } from "../debugger/buildConfig" ;
29
+ import { TestKind } from "../TestExplorer/TestKind" ;
28
30
29
31
interface CodeCovFile {
30
32
testLibrary : TestLibrary ;
@@ -140,24 +142,26 @@ export class TestCoverage {
140
142
* Exports a `.profdata` file using `llvm-cov export`, returning the result as a `Buffer`.
141
143
*/
142
144
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 > ( ) ;
150
146
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
+ ) ;
152
152
if ( process . platform === "darwin" ) {
153
- xcTestBinary += `/Contents/MacOS/${ packageName } PackageTests` ;
153
+ xcTestBinary += `/Contents/MacOS/${ this . folderContext . swiftPackage . name } PackageTests` ;
154
154
}
155
- coveredBinaries . push ( xcTestBinary ) ;
155
+ coveredBinaries . add ( xcTestBinary ) ;
156
156
}
157
157
158
158
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 ) ;
161
165
}
162
166
163
167
let buffer = Buffer . alloc ( 0 ) ;
0 commit comments