@@ -25,6 +25,7 @@ import { commands, debug, tests, workspace, CancellationToken, TestController, T
2525import * as path from 'path' ;
2626import { asRange , TestCase , TestSuite } from "../lsp/protocol" ;
2727import { extCommands , builtInCommands , nbCommands } from "../commands/commands"
28+ import { extConstants } from "../constants" ;
2829
2930export class NbTestAdapter {
3031
@@ -35,7 +36,7 @@ export class NbTestAdapter {
3536 private started : boolean = false ;
3637
3738 constructor ( ) {
38- this . testController = tests . createTestController ( 'apacheNetBeansController ', 'Apache NetBeans ' ) ;
39+ this . testController = tests . createTestController ( extConstants . ORACLE_VSCODE_EXTENSION_ID + '.testController ', 'Java ' ) ;
3940 const runHandler = ( request : TestRunRequest , cancellation : CancellationToken ) => this . run ( request , cancellation ) ;
4041 this . testController . createRunProfile ( 'Run Tests' , TestRunProfileKind . Run , runHandler ) ;
4142 this . testController . createRunProfile ( 'Debug Tests' , TestRunProfileKind . Debug , runHandler ) ;
@@ -219,54 +220,29 @@ export class NbTestAdapter {
219220 currentSuite . range = suiteRange ;
220221 }
221222 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 ;
226226 if ( currentTest ) {
227227 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 ) ;
229229 currentSuite ?. children . add ( currentTest ) ;
230230 }
231- const testRange = asRange ( test . range ) ;
231+ const testRange = asRange ( testCase . range ) ;
232232 if ( ! testExecution && testRange && testRange !== currentTest . range ) {
233233 currentTest . range = testRange ;
234234 }
235235 children . push ( currentTest ) ;
236236 } 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 ) ;
257240 children . push ( currentTest ) ;
258241 currentSuite ?. children . add ( currentTest ) ;
259242 }
260243 }
261244 } ) ;
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 ) {
270246 currentSuite . children . replace ( children ) ;
271247 }
272248 }
0 commit comments