Skip to content

Commit 30f7058

Browse files
committed
JavaScript: Add test where outDir resolves to an unwanted path
1 parent 2f822cb commit 30f7058

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

javascript/extractor/test/com/semmle/js/extractor/test/AutoBuildTests.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,21 @@ public void skipFilesInTsconfigOutDirPointingToSourceRoot() throws IOException {
265265
runTest();
266266
}
267267

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+
268283
@Test
269284
public void includeFile() throws IOException {
270285
envVars.put("LGTM_INDEX_INCLUDE", "tst.js");

0 commit comments

Comments
 (0)