@@ -25,6 +25,7 @@ import { commands, debug, tests, workspace, CancellationToken, TestController, T
25
25
import * as path from 'path' ;
26
26
import { asRange , TestCase , TestSuite } from "../lsp/protocol" ;
27
27
import { extCommands , builtInCommands , nbCommands } from "../commands/commands"
28
+ import { extConstants } from "../constants" ;
28
29
29
30
export class NbTestAdapter {
30
31
@@ -35,7 +36,7 @@ export class NbTestAdapter {
35
36
private started : boolean = false ;
36
37
37
38
constructor ( ) {
38
- this . testController = tests . createTestController ( 'apacheNetBeansController ', 'Apache NetBeans ' ) ;
39
+ this . testController = tests . createTestController ( extConstants . ORACLE_VSCODE_EXTENSION_ID + '.testController ', 'Java ' ) ;
39
40
const runHandler = ( request : TestRunRequest , cancellation : CancellationToken ) => this . run ( request , cancellation ) ;
40
41
this . testController . createRunProfile ( 'Run Tests' , TestRunProfileKind . Run , runHandler ) ;
41
42
this . testController . createRunProfile ( 'Debug Tests' , TestRunProfileKind . Debug , runHandler ) ;
@@ -219,54 +220,29 @@ export class NbTestAdapter {
219
220
currentSuite . range = suiteRange ;
220
221
}
221
222
const children : TestItem [ ] = [ ]
222
- const parentTests : Map < TestItem , TestItem [ ] > = new Map ( ) ;
223
- suite . tests ?. forEach ( test => {
224
- let currentTest = currentSuite ?. children . get ( test . id ) ;
225
- const testUri = test . file ? Uri . parse ( test . file ) : undefined ;
223
+ suite . tests ?. forEach ( testCase => {
224
+ let currentTest = currentSuite ?. children . get ( testCase . id ) ;
225
+ const testUri = testCase . file ? Uri . parse ( testCase . file ) : undefined ;
226
226
if ( currentTest ) {
227
227
if ( testUri && currentTest . uri ?. toString ( ) !== testUri ?. toString ( ) ) {
228
- currentTest = this . testController . createTestItem ( test . id , test . name , testUri ) ;
228
+ currentTest = this . testController . createTestItem ( testCase . id , testCase . name , testUri ) ;
229
229
currentSuite ?. children . add ( currentTest ) ;
230
230
}
231
- const testRange = asRange ( test . range ) ;
231
+ const testRange = asRange ( testCase . range ) ;
232
232
if ( ! testExecution && testRange && testRange !== currentTest . range ) {
233
233
currentTest . range = testRange ;
234
234
}
235
235
children . push ( currentTest ) ;
236
236
} else {
237
- if ( testExecution ) {
238
- const parents : Map < TestItem , string > = new Map ( ) ;
239
- currentSuite ?. children . forEach ( item => {
240
- const subName = this . subTestName ( item , test ) ;
241
- if ( subName && '()' !== subName ) {
242
- parents . set ( item , subName ) ;
243
- }
244
- } ) ;
245
- const parent = this . selectParent ( parents ) ;
246
- if ( parent ) {
247
- let arr = parentTests . get ( parent . test ) ;
248
- if ( ! arr ) {
249
- parentTests . set ( parent . test , arr = [ ] ) ;
250
- children . push ( parent . test ) ;
251
- }
252
- arr . push ( this . testController . createTestItem ( test . id , parent . label ) ) ;
253
- }
254
- } else {
255
- currentTest = this . testController . createTestItem ( test . id , test . name , testUri ) ;
256
- currentTest . range = asRange ( test . range ) ;
237
+ if ( ! testExecution ) {
238
+ currentTest = this . testController . createTestItem ( testCase . id , testCase . name , testUri ) ;
239
+ currentTest . range = asRange ( testCase . range ) ;
257
240
children . push ( currentTest ) ;
258
241
currentSuite ?. children . add ( currentTest ) ;
259
242
}
260
243
}
261
244
} ) ;
262
- if ( testExecution ) {
263
- parentTests . forEach ( ( val , key ) => {
264
- const item = this . testController . createTestItem ( key . id , key . label , key . uri ) ;
265
- item . range = key . range ;
266
- item . children . replace ( val ) ;
267
- currentSuite ?. children . add ( item ) ;
268
- } ) ;
269
- } else {
245
+ if ( ! testExecution ) {
270
246
currentSuite . children . replace ( children ) ;
271
247
}
272
248
}
0 commit comments