mirror of
https://github.com/github/codeql-action.git
synced 2026-10-31 01:49:43 +00:00
Cache CLI version information across Actions steps
This commit is contained in:
@@ -532,3 +532,26 @@ test("Failure.orElse returns the default value for a failure result", (t) => {
|
||||
const result = new util.Failure(new Error("test error"));
|
||||
t.is(result.orElse("default value"), "default value");
|
||||
});
|
||||
|
||||
test("getCachedCodeQlVersion reuses a version persisted by an earlier step", (t) => {
|
||||
process.env[EnvVar.CODEQL_VERSION_INFO] = JSON.stringify({
|
||||
cmd: "/path/to/codeql",
|
||||
version: { version: "2.20.0" },
|
||||
});
|
||||
t.deepEqual(util.getCachedCodeQlVersion("/path/to/codeql"), {
|
||||
version: "2.20.0",
|
||||
});
|
||||
});
|
||||
|
||||
test("getCachedCodeQlVersion ignores a persisted version from a different CLI", (t) => {
|
||||
process.env[EnvVar.CODEQL_VERSION_INFO] = JSON.stringify({
|
||||
cmd: "/path/to/other-codeql",
|
||||
version: { version: "2.20.0" },
|
||||
});
|
||||
t.is(util.getCachedCodeQlVersion("/path/to/codeql"), undefined);
|
||||
});
|
||||
|
||||
test("getCachedCodeQlVersion ignores a malformed persisted value", (t) => {
|
||||
process.env[EnvVar.CODEQL_VERSION_INFO] = "not valid json";
|
||||
t.is(util.getCachedCodeQlVersion("/path/to/codeql"), undefined);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user