2020-05-04 18:28:01 +01:00
|
|
|
"use strict";
|
2021-07-27 17:59:59 +01:00
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
2023-01-18 20:00:33 +00:00
|
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
|
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
|
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
|
|
|
}
|
|
|
|
|
Object.defineProperty(o, k2, desc);
|
2021-07-27 17:59:59 +01:00
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
2020-05-04 18:28:01 +01:00
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
2021-07-27 17:59:59 +01:00
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
2020-05-04 18:28:01 +01:00
|
|
|
return result;
|
|
|
|
|
};
|
2020-10-05 12:44:58 +01:00
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
|
};
|
2020-05-04 18:28:01 +01:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2020-09-28 12:15:06 +01:00
|
|
|
const path = __importStar(require("path"));
|
2020-10-05 12:44:58 +01:00
|
|
|
const ava_1 = __importDefault(require("ava"));
|
2020-05-04 18:28:01 +01:00
|
|
|
const analysisPaths = __importStar(require("./analysis-paths"));
|
2020-06-22 12:12:14 +01:00
|
|
|
const testing_utils_1 = require("./testing-utils");
|
2020-08-19 15:11:49 +01:00
|
|
|
const util = __importStar(require("./util"));
|
2021-09-10 13:53:13 -07:00
|
|
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
|
|
|
|
(0, ava_1.default)("emptyPaths", async (t) => {
|
2020-08-19 15:11:49 +01:00
|
|
|
return await util.withTmpDir(async (tmpDir) => {
|
|
|
|
|
const config = {
|
|
|
|
|
languages: [],
|
|
|
|
|
queries: {},
|
|
|
|
|
pathsIgnore: [],
|
|
|
|
|
paths: [],
|
|
|
|
|
originalUserInput: {},
|
|
|
|
|
tempDir: tmpDir,
|
2020-09-14 10:44:43 +01:00
|
|
|
codeQLCmd: "",
|
2021-02-15 09:29:10 +00:00
|
|
|
gitHubVersion: { type: util.GitHubVariant.DOTCOM },
|
2021-05-17 10:35:09 +01:00
|
|
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
2021-06-03 09:32:44 -07:00
|
|
|
packs: {},
|
2021-10-28 14:15:22 +01:00
|
|
|
debugMode: false,
|
2022-01-07 13:11:51 +00:00
|
|
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
|
|
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
2022-06-19 16:44:24 -07:00
|
|
|
augmentationProperties: {
|
|
|
|
|
injectedMlQueries: false,
|
|
|
|
|
packsInputCombines: false,
|
|
|
|
|
queriesInputCombines: false,
|
|
|
|
|
},
|
2022-08-02 17:52:22 +01:00
|
|
|
trapCaches: {},
|
2022-08-15 14:44:43 +01:00
|
|
|
trapCacheDownloadTime: 0,
|
2020-08-19 15:11:49 +01:00
|
|
|
};
|
2020-10-01 09:29:13 +01:00
|
|
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
2020-09-14 10:44:43 +01:00
|
|
|
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
|
|
|
|
t.is(process.env["LGTM_INDEX_EXCLUDE"], undefined);
|
|
|
|
|
t.is(process.env["LGTM_INDEX_FILTERS"], undefined);
|
2020-08-19 15:11:49 +01:00
|
|
|
});
|
2020-05-04 18:28:01 +01:00
|
|
|
});
|
2021-09-10 13:53:13 -07:00
|
|
|
(0, ava_1.default)("nonEmptyPaths", async (t) => {
|
2020-08-19 15:11:49 +01:00
|
|
|
return await util.withTmpDir(async (tmpDir) => {
|
|
|
|
|
const config = {
|
|
|
|
|
languages: [],
|
|
|
|
|
queries: {},
|
2020-09-14 10:44:43 +01:00
|
|
|
paths: ["path1", "path2", "**/path3"],
|
|
|
|
|
pathsIgnore: ["path4", "path5", "path6/**"],
|
2020-08-19 15:11:49 +01:00
|
|
|
originalUserInput: {},
|
|
|
|
|
tempDir: tmpDir,
|
2020-09-14 10:44:43 +01:00
|
|
|
codeQLCmd: "",
|
2021-02-15 09:29:10 +00:00
|
|
|
gitHubVersion: { type: util.GitHubVariant.DOTCOM },
|
2021-05-17 10:35:09 +01:00
|
|
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
2021-06-03 09:32:44 -07:00
|
|
|
packs: {},
|
2021-10-28 14:15:22 +01:00
|
|
|
debugMode: false,
|
2022-01-07 13:11:51 +00:00
|
|
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
|
|
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
2022-06-19 16:44:24 -07:00
|
|
|
augmentationProperties: {
|
|
|
|
|
injectedMlQueries: false,
|
|
|
|
|
packsInputCombines: false,
|
|
|
|
|
queriesInputCombines: false,
|
|
|
|
|
},
|
2022-08-02 17:52:22 +01:00
|
|
|
trapCaches: {},
|
2022-08-15 14:44:43 +01:00
|
|
|
trapCacheDownloadTime: 0,
|
2020-08-19 15:11:49 +01:00
|
|
|
};
|
2020-10-01 09:29:13 +01:00
|
|
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
2020-09-14 10:44:43 +01:00
|
|
|
t.is(process.env["LGTM_INDEX_INCLUDE"], "path1\npath2");
|
|
|
|
|
t.is(process.env["LGTM_INDEX_EXCLUDE"], "path4\npath5");
|
|
|
|
|
t.is(process.env["LGTM_INDEX_FILTERS"], "include:path1\ninclude:path2\ninclude:**/path3\nexclude:path4\nexclude:path5\nexclude:path6/**");
|
2020-08-19 15:11:49 +01:00
|
|
|
});
|
2020-05-04 18:28:01 +01:00
|
|
|
});
|
2021-09-10 13:53:13 -07:00
|
|
|
(0, ava_1.default)("exclude temp dir", async (t) => {
|
2022-06-17 14:33:24 -07:00
|
|
|
const tempDir = path.join(process.cwd(), "codeql-runner-temp");
|
|
|
|
|
const config = {
|
|
|
|
|
languages: [],
|
|
|
|
|
queries: {},
|
|
|
|
|
pathsIgnore: [],
|
|
|
|
|
paths: [],
|
|
|
|
|
originalUserInput: {},
|
|
|
|
|
tempDir,
|
|
|
|
|
codeQLCmd: "",
|
|
|
|
|
gitHubVersion: { type: util.GitHubVariant.DOTCOM },
|
|
|
|
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
|
|
|
|
packs: {},
|
|
|
|
|
debugMode: false,
|
|
|
|
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
|
|
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
2022-07-13 13:27:04 -07:00
|
|
|
augmentationProperties: {
|
|
|
|
|
injectedMlQueries: false,
|
|
|
|
|
packsInputCombines: false,
|
|
|
|
|
queriesInputCombines: false,
|
|
|
|
|
},
|
2022-08-02 17:52:22 +01:00
|
|
|
trapCaches: {},
|
2022-08-15 14:44:43 +01:00
|
|
|
trapCacheDownloadTime: 0,
|
2022-06-17 14:33:24 -07:00
|
|
|
};
|
|
|
|
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
|
|
|
|
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
|
|
|
|
t.is(process.env["LGTM_INDEX_EXCLUDE"], "codeql-runner-temp");
|
|
|
|
|
t.is(process.env["LGTM_INDEX_FILTERS"], undefined);
|
2020-09-28 12:15:06 +01:00
|
|
|
});
|
2020-05-13 16:31:24 +01:00
|
|
|
//# sourceMappingURL=analysis-paths.test.js.map
|