Add test for paths with only globs

This commit is contained in:
Rasmus Wriedt Larsen
2024-01-04 13:45:18 +01:00
parent e345646da5
commit e7cc246a11
3 changed files with 65 additions and 1 deletions

View File

@@ -92,6 +92,36 @@ const util = __importStar(require("./util"));
t.is(process.env["LGTM_INDEX_FILTERS"], "include:path1\ninclude:path2\ninclude:**/path3\nexclude:path4\nexclude:path5\nexclude:path6/**");
});
});
(0, ava_1.default)("paths only has globs", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
const config = {
languages: [],
queries: {},
paths: ["path1/**", "**/path2"],
pathsIgnore: [],
originalUserInput: {},
tempDir: tmpDir,
codeQLCmd: "",
gitHubVersion: { type: util.GitHubVariant.DOTCOM },
dbLocation: path.resolve(tmpDir, "codeql_databases"),
packs: {},
debugMode: false,
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false,
queriesInputCombines: false,
},
trapCaches: {},
trapCacheDownloadTime: 0,
};
analysisPaths.includeAndExcludeAnalysisPaths(config);
t.is(process.env["LGTM_INDEX_INCLUDE"], "");
t.is(process.env["LGTM_INDEX_EXCLUDE"], undefined);
t.is(process.env["LGTM_INDEX_FILTERS"], "include:path1/**\ninclude:**/path2");
});
});
(0, ava_1.default)("exclude temp dir", async (t) => {
const tempDir = path.join(process.cwd(), "codeql-runner-temp");
const config = {