@@ -7,8 +7,8 @@ import * as path from 'path';
7
7
import { Uri } from 'vscode' ;
8
8
import {
9
9
FlattenedTestFunction , FlattenedTestSuite ,
10
- SubtestParent , TestFile , TestFolder , TestFunction , TestProvider ,
11
- TestResult , Tests , TestStatus , TestSuite , TestSummary , TestType
10
+ SubtestParent , TestFile , TestFolder , TestFunction , TestingType ,
11
+ TestProvider , TestResult , Tests , TestStatus , TestSuite , TestSummary
12
12
} from '../../client/testing/common/types' ;
13
13
import { fixPath , getDedentedLines , getIndent , RESOURCE } from './helper' ;
14
14
@@ -19,7 +19,7 @@ type SuperTest = TestFunction & {
19
19
export type TestItem = TestFolder | TestFile | TestSuite | SuperTest | TestFunction ;
20
20
21
21
export type TestNode = TestItem & {
22
- testType : TestType ;
22
+ testType : TestingType ;
23
23
} ;
24
24
25
25
// Return an initialized test results.
@@ -69,7 +69,7 @@ export function findParentFile(parents: TestNode[]): TestFile | undefined {
69
69
// Iterate in reverse order.
70
70
for ( let i = parents . length ; i > 0 ; i -= 1 ) {
71
71
const parent = parents [ i - 1 ] ;
72
- if ( parent . testType === TestType . file ) {
72
+ if ( parent . testType === TestingType . file ) {
73
73
return parent as TestFile ;
74
74
}
75
75
}
@@ -81,7 +81,7 @@ export function findParentSuite(parents: TestNode[]): TestSuite | undefined {
81
81
// Iterate in reverse order.
82
82
for ( let i = parents . length ; i > 0 ; i -= 1 ) {
83
83
const parent = parents [ i - 1 ] ;
84
- if ( parent . testType === TestType . suite ) {
84
+ if ( parent . testType === TestingType . suite ) {
85
85
return parent as TestSuite ;
86
86
}
87
87
}
@@ -147,7 +147,7 @@ export namespace nodes {
147
147
nameToRun : nameToRun || dirname ,
148
148
folders : [ ] ,
149
149
testFiles : [ ] ,
150
- testType : TestType . folder ,
150
+ testType : TestingType . folder ,
151
151
// result
152
152
time : 0 ,
153
153
status : TestStatus . Unknown
@@ -175,7 +175,7 @@ export namespace nodes {
175
175
xmlName : xmlName ! ,
176
176
suites : [ ] ,
177
177
functions : [ ] ,
178
- testType : TestType . file ,
178
+ testType : TestingType . file ,
179
179
// result
180
180
time : 0 ,
181
181
status : TestStatus . Unknown
@@ -199,7 +199,7 @@ export namespace nodes {
199
199
isInstance : isInstance ,
200
200
suites : [ ] ,
201
201
functions : [ ] ,
202
- testType : TestType . suite ,
202
+ testType : TestingType . suite ,
203
203
// result
204
204
time : 0 ,
205
205
status : TestStatus . Unknown
@@ -217,7 +217,7 @@ export namespace nodes {
217
217
name : name ,
218
218
nameToRun : nameToRun || name ,
219
219
subtestParent : subtestParent ,
220
- testType : TestType . function ,
220
+ testType : TestingType . function ,
221
221
// result
222
222
time : 0 ,
223
223
status : TestStatus . Unknown
@@ -346,7 +346,7 @@ namespace declarative {
346
346
type ParsedTestNode = {
347
347
indent : string ;
348
348
name : string ;
349
- testType : TestType ;
349
+ testType : TestingType ;
350
350
result : TestResult ;
351
351
} ;
352
352
@@ -390,18 +390,18 @@ namespace declarative {
390
390
resource
391
391
) ;
392
392
switch ( parsed . testType ) {
393
- case TestType . folder :
393
+ case TestingType . folder :
394
394
tests . testFolders . push ( node as TestFolder ) ;
395
395
break ;
396
- case TestType . file :
396
+ case TestingType . file :
397
397
tests . testFiles . push ( node as TestFile ) ;
398
398
break ;
399
- case TestType . suite :
399
+ case TestingType . suite :
400
400
tests . testSuites . push (
401
401
flattenSuite ( node as TestSuite , parents )
402
402
) ;
403
403
break ;
404
- case TestType . function :
404
+ case TestingType . function :
405
405
// This does not deal with subtests?
406
406
tests . testFunctions . push (
407
407
flattenFunction ( node as TestFunction , parents )
@@ -438,10 +438,10 @@ namespace declarative {
438
438
}
439
439
440
440
// Determine the type from the name.
441
- let testType : TestType ;
441
+ let testType : TestingType ;
442
442
if ( name . endsWith ( '/' ) ) {
443
443
// folder
444
- testType = TestType . folder ;
444
+ testType = TestingType . folder ;
445
445
while ( name . endsWith ( '/' ) ) {
446
446
name = name . slice ( 0 , - 1 ) ;
447
447
}
@@ -450,24 +450,24 @@ namespace declarative {
450
450
if ( name . includes ( '/' ) ) {
451
451
throw Error ( 'filename must not include directories' ) ;
452
452
}
453
- testType = TestType . file ;
453
+ testType = TestingType . file ;
454
454
} else if ( name . startsWith ( '<' ) ) {
455
455
// suite
456
456
if ( ! name . endsWith ( '>' ) ) {
457
457
throw Error ( 'suite missing closing bracket' ) ;
458
458
}
459
- testType = TestType . suite ;
459
+ testType = TestingType . suite ;
460
460
name = name . slice ( 1 , - 1 ) ;
461
461
} else {
462
462
// test
463
- testType = TestType . function ;
463
+ testType = TestingType . function ;
464
464
}
465
465
466
466
// Parse the results.
467
467
const result : TestResult = {
468
468
time : 0
469
469
} ;
470
- if ( parts . length !== 0 && testType !== TestType . function ) {
470
+ if ( parts . length !== 0 && testType !== TestingType . function ) {
471
471
throw Error ( 'non-test nodes do not have results' ) ;
472
472
}
473
473
switch ( parts . length ) {
@@ -519,7 +519,7 @@ namespace declarative {
519
519
parsed : ParsedTestNode
520
520
) : boolean {
521
521
if ( parsed . indent === '' ) {
522
- if ( parsed . testType !== TestType . folder ) {
522
+ if ( parsed . testType !== TestingType . folder ) {
523
523
throw Error ( 'a top-level node must be a folder' ) ;
524
524
}
525
525
return true ;
@@ -555,13 +555,13 @@ namespace declarative {
555
555
function buildDiscoveredChildNode (
556
556
parent : TestParent ,
557
557
name : string ,
558
- testType : TestType ,
558
+ testType : TestingType ,
559
559
provider : TestProvider ,
560
560
resource ?: Uri
561
561
) : TestNode {
562
562
switch ( testType ) {
563
- case TestType . folder :
564
- if ( parent . testType !== TestType . folder ) {
563
+ case TestingType . folder :
564
+ if ( parent . testType !== TestingType . folder ) {
565
565
throw Error ( 'parent must be a folder' ) ;
566
566
}
567
567
return nodes . addDiscoveredSubFolder (
@@ -570,8 +570,8 @@ namespace declarative {
570
570
undefined ,
571
571
resource
572
572
) ;
573
- case TestType . file :
574
- if ( parent . testType !== TestType . folder ) {
573
+ case TestingType . file :
574
+ if ( parent . testType !== TestingType . folder ) {
575
575
throw Error ( 'parent must be a folder' ) ;
576
576
}
577
577
return nodes . addDiscoveredFile (
@@ -581,11 +581,11 @@ namespace declarative {
581
581
undefined ,
582
582
resource
583
583
) ;
584
- case TestType . suite :
584
+ case TestingType . suite :
585
585
let suiteParent : TestFile | TestSuite ;
586
- if ( parent . testType === TestType . file ) {
586
+ if ( parent . testType === TestingType . file ) {
587
587
suiteParent = parent as TestFile ;
588
- } else if ( parent . testType === TestType . suite ) {
588
+ } else if ( parent . testType === TestingType . suite ) {
589
589
suiteParent = parent as TestSuite ;
590
590
} else {
591
591
throw Error ( 'parent must be a file or suite' ) ;
@@ -599,13 +599,13 @@ namespace declarative {
599
599
undefined ,
600
600
resource
601
601
) ;
602
- case TestType . function :
602
+ case TestingType . function :
603
603
let funcParent : TestFile | TestSuite ;
604
- if ( parent . testType === TestType . file ) {
604
+ if ( parent . testType === TestingType . file ) {
605
605
funcParent = parent as TestFile ;
606
- } else if ( parent . testType === TestType . suite ) {
606
+ } else if ( parent . testType === TestingType . suite ) {
607
607
funcParent = parent as TestSuite ;
608
- } else if ( parent . testType === TestType . function ) {
608
+ } else if ( parent . testType === TestingType . function ) {
609
609
throw Error ( 'not finished: use addDiscoveredSubTest()' ) ;
610
610
} else {
611
611
throw Error ( 'parent must be a file, suite, or function' ) ;
0 commit comments