mirror of
https://github.com/github/codeql-action.git
synced 2026-05-08 06:40:19 +00:00
Exclude the temporary directory from scanning.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import test from "ava";
|
||||
import * as path from "path";
|
||||
|
||||
import * as analysisPaths from "./analysis-paths";
|
||||
import { getRunnerLogger } from "./logging";
|
||||
import { setupTests } from "./testing-utils";
|
||||
import * as util from "./util";
|
||||
|
||||
@@ -18,7 +20,7 @@ test("emptyPaths", async (t) => {
|
||||
toolCacheDir: tmpDir,
|
||||
codeQLCmd: "",
|
||||
};
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config, getRunnerLogger(true));
|
||||
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
||||
t.is(process.env["LGTM_INDEX_EXCLUDE"], undefined);
|
||||
t.is(process.env["LGTM_INDEX_FILTERS"], undefined);
|
||||
@@ -37,7 +39,7 @@ test("nonEmptyPaths", async (t) => {
|
||||
toolCacheDir: tmpDir,
|
||||
codeQLCmd: "",
|
||||
};
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config, getRunnerLogger(true));
|
||||
t.is(process.env["LGTM_INDEX_INCLUDE"], "path1\npath2");
|
||||
t.is(process.env["LGTM_INDEX_EXCLUDE"], "path4\npath5");
|
||||
t.is(
|
||||
@@ -46,3 +48,23 @@ test("nonEmptyPaths", async (t) => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("exclude temp dir", async (t) => {
|
||||
return await util.withTmpDir(async (toolCacheDir) => {
|
||||
const tempDir = path.join(process.cwd(), "codeql-runner-temp");
|
||||
const config = {
|
||||
languages: [],
|
||||
queries: {},
|
||||
pathsIgnore: [],
|
||||
paths: [],
|
||||
originalUserInput: {},
|
||||
tempDir,
|
||||
toolCacheDir,
|
||||
codeQLCmd: "",
|
||||
};
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config, getRunnerLogger(true));
|
||||
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
||||
t.is(process.env["LGTM_INDEX_EXCLUDE"], tempDir);
|
||||
t.is(process.env["LGTM_INDEX_FILTERS"], undefined);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user