@@ -9,152 +9,41 @@ namespace ts {
9
9
projFs = undefined ! ; // Release the contents
10
10
} ) ;
11
11
12
- function coreOutputs ( ) : string [ ] {
13
- return [
14
- "/src/lib/core/utilities.js" ,
15
- "/src/lib/core/utilities.d.ts" ,
16
- "/src/lib/core/tsconfig.tsbuildinfo"
17
- ] ;
18
- }
19
-
20
- function animalOutputs ( ) : string [ ] {
21
- return [
22
- "/src/lib/animals/animal.js" ,
23
- "/src/lib/animals/animal.d.ts" ,
24
- "/src/lib/animals/index.js" ,
25
- "/src/lib/animals/index.d.ts" ,
26
- "/src/lib/animals/dog.js" ,
27
- "/src/lib/animals/dog.d.ts" ,
28
- "/src/lib/animals/tsconfig.tsbuildinfo"
29
- ] ;
30
- }
31
-
32
- function zooOutputs ( ) : string [ ] {
33
- return [
34
- "/src/lib/zoo/zoo.js" ,
35
- "/src/lib/zoo/zoo.d.ts" ,
36
- "/src/lib/zoo/tsconfig.tsbuildinfo"
37
- ] ;
38
- }
39
-
40
- interface VerifyBuild {
41
- modifyDiskLayout : ( fs : vfs . FileSystem ) => void ;
42
- expectedExitStatus : ExitStatus ;
43
- expectedDiagnostics : ( fs : vfs . FileSystem ) => fakes . ExpectedDiagnostic [ ] ;
44
- expectedOutputs : readonly string [ ] ;
45
- notExpectedOutputs : readonly string [ ] ;
46
- }
47
-
48
- function verifyBuild ( { modifyDiskLayout, expectedExitStatus, expectedDiagnostics, expectedOutputs, notExpectedOutputs } : VerifyBuild ) {
49
- const fs = projFs . shadow ( ) ;
50
- const host = fakes . SolutionBuilderHost . create ( fs ) ;
51
- modifyDiskLayout ( fs ) ;
52
- const builder = createSolutionBuilder ( host , [ "/src/tsconfig.json" ] , { verbose : true } ) ;
53
- const exitStatus = builder . build ( ) ;
54
- assert . equal ( exitStatus , expectedExitStatus ) ;
55
- host . assertDiagnosticMessages ( ...expectedDiagnostics ( fs ) ) ;
56
- verifyOutputsPresent ( fs , expectedOutputs ) ;
57
- verifyOutputsAbsent ( fs , notExpectedOutputs ) ;
58
- }
59
-
60
- it ( "in master branch with everything setup correctly, reports no error" , ( ) => {
61
- verifyBuild ( {
62
- modifyDiskLayout : noop ,
63
- expectedExitStatus : ExitStatus . Success ,
64
- expectedDiagnostics : ( ) => [
65
- getExpectedDiagnosticForProjectsInBuild ( "src/core/tsconfig.json" , "src/animals/tsconfig.json" , "src/zoo/tsconfig.json" , "src/tsconfig.json" ) ,
66
- [ Diagnostics . Project_0_is_out_of_date_because_output_file_1_does_not_exist , "src/core/tsconfig.json" , "src/lib/core/utilities.js" ] ,
67
- [ Diagnostics . Building_project_0 , "/src/core/tsconfig.json" ] ,
68
- [ Diagnostics . Project_0_is_out_of_date_because_output_file_1_does_not_exist , "src/animals/tsconfig.json" , "src/lib/animals/animal.js" ] ,
69
- [ Diagnostics . Building_project_0 , "/src/animals/tsconfig.json" ] ,
70
- [ Diagnostics . Project_0_is_out_of_date_because_output_file_1_does_not_exist , "src/zoo/tsconfig.json" , "src/lib/zoo/zoo.js" ] ,
71
- [ Diagnostics . Building_project_0 , "/src/zoo/tsconfig.json" ]
72
- ] ,
73
- expectedOutputs : [ ...coreOutputs ( ) , ...animalOutputs ( ) , ...zooOutputs ( ) ] ,
74
- notExpectedOutputs : emptyArray
75
- } ) ;
12
+ verifyTsc ( {
13
+ scenario : "demo" ,
14
+ subScenario : "in master branch with everything setup correctly, reports no error" ,
15
+ fs : ( ) => projFs ,
16
+ commandLineArgs : [ "--b" , "/src/tsconfig.json" , "--verbose" ]
76
17
} ) ;
77
18
78
- it ( "in circular branch reports the error about it by stopping build" , ( ) => {
79
- verifyBuild ( {
80
- modifyDiskLayout : fs => replaceText (
81
- fs ,
82
- "/src/core/tsconfig.json" ,
83
- "}" ,
84
- `},
19
+ verifyTsc ( {
20
+ scenario : "demo" ,
21
+ subScenario : "in circular branch reports the error about it by stopping build" ,
22
+ fs : ( ) => projFs ,
23
+ commandLineArgs : [ "--b" , "/src/tsconfig.json" , "--verbose" ] ,
24
+ modifyFs : fs => replaceText (
25
+ fs ,
26
+ "/src/core/tsconfig.json" ,
27
+ "}" ,
28
+ `},
85
29
"references": [
86
30
{
87
31
"path": "../zoo"
88
32
}
89
33
]`
90
- ) ,
91
- expectedExitStatus : ExitStatus . ProjectReferenceCycle_OutputsSkipped ,
92
- expectedDiagnostics : ( ) => [
93
- getExpectedDiagnosticForProjectsInBuild ( "src/animals/tsconfig.json" , "src/zoo/tsconfig.json" , "src/core/tsconfig.json" , "src/tsconfig.json" ) ,
94
- errorDiagnostic ( [
95
- Diagnostics . Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0 ,
96
- [
97
- "/src/tsconfig.json" ,
98
- "/src/core/tsconfig.json" ,
99
- "/src/zoo/tsconfig.json" ,
100
- "/src/animals/tsconfig.json"
101
- ] . join ( "\r\n" )
102
- ] )
103
- ] ,
104
- expectedOutputs : emptyArray ,
105
- notExpectedOutputs : [ ...coreOutputs ( ) , ...animalOutputs ( ) , ...zooOutputs ( ) ]
106
- } ) ;
34
+ )
107
35
} ) ;
108
-
109
- it ( "in bad-ref branch reports the error about files not in rootDir at the import location" , ( ) => {
110
- verifyBuild ( {
111
- modifyDiskLayout : fs => prependText (
112
- fs ,
113
- "/src/core/utilities.ts" ,
114
- `import * as A from '../animals';
36
+ verifyTsc ( {
37
+ scenario : "demo" ,
38
+ subScenario : "in bad-ref branch reports the error about files not in rootDir at the import location" ,
39
+ fs : ( ) => projFs ,
40
+ commandLineArgs : [ "--b" , "/src/tsconfig.json" , "--verbose" ] ,
41
+ modifyFs : fs => prependText (
42
+ fs ,
43
+ "/src/core/utilities.ts" ,
44
+ `import * as A from '../animals';
115
45
`
116
- ) ,
117
- expectedExitStatus : ExitStatus . DiagnosticsPresent_OutputsSkipped ,
118
- expectedDiagnostics : fs => [
119
- getExpectedDiagnosticForProjectsInBuild ( "src/core/tsconfig.json" , "src/animals/tsconfig.json" , "src/zoo/tsconfig.json" , "src/tsconfig.json" ) ,
120
- [ Diagnostics . Project_0_is_out_of_date_because_output_file_1_does_not_exist , "src/core/tsconfig.json" , "src/lib/core/utilities.js" ] ,
121
- [ Diagnostics . Building_project_0 , "/src/core/tsconfig.json" ] ,
122
- {
123
- message : [ Diagnostics . File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files , "/src/animals/animal.ts" , "/src/core" ] ,
124
- location : expectedLocationIndexOf ( fs , "/src/animals/index.ts" , `'./animal'` ) ,
125
- } ,
126
- {
127
- message : [ Diagnostics . File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern , "/src/animals/animal.ts" , "/src/core/tsconfig.json" ] ,
128
- location : expectedLocationIndexOf ( fs , "/src/animals/index.ts" , `'./animal'` ) ,
129
- } ,
130
- {
131
- message : [ Diagnostics . File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files , "/src/animals/dog.ts" , "/src/core" ] ,
132
- location : expectedLocationIndexOf ( fs , "/src/animals/index.ts" , `'./dog'` ) ,
133
- } ,
134
- {
135
- message : [ Diagnostics . File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern , "/src/animals/dog.ts" , "/src/core/tsconfig.json" ] ,
136
- location : expectedLocationIndexOf ( fs , "/src/animals/index.ts" , `'./dog'` ) ,
137
- } ,
138
- {
139
- message : [ Diagnostics . _0_is_declared_but_its_value_is_never_read , "A" ] ,
140
- location : expectedLocationIndexOf ( fs , "/src/core/utilities.ts" , `import * as A from '../animals';` ) ,
141
- } ,
142
- {
143
- message : [ Diagnostics . File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files , "/src/animals/index.ts" , "/src/core" ] ,
144
- location : expectedLocationIndexOf ( fs , "/src/core/utilities.ts" , `'../animals'` ) ,
145
- } ,
146
- {
147
- message : [ Diagnostics . File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern , "/src/animals/index.ts" , "/src/core/tsconfig.json" ] ,
148
- location : expectedLocationIndexOf ( fs , "/src/core/utilities.ts" , `'../animals'` ) ,
149
- } ,
150
- [ Diagnostics . Project_0_can_t_be_built_because_its_dependency_1_has_errors , "src/animals/tsconfig.json" , "src/core" ] ,
151
- [ Diagnostics . Skipping_build_of_project_0_because_its_dependency_1_has_errors , "/src/animals/tsconfig.json" , "/src/core" ] ,
152
- [ Diagnostics . Project_0_can_t_be_built_because_its_dependency_1_was_not_built , "src/zoo/tsconfig.json" , "src/animals" ] ,
153
- [ Diagnostics . Skipping_build_of_project_0_because_its_dependency_1_was_not_built , "/src/zoo/tsconfig.json" , "/src/animals" ] ,
154
- ] ,
155
- expectedOutputs : emptyArray ,
156
- notExpectedOutputs : [ ...coreOutputs ( ) , ...animalOutputs ( ) , ...zooOutputs ( ) ]
157
- } ) ;
46
+ )
158
47
} ) ;
159
48
} ) ;
160
49
}
0 commit comments