@@ -5,7 +5,7 @@ import { IApplicationShell, ICommandManager } from '../../common/application/typ
55import * as constants from '../../common/constants' ;
66import { ITestingSettings , Product } from '../../common/types' ;
77import { IServiceContainer } from '../../ioc/types' ;
8- import { TestDataItem , TestWorkspaceFolder } from '../types' ;
8+ import { TestDataItem , TestDataItemType , TestWorkspaceFolder } from '../types' ;
99import { CommandSource } from './constants' ;
1010import { TestFlatteningVisitor } from './testVisitors/flatteningVisitor' ;
1111import {
@@ -21,7 +21,6 @@ import {
2121 TestSettingsPropertyNames ,
2222 TestsToRun ,
2323 TestSuite ,
24- TestType ,
2524 UnitTestProduct
2625} from './types' ;
2726
@@ -244,21 +243,21 @@ export class TestsHelper implements ITestsHelper {
244243 }
245244}
246245
247- export function getTestType ( test : TestDataItem ) : TestType {
246+ export function getTestDataItemType ( test : TestDataItem ) : TestDataItemType {
248247 if ( test instanceof TestWorkspaceFolder ) {
249- return TestType . testWorkspaceFolder ;
248+ return TestDataItemType . workspaceFolder ;
250249 }
251250 if ( getTestFile ( test ) ) {
252- return TestType . testFile ;
251+ return TestDataItemType . file ;
253252 }
254253 if ( getTestFolder ( test ) ) {
255- return TestType . testFolder ;
254+ return TestDataItemType . folder ;
256255 }
257256 if ( getTestSuite ( test ) ) {
258- return TestType . testSuite ;
257+ return TestDataItemType . suite ;
259258 }
260259 if ( getTestFunction ( test ) ) {
261- return TestType . testFunction ;
260+ return TestDataItemType . function ;
262261 }
263262 throw new Error ( 'Unknown test type' ) ;
264263}
@@ -305,14 +304,14 @@ export function getTestFunction(test: TestDataItem): TestFunction | undefined {
305304 * @returns {(TestDataItem | undefined) }
306305 */
307306export function getParent ( tests : Tests , data : TestDataItem ) : TestDataItem | undefined {
308- switch ( getTestType ( data ) ) {
309- case TestType . testFile : {
307+ switch ( getTestDataItemType ( data ) ) {
308+ case TestDataItemType . file : {
310309 return getParentTestFolderForFile ( tests , data as TestFile ) ;
311310 }
312- case TestType . testFolder : {
311+ case TestDataItemType . folder : {
313312 return getParentTestFolder ( tests , data as TestFolder ) ;
314313 }
315- case TestType . testSuite : {
314+ case TestDataItemType . suite : {
316315 const suite = data as TestSuite ;
317316 if ( isSubtestsParent ( suite ) ) {
318317 const fn = suite . functions [ 0 ] ;
@@ -328,7 +327,7 @@ export function getParent(tests: Tests, data: TestDataItem): TestDataItem | unde
328327 }
329328 return tests . testFiles . find ( item => item . suites . indexOf ( suite ) >= 0 ) ;
330329 }
331- case TestType . testFunction : {
330+ case TestDataItemType . function : {
332331 const fn = data as TestFunction ;
333332 if ( fn . subtestParent ) {
334333 return fn . subtestParent . asSuite ;
@@ -354,7 +353,7 @@ export function getParent(tests: Tests, data: TestDataItem): TestDataItem | unde
354353 * @returns {(TestFolder | undefined) }
355354 */
356355function getParentTestFolder ( tests : Tests , item : TestFolder | TestFile ) : TestFolder | undefined {
357- if ( getTestType ( item ) === TestType . testFolder ) {
356+ if ( getTestDataItemType ( item ) === TestDataItemType . folder ) {
358357 return getParentTestFolderForFolder ( tests , item as TestFolder ) ;
359358 }
360359 return getParentTestFolderForFile ( tests , item as TestFile ) ;
@@ -370,7 +369,7 @@ function getParentTestFolder(tests: Tests, item: TestFolder | TestFile): TestFol
370369export function getParentFile ( tests : Tests , suite : TestSuite | TestFunction ) : TestFile {
371370 let parent = getParent ( tests , suite ) ;
372371 while ( parent ) {
373- if ( getTestType ( parent ) === TestType . testFile ) {
372+ if ( getTestDataItemType ( parent ) === TestDataItemType . file ) {
374373 return parent as TestFile ;
375374 }
376375 parent = getParent ( tests , parent ) ;
@@ -387,7 +386,7 @@ export function getParentFile(tests: Tests, suite: TestSuite | TestFunction): Te
387386export function getParentSuite ( tests : Tests , suite : TestSuite | TestFunction ) : TestSuite | undefined {
388387 let parent = getParent ( tests , suite ) ;
389388 while ( parent ) {
390- if ( getTestType ( parent ) === TestType . testSuite ) {
389+ if ( getTestDataItemType ( parent ) === TestDataItemType . suite ) {
391390 return parent as TestSuite ;
392391 }
393392 parent = getParent ( tests , parent ) ;
@@ -453,22 +452,22 @@ export function findFlattendTestSuite(tests: Tests, suite: TestSuite): Flattened
453452 * @returns {TestDataItem[] }
454453 */
455454export function getChildren ( item : TestDataItem ) : TestDataItem [ ] {
456- switch ( getTestType ( item ) ) {
457- case TestType . testFolder : {
455+ switch ( getTestDataItemType ( item ) ) {
456+ case TestDataItemType . folder : {
458457 return [
459458 ...( item as TestFolder ) . folders ,
460459 ...( item as TestFolder ) . testFiles
461460 ] ;
462461 }
463- case TestType . testFile : {
462+ case TestDataItemType . file : {
464463 const [ subSuites , functions ] = divideSubtests ( ( item as TestFile ) . functions ) ;
465464 return [
466465 ...functions ,
467466 ...( item as TestFile ) . suites ,
468467 ...subSuites
469468 ] ;
470469 }
471- case TestType . testSuite : {
470+ case TestDataItemType . suite : {
472471 let subSuites : TestSuite [ ] = [ ] ;
473472 let functions = ( item as TestSuite ) . functions ;
474473 if ( ! isSubtestsParent ( ( item as TestSuite ) ) ) {
@@ -480,7 +479,7 @@ export function getChildren(item: TestDataItem): TestDataItem[] {
480479 ...subSuites
481480 ] ;
482481 }
483- case TestType . testFunction : {
482+ case TestDataItemType . function : {
484483 return [ ] ;
485484 }
486485 default : {
0 commit comments