@@ -6,7 +6,10 @@ namespace ts.projectSystem {
6
6
describe ( "Project errors" , ( ) => {
7
7
function checkProjectErrors ( projectFiles : server . ProjectFilesWithTSDiagnostics , expectedErrors : string [ ] ) {
8
8
assert . isTrue ( projectFiles !== undefined , "missing project files" ) ;
9
- const errors = projectFiles . projectErrors ;
9
+ checkProjectErrorsWorker ( projectFiles . projectErrors , expectedErrors ) ;
10
+ }
11
+
12
+ function checkProjectErrorsWorker ( errors : Diagnostic [ ] , expectedErrors : string [ ] ) {
10
13
assert . equal ( errors ? errors . length : 0 , expectedErrors . length , `expected ${ expectedErrors . length } error in the list` ) ;
11
14
if ( expectedErrors . length ) {
12
15
for ( let i = 0 ; i < errors . length ; i ++ ) {
@@ -122,9 +125,13 @@ namespace ts.projectSystem {
122
125
projectService . checkNumberOfProjects ( { configuredProjects : 1 } ) ;
123
126
const configuredProject = forEach ( projectService . synchronizeProjectList ( [ ] ) , f => f . info . projectName === corruptedConfig . path && f ) ;
124
127
assert . isTrue ( configuredProject !== undefined , "should find configured project" ) ;
125
- checkProjectErrors ( configuredProject , [
128
+ checkProjectErrors ( configuredProject , [ ] ) ;
129
+ const projectErrors = projectService . configuredProjects [ 0 ] . getAllProjectErrors ( ) ;
130
+ checkProjectErrorsWorker ( projectErrors , [
126
131
"'{' expected."
127
132
] ) ;
133
+ assert . isNotNull ( projectErrors [ 0 ] . file ) ;
134
+ assert . equal ( projectErrors [ 0 ] . file . fileName , corruptedConfig . path ) ;
128
135
}
129
136
// fix config and trigger watcher
130
137
host . reloadFS ( [ file1 , file2 , correctConfig ] ) ;
@@ -134,6 +141,8 @@ namespace ts.projectSystem {
134
141
const configuredProject = forEach ( projectService . synchronizeProjectList ( [ ] ) , f => f . info . projectName === corruptedConfig . path && f ) ;
135
142
assert . isTrue ( configuredProject !== undefined , "should find configured project" ) ;
136
143
checkProjectErrors ( configuredProject , [ ] ) ;
144
+ const projectErrors = projectService . configuredProjects [ 0 ] . getAllProjectErrors ( ) ;
145
+ checkProjectErrorsWorker ( projectErrors , [ ] ) ;
137
146
}
138
147
} ) ;
139
148
@@ -163,6 +172,8 @@ namespace ts.projectSystem {
163
172
const configuredProject = forEach ( projectService . synchronizeProjectList ( [ ] ) , f => f . info . projectName === corruptedConfig . path && f ) ;
164
173
assert . isTrue ( configuredProject !== undefined , "should find configured project" ) ;
165
174
checkProjectErrors ( configuredProject , [ ] ) ;
175
+ const projectErrors = projectService . configuredProjects [ 0 ] . getAllProjectErrors ( ) ;
176
+ checkProjectErrorsWorker ( projectErrors , [ ] ) ;
166
177
}
167
178
// break config and trigger watcher
168
179
host . reloadFS ( [ file1 , file2 , corruptedConfig ] ) ;
@@ -171,10 +182,14 @@ namespace ts.projectSystem {
171
182
projectService . checkNumberOfProjects ( { configuredProjects : 1 } ) ;
172
183
const configuredProject = forEach ( projectService . synchronizeProjectList ( [ ] ) , f => f . info . projectName === corruptedConfig . path && f ) ;
173
184
assert . isTrue ( configuredProject !== undefined , "should find configured project" ) ;
174
- checkProjectErrors ( configuredProject , [
185
+ checkProjectErrors ( configuredProject , [ ] ) ;
186
+ const projectErrors = projectService . configuredProjects [ 0 ] . getAllProjectErrors ( ) ;
187
+ checkProjectErrorsWorker ( projectErrors , [
175
188
"'{' expected."
176
189
] ) ;
190
+ assert . isNotNull ( projectErrors [ 0 ] . file ) ;
191
+ assert . equal ( projectErrors [ 0 ] . file . fileName , corruptedConfig . path ) ;
177
192
}
178
193
} ) ;
179
194
} ) ;
180
- }
195
+ }
0 commit comments