Refactoring: Introduce common method to stub a config
This means that we don't need to update irrelevant test cases when we add a new configuration property.
This commit is contained in:
parent
ec42edcaab
commit
d2e867f3be
18 changed files with 114 additions and 207 deletions
44
lib/trap-caching.test.js
generated
44
lib/trap-caching.test.js
generated
|
|
@ -78,48 +78,22 @@ const stubCodeql = (0, codeql_1.setCodeQL)({
|
|||
};
|
||||
},
|
||||
});
|
||||
const testConfigWithoutTmpDir = {
|
||||
const testConfigWithoutTmpDir = (0, testing_utils_1.createTestConfig)({
|
||||
languages: [languages_1.Language.javascript, languages_1.Language.cpp],
|
||||
originalUserInput: {},
|
||||
tempDir: "",
|
||||
codeQLCmd: "",
|
||||
gitHubVersion: {
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
},
|
||||
dbLocation: "",
|
||||
debugMode: false,
|
||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||
augmentationProperties: {
|
||||
packsInputCombines: false,
|
||||
queriesInputCombines: false,
|
||||
},
|
||||
trapCaches: {
|
||||
javascript: "/some/cache/dir",
|
||||
},
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
function getTestConfigWithTempDir(tmpDir) {
|
||||
return {
|
||||
});
|
||||
function getTestConfigWithTempDir(tempDir) {
|
||||
return (0, testing_utils_1.createTestConfig)({
|
||||
languages: [languages_1.Language.javascript, languages_1.Language.ruby],
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
codeQLCmd: "",
|
||||
gitHubVersion: { type: util.GitHubVariant.DOTCOM },
|
||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||
debugMode: false,
|
||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||
augmentationProperties: {
|
||||
packsInputCombines: false,
|
||||
queriesInputCombines: false,
|
||||
},
|
||||
tempDir,
|
||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||
trapCaches: {
|
||||
javascript: path.resolve(tmpDir, "jsCache"),
|
||||
ruby: path.resolve(tmpDir, "rubyCache"),
|
||||
javascript: path.resolve(tempDir, "jsCache"),
|
||||
ruby: path.resolve(tempDir, "rubyCache"),
|
||||
},
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
});
|
||||
}
|
||||
(0, ava_1.default)("check flags for JS, analyzing default branch", async (t) => {
|
||||
await util.withTmpDir(async (tmpDir) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue