@@ -14,7 +14,7 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
14
14
15
15
// For each authority (i.e. server:namespace) accumulate a map of the class-level Test nodes in the tree.
16
16
// We don't yet support running only some TestXXX methods in a testclass
17
- const mapAuthorities = new Map < string , Map < string , vscode . TestItem > > ( ) ;
17
+ const mapAuthorities = new Map < string , Map < string , OurTestItem > > ( ) ;
18
18
const runIndices : number [ ] = [ ] ;
19
19
const queue : OurTestItem [ ] = [ ] ;
20
20
const coverageRequest = request . profile ?. kind === vscode . TestRunProfileKind . Coverage ;
@@ -56,8 +56,8 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
56
56
}
57
57
58
58
// If a leaf item (a TestXXX method in a class) note its .cls file for copying.
59
- // Every leaf must have a uri.
60
- if ( test . children . size === 0 && test . uri && test . parent ) {
59
+ // Every leaf should have a uri.
60
+ if ( test . children . size === 0 && test . uri ) {
61
61
let authority = test . uri . authority ;
62
62
let key = test . uri . path ;
63
63
if ( test . uri . scheme === "file" ) {
@@ -70,9 +70,13 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
70
70
}
71
71
}
72
72
73
- const mapTestClasses = mapAuthorities . get ( authority ) || new Map < string , vscode . TestItem > ( ) ;
74
- mapTestClasses . set ( key , test . parent ) ;
75
- mapAuthorities . set ( authority , mapTestClasses ) ;
73
+ const mapTestClasses = mapAuthorities . get ( authority ) || new Map < string , OurTestItem > ( ) ;
74
+ if ( ! mapTestClasses . has ( key ) && test . parent ) {
75
+ // When leaf is a test its parent has a uri and is the class
76
+ // Otherwise the leaf is a class with no tests
77
+ mapTestClasses . set ( key , test . parent . uri ? test . parent : test ) ;
78
+ mapAuthorities . set ( authority , mapTestClasses ) ;
79
+ }
76
80
}
77
81
78
82
// Queue any children
@@ -109,8 +113,16 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
109
113
) ;
110
114
let authority = mapInstance [ 0 ] ;
111
115
const mapTestClasses = mapInstance [ 1 ] ;
116
+
117
+ // enqueue everything up front so user sees immediately which tests will run
118
+ mapTestClasses . forEach ( ( test ) => {
119
+ test . children . forEach ( ( methodTest ) => {
120
+ run . enqueued ( methodTest ) ;
121
+ } ) ;
122
+ } ) ;
123
+
112
124
const firstClassTestItem = Array . from ( mapTestClasses . values ( ) ) [ 0 ] ;
113
- const oneUri = firstClassTestItem . uri ;
125
+ const oneUri = firstClassTestItem . ourUri ;
114
126
115
127
// This will always be true since every test added to the map above required a uri
116
128
if ( oneUri ) {
@@ -166,11 +178,16 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
166
178
const key = mapInstance [ 0 ] ;
167
179
const pathParts = key . split ( '/' ) ;
168
180
pathParts . pop ( ) ;
169
- const sourceBaseUri = mapInstance [ 1 ] . uri ?. with ( { path : mapInstance [ 1 ] . uri . path . split ( '/' ) . slice ( 0 , - pathParts . length ) . join ( '/' ) } ) ;
181
+ const sourceBaseUri = mapInstance [ 1 ] . ourUri ?. with ( { path : mapInstance [ 1 ] . ourUri . path . split ( '/' ) . slice ( 0 , - pathParts . length ) . join ( '/' ) } ) ;
170
182
if ( ! sourceBaseUri ) {
171
183
console . log ( `No sourceBaseUri for key=${ key } ` ) ;
172
184
continue ;
173
185
}
186
+ // isfs folders can't supply coverage.list files, so don't bother looking.
187
+ // Instead the file has to be put in the /namespace/UnitTestRoot/ folder of the /_vscode webapp of the %SYS namespace.
188
+ if ( [ 'isfs' , 'isfs-readonly' ] . includes ( sourceBaseUri . scheme ) ) {
189
+ continue ;
190
+ }
174
191
while ( pathParts . length > 1 ) {
175
192
const currentPath = pathParts . join ( '/' ) ;
176
193
// Check for coverage.list file here
@@ -217,6 +234,7 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
217
234
await vscode . workspace . fs . copy ( uri , directoryUri . with ( { path : directoryUri . path . concat ( clsFile ) } ) ) ;
218
235
} catch ( error ) {
219
236
console . log ( error ) ;
237
+ run . errored ( classTest , new vscode . TestMessage ( error instanceof Error ? error . message : String ( error ) ) ) ;
220
238
continue ;
221
239
}
222
240
@@ -241,8 +259,8 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
241
259
let testSpec = username ;
242
260
if ( request . include ?. length === 1 ) {
243
261
const idParts = request . include [ 0 ] . id . split ( ":" ) ;
244
- if ( idParts . length === 4 ) {
245
- testSpec = `${ username } :${ idParts [ 2 ] } :${ idParts [ 3 ] } ` ;
262
+ if ( idParts . length === 5 ) {
263
+ testSpec = `${ username } :${ idParts [ 3 ] } :${ idParts [ 4 ] } ` ;
246
264
}
247
265
}
248
266
@@ -264,7 +282,7 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
264
282
265
283
// Extra properties needed by our DebugAdapterTracker
266
284
testingRunIndex : runIndex ,
267
- testingIdBase : firstClassTestItem . id . split ( ":" , 2 ) . join ( ":" )
285
+ testingIdBase : firstClassTestItem . id . split ( ":" , 3 ) . join ( ":" )
268
286
} ;
269
287
const sessionOptions : vscode . DebugSessionOptions = {
270
288
noDebug : ! isDebug ,
0 commit comments