@@ -98,34 +98,42 @@ namespace ts.tscWatch {
98
98
for ( const stamp of outputFileStamps ) {
99
99
assert . isDefined ( stamp [ 1 ] , `${ stamp [ 0 ] } expected to be present` ) ;
100
100
}
101
- return { host, outputFileStamps } ;
101
+ return host ;
102
102
}
103
103
it ( "creates solution in watch mode" , ( ) => {
104
104
createSolutionInWatchMode ( ) ;
105
105
} ) ;
106
106
107
107
it ( "change builds changes and reports found errors message" , ( ) => {
108
- const { host, outputFileStamps } = createSolutionInWatchMode ( ) ;
109
- host . writeFile ( core [ 1 ] . path , `${ core [ 1 ] . content }
108
+ const host = createSolutionInWatchMode ( ) ;
109
+ verifyChange ( `${ core [ 1 ] . content }
110
110
export class someClass { }` ) ;
111
- host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Builds core
112
- const changedCore = getOutputFileStamps ( host ) ;
113
- verifyChangedFiles ( changedCore , outputFileStamps , [
114
- ...getOutputFileNames ( SubProject . core , "anotherModule" ) , // This should not be written really
115
- ...getOutputFileNames ( SubProject . core , "index" )
116
- ] ) ;
117
- host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Builds tests
118
- const changedTests = getOutputFileStamps ( host ) ;
119
- verifyChangedFiles ( changedTests , changedCore , [
120
- ...getOutputFileNames ( SubProject . tests , "index" ) // Again these need not be written
121
- ] ) ;
122
- host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Builds logic
123
- const changedLogic = getOutputFileStamps ( host ) ;
124
- verifyChangedFiles ( changedLogic , changedTests , [
125
- ...getOutputFileNames ( SubProject . logic , "index" ) // Again these need not be written
126
- ] ) ;
127
- host . checkTimeoutQueueLength ( 0 ) ;
128
- checkOutputErrorsIncremental ( host , emptyArray ) ;
111
+
112
+ // Another change requeues and builds it
113
+ verifyChange ( core [ 1 ] . content ) ;
114
+
115
+ function verifyChange ( coreContent : string ) {
116
+ const outputFileStamps = getOutputFileStamps ( host ) ;
117
+ host . writeFile ( core [ 1 ] . path , coreContent ) ;
118
+ host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Builds core
119
+ const changedCore = getOutputFileStamps ( host ) ;
120
+ verifyChangedFiles ( changedCore , outputFileStamps , [
121
+ ...getOutputFileNames ( SubProject . core , "anotherModule" ) , // This should not be written really
122
+ ...getOutputFileNames ( SubProject . core , "index" )
123
+ ] ) ;
124
+ host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Builds tests
125
+ const changedTests = getOutputFileStamps ( host ) ;
126
+ verifyChangedFiles ( changedTests , changedCore , [
127
+ ...getOutputFileNames ( SubProject . tests , "index" ) // Again these need not be written
128
+ ] ) ;
129
+ host . checkTimeoutQueueLengthAndRun ( 1 ) ; // Builds logic
130
+ const changedLogic = getOutputFileStamps ( host ) ;
131
+ verifyChangedFiles ( changedLogic , changedTests , [
132
+ ...getOutputFileNames ( SubProject . logic , "index" ) // Again these need not be written
133
+ ] ) ;
134
+ host . checkTimeoutQueueLength ( 0 ) ;
135
+ checkOutputErrorsIncremental ( host , emptyArray ) ;
136
+ }
129
137
} ) ;
130
138
131
139
// TODO: write tests reporting errors but that will have more involved work since file
0 commit comments