address review comments

This commit is contained in:
Robert Brignull 2020-07-15 17:36:49 +01:00
parent 7bb6ac6c60
commit b86c3701ed
14 changed files with 149 additions and 94 deletions

8
lib/codeql.js generated
View file

@ -15,7 +15,7 @@ const path = __importStar(require("path"));
const semver = __importStar(require("semver"));
const util = __importStar(require("./util"));
/**
* Stores the CodeQL object, and is populated by `setupCodeQL`.
* Stores the CodeQL object, and is populated by `setupCodeQL` or `getCodeQL`.
* Can be overridden in tests using `setCodeQL`.
*/
let cachedCodeQL = undefined;
@ -88,6 +88,12 @@ function resolveFunction(partialCodeql, methodName) {
}
return partialCodeql[methodName];
}
/**
* Set the functionality for CodeQL methods. Only for use in tests.
*
* Accepts a partial object and any undefined methods will be implemented
* to immediately throw an exception indicating which method is missing.
*/
function setCodeQL(partialCodeql) {
cachedCodeQL = {
getDir: resolveFunction(partialCodeql, 'getDir'),