@@ -14,7 +14,7 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
1414
1515 // For each authority (i.e. server:namespace) accumulate a map of the class-level Test nodes in the tree.
1616 // 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 > > ( ) ;
1818 const runIndices : number [ ] = [ ] ;
1919 const queue : OurTestItem [ ] = [ ] ;
2020 const coverageRequest = request . profile ?. kind === vscode . TestRunProfileKind . Coverage ;
@@ -56,8 +56,8 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
5656 }
5757
5858 // 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 ) {
6161 let authority = test . uri . authority ;
6262 let key = test . uri . path ;
6363 if ( test . uri . scheme === "file" ) {
@@ -70,9 +70,13 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
7070 }
7171 }
7272
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+ }
7680 }
7781
7882 // Queue any children
@@ -109,8 +113,16 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
109113 ) ;
110114 let authority = mapInstance [ 0 ] ;
111115 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+
112124 const firstClassTestItem = Array . from ( mapTestClasses . values ( ) ) [ 0 ] ;
113- const oneUri = firstClassTestItem . uri ;
125+ const oneUri = firstClassTestItem . ourUri ;
114126
115127 // This will always be true since every test added to the map above required a uri
116128 if ( oneUri ) {
@@ -166,11 +178,16 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
166178 const key = mapInstance [ 0 ] ;
167179 const pathParts = key . split ( '/' ) ;
168180 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 ( '/' ) } ) ;
170182 if ( ! sourceBaseUri ) {
171183 console . log ( `No sourceBaseUri for key=${ key } ` ) ;
172184 continue ;
173185 }
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+ }
174191 while ( pathParts . length > 1 ) {
175192 const currentPath = pathParts . join ( '/' ) ;
176193 // Check for coverage.list file here
@@ -217,6 +234,7 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
217234 await vscode . workspace . fs . copy ( uri , directoryUri . with ( { path : directoryUri . path . concat ( clsFile ) } ) ) ;
218235 } catch ( error ) {
219236 console . log ( error ) ;
237+ run . errored ( classTest , new vscode . TestMessage ( error instanceof Error ? error . message : String ( error ) ) ) ;
220238 continue ;
221239 }
222240
@@ -241,8 +259,8 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
241259 let testSpec = username ;
242260 if ( request . include ?. length === 1 ) {
243261 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 ] } ` ;
246264 }
247265 }
248266
@@ -264,7 +282,7 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
264282
265283 // Extra properties needed by our DebugAdapterTracker
266284 testingRunIndex : runIndex ,
267- testingIdBase : firstClassTestItem . id . split ( ":" , 2 ) . join ( ":" )
285+ testingIdBase : firstClassTestItem . id . split ( ":" , 3 ) . join ( ":" )
268286 } ;
269287 const sessionOptions : vscode . DebugSessionOptions = {
270288 noDebug : ! isDebug ,
0 commit comments