@@ -5,7 +5,7 @@ import { IApplicationShell, ICommandManager } from '../../common/application/typ
5
5
import * as constants from '../../common/constants' ;
6
6
import { ITestingSettings , Product } from '../../common/types' ;
7
7
import { IServiceContainer } from '../../ioc/types' ;
8
- import { TestDataItem , TestWorkspaceFolder } from '../types' ;
8
+ import { TestDataItem , TestDataItemType , TestWorkspaceFolder } from '../types' ;
9
9
import { CommandSource } from './constants' ;
10
10
import { TestFlatteningVisitor } from './testVisitors/flatteningVisitor' ;
11
11
import {
@@ -21,7 +21,6 @@ import {
21
21
TestSettingsPropertyNames ,
22
22
TestsToRun ,
23
23
TestSuite ,
24
- TestType ,
25
24
UnitTestProduct
26
25
} from './types' ;
27
26
@@ -244,21 +243,21 @@ export class TestsHelper implements ITestsHelper {
244
243
}
245
244
}
246
245
247
- export function getTestType ( test : TestDataItem ) : TestType {
246
+ export function getTestDataItemType ( test : TestDataItem ) : TestDataItemType {
248
247
if ( test instanceof TestWorkspaceFolder ) {
249
- return TestType . testWorkspaceFolder ;
248
+ return TestDataItemType . workspaceFolder ;
250
249
}
251
250
if ( getTestFile ( test ) ) {
252
- return TestType . testFile ;
251
+ return TestDataItemType . file ;
253
252
}
254
253
if ( getTestFolder ( test ) ) {
255
- return TestType . testFolder ;
254
+ return TestDataItemType . folder ;
256
255
}
257
256
if ( getTestSuite ( test ) ) {
258
- return TestType . testSuite ;
257
+ return TestDataItemType . suite ;
259
258
}
260
259
if ( getTestFunction ( test ) ) {
261
- return TestType . testFunction ;
260
+ return TestDataItemType . function ;
262
261
}
263
262
throw new Error ( 'Unknown test type' ) ;
264
263
}
@@ -305,14 +304,14 @@ export function getTestFunction(test: TestDataItem): TestFunction | undefined {
305
304
* @returns {(TestDataItem | undefined) }
306
305
*/
307
306
export function getParent ( tests : Tests , data : TestDataItem ) : TestDataItem | undefined {
308
- switch ( getTestType ( data ) ) {
309
- case TestType . testFile : {
307
+ switch ( getTestDataItemType ( data ) ) {
308
+ case TestDataItemType . file : {
310
309
return getParentTestFolderForFile ( tests , data as TestFile ) ;
311
310
}
312
- case TestType . testFolder : {
311
+ case TestDataItemType . folder : {
313
312
return getParentTestFolder ( tests , data as TestFolder ) ;
314
313
}
315
- case TestType . testSuite : {
314
+ case TestDataItemType . suite : {
316
315
const suite = data as TestSuite ;
317
316
if ( isSubtestsParent ( suite ) ) {
318
317
const fn = suite . functions [ 0 ] ;
@@ -328,7 +327,7 @@ export function getParent(tests: Tests, data: TestDataItem): TestDataItem | unde
328
327
}
329
328
return tests . testFiles . find ( item => item . suites . indexOf ( suite ) >= 0 ) ;
330
329
}
331
- case TestType . testFunction : {
330
+ case TestDataItemType . function : {
332
331
const fn = data as TestFunction ;
333
332
if ( fn . subtestParent ) {
334
333
return fn . subtestParent . asSuite ;
@@ -354,7 +353,7 @@ export function getParent(tests: Tests, data: TestDataItem): TestDataItem | unde
354
353
* @returns {(TestFolder | undefined) }
355
354
*/
356
355
function getParentTestFolder ( tests : Tests , item : TestFolder | TestFile ) : TestFolder | undefined {
357
- if ( getTestType ( item ) === TestType . testFolder ) {
356
+ if ( getTestDataItemType ( item ) === TestDataItemType . folder ) {
358
357
return getParentTestFolderForFolder ( tests , item as TestFolder ) ;
359
358
}
360
359
return getParentTestFolderForFile ( tests , item as TestFile ) ;
@@ -370,7 +369,7 @@ function getParentTestFolder(tests: Tests, item: TestFolder | TestFile): TestFol
370
369
export function getParentFile ( tests : Tests , suite : TestSuite | TestFunction ) : TestFile {
371
370
let parent = getParent ( tests , suite ) ;
372
371
while ( parent ) {
373
- if ( getTestType ( parent ) === TestType . testFile ) {
372
+ if ( getTestDataItemType ( parent ) === TestDataItemType . file ) {
374
373
return parent as TestFile ;
375
374
}
376
375
parent = getParent ( tests , parent ) ;
@@ -387,7 +386,7 @@ export function getParentFile(tests: Tests, suite: TestSuite | TestFunction): Te
387
386
export function getParentSuite ( tests : Tests , suite : TestSuite | TestFunction ) : TestSuite | undefined {
388
387
let parent = getParent ( tests , suite ) ;
389
388
while ( parent ) {
390
- if ( getTestType ( parent ) === TestType . testSuite ) {
389
+ if ( getTestDataItemType ( parent ) === TestDataItemType . suite ) {
391
390
return parent as TestSuite ;
392
391
}
393
392
parent = getParent ( tests , parent ) ;
@@ -453,22 +452,22 @@ export function findFlattendTestSuite(tests: Tests, suite: TestSuite): Flattened
453
452
* @returns {TestDataItem[] }
454
453
*/
455
454
export function getChildren ( item : TestDataItem ) : TestDataItem [ ] {
456
- switch ( getTestType ( item ) ) {
457
- case TestType . testFolder : {
455
+ switch ( getTestDataItemType ( item ) ) {
456
+ case TestDataItemType . folder : {
458
457
return [
459
458
...( item as TestFolder ) . folders ,
460
459
...( item as TestFolder ) . testFiles
461
460
] ;
462
461
}
463
- case TestType . testFile : {
462
+ case TestDataItemType . file : {
464
463
const [ subSuites , functions ] = divideSubtests ( ( item as TestFile ) . functions ) ;
465
464
return [
466
465
...functions ,
467
466
...( item as TestFile ) . suites ,
468
467
...subSuites
469
468
] ;
470
469
}
471
- case TestType . testSuite : {
470
+ case TestDataItemType . suite : {
472
471
let subSuites : TestSuite [ ] = [ ] ;
473
472
let functions = ( item as TestSuite ) . functions ;
474
473
if ( ! isSubtestsParent ( ( item as TestSuite ) ) ) {
@@ -480,7 +479,7 @@ export function getChildren(item: TestDataItem): TestDataItem[] {
480
479
...subSuites
481
480
] ;
482
481
}
483
- case TestType . testFunction : {
482
+ case TestDataItemType . function : {
484
483
return [ ] ;
485
484
}
486
485
default : {
0 commit comments