2
2
///<reference path='harness.ts'/>
3
3
///<reference path='runnerbase.ts' />
4
4
5
- const enum FourSlashTestType {
5
+ const enum FourSlashTestType {
6
6
Native ,
7
7
Shims ,
8
8
Server
@@ -35,70 +35,72 @@ class FourSlashRunner extends RunnerBase {
35
35
this . tests = this . enumerateFiles ( this . basePath , / \. t s / i, { recursive : false } ) ;
36
36
}
37
37
38
- this . tests . forEach ( ( fn : string ) => {
39
- describe ( fn , ( ) => {
40
- fn = ts . normalizeSlashes ( fn ) ;
41
- var justName = fn . replace ( / ^ .* [ \\ \/ ] / , '' ) ;
38
+ describe ( this . testSuiteName + ' tests' , ( ) => {
39
+ this . tests . forEach ( ( fn : string ) => {
40
+ describe ( fn , ( ) => {
41
+ fn = ts . normalizeSlashes ( fn ) ;
42
+ var justName = fn . replace ( / ^ .* [ \\ \/ ] / , '' ) ;
43
+
44
+ // Convert to relative path
45
+ var testIndex = fn . indexOf ( 'tests/' ) ;
46
+ if ( testIndex >= 0 ) fn = fn . substr ( testIndex ) ;
42
47
43
- // Convert to relative path
44
- var testIndex = fn . indexOf ( 'tests/' ) ;
45
- if ( testIndex >= 0 ) fn = fn . substr ( testIndex ) ;
48
+ if ( justName && ! justName . match ( / f o u r s l a s h \. t s $ / i) && ! justName . match ( / \. d \. t s $ / i) ) {
49
+ it ( this . testSuiteName + ' test ' + justName + ' runs correctly' , ( ) => {
50
+ FourSlash . runFourSlashTest ( this . basePath , this . testType , fn ) ;
51
+ } ) ;
52
+ }
53
+ } ) ;
54
+ } ) ;
46
55
47
- if ( justName && ! justName . match ( / f o u r s l a s h \. t s $ / i) && ! justName . match ( / \. d \. t s $ / i) ) {
48
- it ( this . testSuiteName + ' test ' + justName + ' runs correctly' , ( ) => {
49
- FourSlash . runFourSlashTest ( this . basePath , this . testType , fn ) ;
50
- } ) ;
56
+ describe ( 'Generate Tao XML' , ( ) => {
57
+ var invalidReasons : any = { } ;
58
+ FourSlash . xmlData . forEach ( xml => {
59
+ if ( xml . invalidReason !== null ) {
60
+ invalidReasons [ xml . invalidReason ] = ( invalidReasons [ xml . invalidReason ] || 0 ) + 1 ;
61
+ }
62
+ } ) ;
63
+ var invalidReport : { reason : string ; count : number } [ ] = [ ] ;
64
+ for ( var reason in invalidReasons ) {
65
+ if ( invalidReasons . hasOwnProperty ( reason ) ) {
66
+ invalidReport . push ( { reason : reason , count : invalidReasons [ reason ] } ) ;
67
+ }
51
68
}
52
- } ) ;
53
- } ) ;
69
+ invalidReport . sort ( ( lhs , rhs ) => lhs . count > rhs . count ? - 1 : lhs . count === rhs . count ? 0 : 1 ) ;
54
70
55
- describe ( 'Generate Tao XML' , ( ) => {
56
- var invalidReasons : any = { } ;
57
- FourSlash . xmlData . forEach ( xml => {
58
- if ( xml . invalidReason !== null ) {
59
- invalidReasons [ xml . invalidReason ] = ( invalidReasons [ xml . invalidReason ] || 0 ) + 1 ;
60
- }
71
+ var lines : string [ ] = [ ] ;
72
+ lines . push ( '<!-- Blocked Test Report' ) ;
73
+ invalidReport . forEach ( ( reasonAndCount ) => {
74
+ lines . push ( reasonAndCount . count + ' tests blocked by ' + reasonAndCount . reason ) ;
75
+ } ) ;
76
+ lines . push ( '-->' ) ;
77
+ lines . push ( '<TaoTest xmlns="http://microsoft.com/schemas/VSLanguages/TAO">' ) ;
78
+ lines . push ( ' <InitTest>' ) ;
79
+ lines . push ( ' <StartTarget />' ) ;
80
+ lines . push ( ' </InitTest>' ) ;
81
+ lines . push ( ' <ScenarioList>' ) ;
82
+ FourSlash . xmlData . forEach ( xml => {
83
+ if ( xml . invalidReason !== null ) {
84
+ lines . push ( '<!-- Skipped ' + xml . originalName + ', reason: ' + xml . invalidReason + ' -->' ) ;
85
+ } else {
86
+ lines . push ( ' <Scenario Name="' + xml . originalName + '">' ) ;
87
+ xml . actions . forEach ( action => {
88
+ lines . push ( ' ' + action ) ;
89
+ } ) ;
90
+ lines . push ( ' </Scenario>' ) ;
91
+ }
92
+ } ) ;
93
+ lines . push ( ' </ScenarioList>' ) ;
94
+ lines . push ( ' <CleanupScenario>' ) ;
95
+ lines . push ( ' <CloseAllDocuments />' ) ;
96
+ lines . push ( ' <CleanupCreatedFiles />' ) ;
97
+ lines . push ( ' </CleanupScenario>' ) ;
98
+ lines . push ( ' <CleanupTest>' ) ;
99
+ lines . push ( ' <CloseTarget />' ) ;
100
+ lines . push ( ' </CleanupTest>' ) ;
101
+ lines . push ( '</TaoTest>' ) ;
102
+ Harness . IO . writeFile ( 'built/local/fourslash.xml' , lines . join ( '\r\n' ) ) ;
61
103
} ) ;
62
- var invalidReport : { reason : string ; count : number } [ ] = [ ] ;
63
- for ( var reason in invalidReasons ) {
64
- if ( invalidReasons . hasOwnProperty ( reason ) ) {
65
- invalidReport . push ( { reason : reason , count : invalidReasons [ reason ] } ) ;
66
- }
67
- }
68
- invalidReport . sort ( ( lhs , rhs ) => lhs . count > rhs . count ? - 1 : lhs . count === rhs . count ? 0 : 1 ) ;
69
-
70
- var lines : string [ ] = [ ] ;
71
- lines . push ( '<!-- Blocked Test Report' ) ;
72
- invalidReport . forEach ( ( reasonAndCount ) => {
73
- lines . push ( reasonAndCount . count + ' tests blocked by ' + reasonAndCount . reason ) ;
74
- } ) ;
75
- lines . push ( '-->' ) ;
76
- lines . push ( '<TaoTest xmlns="http://microsoft.com/schemas/VSLanguages/TAO">' ) ;
77
- lines . push ( ' <InitTest>' ) ;
78
- lines . push ( ' <StartTarget />' ) ;
79
- lines . push ( ' </InitTest>' ) ;
80
- lines . push ( ' <ScenarioList>' ) ;
81
- FourSlash . xmlData . forEach ( xml => {
82
- if ( xml . invalidReason !== null ) {
83
- lines . push ( '<!-- Skipped ' + xml . originalName + ', reason: ' + xml . invalidReason + ' -->' ) ;
84
- } else {
85
- lines . push ( ' <Scenario Name="' + xml . originalName + '">' ) ;
86
- xml . actions . forEach ( action => {
87
- lines . push ( ' ' + action ) ;
88
- } ) ;
89
- lines . push ( ' </Scenario>' ) ;
90
- }
91
- } ) ;
92
- lines . push ( ' </ScenarioList>' ) ;
93
- lines . push ( ' <CleanupScenario>' ) ;
94
- lines . push ( ' <CloseAllDocuments />' ) ;
95
- lines . push ( ' <CleanupCreatedFiles />' ) ;
96
- lines . push ( ' </CleanupScenario>' ) ;
97
- lines . push ( ' <CleanupTest>' ) ;
98
- lines . push ( ' <CloseTarget />' ) ;
99
- lines . push ( ' </CleanupTest>' ) ;
100
- lines . push ( '</TaoTest>' ) ;
101
- Harness . IO . writeFile ( 'built/local/fourslash.xml' , lines . join ( '\r\n' ) ) ;
102
104
} ) ;
103
105
}
104
106
}
@@ -108,4 +110,4 @@ class GeneratedFourslashRunner extends FourSlashRunner {
108
110
super ( testType ) ;
109
111
this . basePath += '/generated/' ;
110
112
}
111
- }
113
+ }
0 commit comments