@@ -235,6 +235,51 @@ public void skipFilesInTsconfigOutDir() throws IOException {
235
235
runTest ();
236
236
}
237
237
238
+ @ Test
239
+ public void skipFilesInTsconfigOutDirPointingToParent () throws IOException {
240
+ // Test that outDir pointing to parent directory (outside source root) is ignored
241
+ addFile (true , LGTM_SRC , "tsconfig.json" );
242
+ Path config = Paths .get (LGTM_SRC .toString (), "tsconfig.json" );
243
+ Files .write (config ,
244
+ "{\" compilerOptions\" :{\" outDir\" :\" ..\" }}" .getBytes (StandardCharsets .UTF_8 ));
245
+
246
+ // All files should be extracted since outDir pointing outside source root should be ignored
247
+ addFile (true , LGTM_SRC , "src" , "app.ts" );
248
+ addFile (true , LGTM_SRC , "main.js" );
249
+
250
+ runTest ();
251
+ }
252
+
253
+ @ Test
254
+ public void skipFilesInTsconfigOutDirPointingToSourceRoot () throws IOException {
255
+ // Test that outDir pointing to source root itself is ignored
256
+ addFile (true , LGTM_SRC , "tsconfig.json" );
257
+ Path config = Paths .get (LGTM_SRC .toString (), "tsconfig.json" );
258
+ Files .write (config ,
259
+ "{\" compilerOptions\" :{\" outDir\" :\" .\" }}" .getBytes (StandardCharsets .UTF_8 ));
260
+
261
+ // All files should be extracted since outDir pointing to source root should be ignored
262
+ addFile (true , LGTM_SRC , "src" , "app.ts" );
263
+ addFile (true , LGTM_SRC , "main.js" );
264
+
265
+ runTest ();
266
+ }
267
+
268
+ @ Test
269
+ public void skipFilesInTsconfigOutDirWithRelativePath () throws IOException {
270
+ // Test that outDir with relative path "somedir/.." (resolves to root) is ignored
271
+ addFile (true , LGTM_SRC , "tsconfig.json" );
272
+ Path config = Paths .get (LGTM_SRC .toString (), "tsconfig.json" );
273
+ Files .write (config ,
274
+ "{\" compilerOptions\" :{\" outDir\" :\" somedir/..\" }}" .getBytes (StandardCharsets .UTF_8 ));
275
+
276
+ // All files should be extracted since outDir resolving to root should be ignored
277
+ addFile (true , LGTM_SRC , "src" , "app.ts" );
278
+ addFile (true , LGTM_SRC , "main.js" );
279
+
280
+ runTest ();
281
+ }
282
+
238
283
@ Test
239
284
public void includeFile () throws IOException {
240
285
envVars .put ("LGTM_INDEX_INCLUDE" , "tst.js" );
0 commit comments