@@ -163,48 +163,88 @@ enum FRUITS {
163163 ` ) ;
164164} ) ;
165165
166- it ( 'should ignore ts files without any tsconfig that includes them' , async ( ) => {
167- const tmpDir = await setupTmpDir ( {
168- './tsconfig.json' : JSON . stringify ( {
169- compilerOptions : {
170- target : 'ES2020' ,
171- module : 'commonjs' ,
172- outDir : './dist' ,
173- rootDir : './src' ,
174- strict : false ,
175- esModuleInterop : true ,
176- forceConsistentCasingInFileNames : true ,
177- plugins : [
178- {
179- // ts will look up from the node_modules that the ts server is running from. e.g. ../../node_modules/ts-migrating
180- // this is why we add `ts-migrating` as dev dependency of itself.
181- name : 'ts-migrating' ,
182- compilerOptions : {
183- erasableSyntaxOnly : true ,
166+ describe ( 'ignoring files' , ( ) => {
167+ it ( 'should ignore ts files without any tsconfig that includes them' , async ( ) => {
168+ const tmpDir = await setupTmpDir ( {
169+ './tsconfig.json' : JSON . stringify ( {
170+ compilerOptions : {
171+ target : 'ES2020' ,
172+ module : 'commonjs' ,
173+ outDir : './dist' ,
174+ rootDir : './src' ,
175+ strict : false ,
176+ esModuleInterop : true ,
177+ forceConsistentCasingInFileNames : true ,
178+ plugins : [
179+ {
180+ // ts will look up from the node_modules that the ts server is running from. e.g. ../../node_modules/ts-migrating
181+ // this is why we add `ts-migrating` as dev dependency of itself.
182+ name : 'ts-migrating' ,
183+ compilerOptions : {
184+ erasableSyntaxOnly : true ,
185+ } ,
184186 } ,
185- } ,
187+ ] ,
188+ skipLibCheck : true ,
189+ } ,
190+ include : [ '.' ] ,
191+ exclude : [
192+ 'node_modules' ,
193+ 'dist' ,
194+ // excluding `ignored` directory!!!
195+ 'ignored' ,
186196 ] ,
187- skipLibCheck : true ,
188- } ,
189- include : [ '.' ] ,
190- exclude : [
191- 'node_modules' ,
192- 'dist' ,
193- // excluding `ignored` directory!!!
194- 'ignored' ,
195- ] ,
196- } ) ,
197- './src/index.ts' : `// @ts-migrating
197+ } ) ,
198+ './src/index.ts' : `// @ts-migrating
198199enum FRUITS {
199200 APPLE,
200201 BANANA,
201202 // @ts-migrating
202203 KIWI,
203204}
204205` ,
205- './ignored/index.ts' : 'laksdjflkj oiwejflaskdjf' ,
206+ './ignored/index.ts' : 'laksdjflkj oiwejflaskdjf' ,
207+ } ) ;
208+
209+ const diagnostics = getSemanticDiagnosticsForFile ( join ( tmpDir , 'ignored/index.ts' ) ) ;
210+ expect ( diagnostics ) . toHaveLength ( 0 ) ;
206211 } ) ;
207212
208- const diagnostics = getSemanticDiagnosticsForFile ( join ( tmpDir , 'ignored/index.ts' ) ) ;
209- expect ( diagnostics ) . toHaveLength ( 0 ) ;
213+ it ( 'should ignore projects without `ts-migrating` plugin' , async ( ) => {
214+ const tmpDir = await setupTmpDir ( {
215+ './tsconfig.json' : JSON . stringify ( {
216+ compilerOptions : {
217+ target : 'ES2020' ,
218+ module : 'commonjs' ,
219+ outDir : './dist' ,
220+ rootDir : './src' ,
221+ strict : false ,
222+ esModuleInterop : true ,
223+ forceConsistentCasingInFileNames : true ,
224+ plugins : [
225+ // no plugin!
226+ ] ,
227+ skipLibCheck : true ,
228+ } ,
229+ include : [ '.' ] ,
230+ exclude : [
231+ 'node_modules' ,
232+ 'dist' ,
233+ // excluding `ignored` directory!!!
234+ 'ignored' ,
235+ ] ,
236+ } ) ,
237+ './src/index.ts' : `// @ts-migrating
238+ enum FRUITS {
239+ APPLE,
240+ BANANA,
241+ // @ts-migrating
242+ KIWI,
243+ }
244+ ` ,
245+ } ) ;
246+
247+ const diagnostics = getSemanticDiagnosticsForFile ( join ( tmpDir , 'src/index.ts' ) ) ;
248+ expect ( diagnostics ) . toHaveLength ( 0 ) ;
249+ } ) ;
210250} ) ;
0 commit comments