@@ -89,14 +89,42 @@ export class TestingDebugConfigurationFactory {
89
89
90
90
switch ( process . platform ) {
91
91
case "darwin" :
92
- return this . buildDarwinConfg ( ) ;
92
+ return this . buildDarwinConfig ( ) ;
93
+ case "win32" :
94
+ return this . buildWindowsConfig ( ) ;
93
95
default :
94
- return this . buildNonDarwinConfig ( ) ;
96
+ return this . buildLinuxConfig ( ) ;
95
97
}
96
98
}
97
99
98
100
/* eslint-disable no-case-declarations */
99
- private buildNonDarwinConfig ( ) : vscode . DebugConfiguration | null {
101
+ private buildWindowsConfig ( ) : vscode . DebugConfiguration | null {
102
+ if ( isDebugging ( this . testKind ) && this . testLibrary === TestLibrary . xctest ) {
103
+ const testEnv = {
104
+ ...swiftRuntimeEnv ( ) ,
105
+ ...configuration . folder ( this . ctx . workspaceFolder ) . testEnvironmentVariables ,
106
+ } ;
107
+ // On Windows, add XCTest.dll to the Path
108
+ // and run the .xctest executable from the .build directory.
109
+ const runtimePath = this . ctx . workspaceContext . toolchain . runtimePath ;
110
+ const xcTestPath = this . ctx . workspaceContext . toolchain . xcTestPath ;
111
+ if ( xcTestPath && xcTestPath !== runtimePath ) {
112
+ testEnv . Path = `${ xcTestPath } ;${ testEnv . Path ?? process . env . Path } ` ;
113
+ }
114
+
115
+ return {
116
+ ...this . baseConfig ,
117
+ program : this . xcTestOutputPath ,
118
+ args : this . testList ,
119
+ env : testEnv ,
120
+ } ;
121
+ } else {
122
+ return this . buildDarwinConfig ( ) ;
123
+ }
124
+ }
125
+
126
+ /* eslint-disable no-case-declarations */
127
+ private buildLinuxConfig ( ) : vscode . DebugConfiguration | null {
100
128
if ( isDebugging ( this . testKind ) && this . testLibrary === TestLibrary . xctest ) {
101
129
return {
102
130
...this . baseConfig ,
@@ -108,11 +136,11 @@ export class TestingDebugConfigurationFactory {
108
136
} ,
109
137
} ;
110
138
} else {
111
- return this . buildDarwinConfg ( ) ;
139
+ return this . buildDarwinConfig ( ) ;
112
140
}
113
141
}
114
142
115
- private buildDarwinConfg ( ) : vscode . DebugConfiguration | null {
143
+ private buildDarwinConfig ( ) : vscode . DebugConfiguration | null {
116
144
switch ( this . testLibrary ) {
117
145
case TestLibrary . swiftTesting :
118
146
switch ( this . testKind ) {
0 commit comments