Add logging for CodeQL CLI Version and add tests to the logger for it.

This commit is contained in:
Fotis Koutoulakis (@NlightNFotis) 2024-05-08 16:19:37 +01:00 committed by Fotis Koutoulakis
parent cbe408dfc9
commit cff15d7117
6 changed files with 32 additions and 3 deletions

View file

@ -90,8 +90,19 @@ ava_1.default.beforeEach(() => {
await (0, util_1.withTmpDir)(async (tmpDir) => {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
const source = await setupCodeql.getCodeQLSource("linked", testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, util_1.GitHubVariant.DOTCOM, logger);
// Assert first that we got the right version of the CodeQL CLI,
// and that we're sourcing it using the correct method for that.
t.is(source.toolsVersion, testing_utils_1.LINKED_CLI_VERSION.cliVersion);
t.is(source.sourceType, "download");
// Ensure that we're adequately notifying the user of the version we're using.
const expected_message = {
type: "info",
message: `Using CodeQL CLI version: ${testing_utils_1.LINKED_CLI_VERSION.cliVersion} from download.`,
};
loggedMessages.forEach((msg) => {
console.log(msg.message);
});
t.assert(loggedMessages.includes(expected_message));
});
});
(0, ava_1.default)("getCodeQLSource correctly returns bundled CLI version when tools == latest", async (t) => {