mirror of
https://github.com/github/codeql-action.git
synced 2026-01-04 21:50:17 +08:00
Add ML-powered queries enablement to init status report
We report this information in the `init` status report rather than the `analyze` status report so we can gather data about timeouts.
This commit is contained in:
@@ -7,6 +7,7 @@ import test, { ExecutionContext } from "ava";
|
||||
import * as sinon from "sinon";
|
||||
|
||||
import * as api from "./api-client";
|
||||
import { Config, PackWithVersion } from "./config-utils";
|
||||
import { getRunnerLogger, Logger } from "./logging";
|
||||
import { setupTests } from "./testing-utils";
|
||||
import * as util from "./util";
|
||||
@@ -291,3 +292,51 @@ async function mockStdInForAuthExpectError(
|
||||
util.getGitHubAuth(mockLogger, undefined, true, stdin)
|
||||
);
|
||||
}
|
||||
|
||||
const ML_POWERED_JS_STATUS_TESTS: Array<[PackWithVersion[], string]> = [
|
||||
[[], "false"],
|
||||
[[{ packName: util.ML_POWERED_JS_QUERIES_PACK_NAME }], "latest"],
|
||||
[
|
||||
[{ packName: util.ML_POWERED_JS_QUERIES_PACK_NAME, version: "0.0.2" }],
|
||||
"0.0.2",
|
||||
],
|
||||
[
|
||||
[
|
||||
{ packName: "someOtherPack" },
|
||||
{ packName: util.ML_POWERED_JS_QUERIES_PACK_NAME },
|
||||
],
|
||||
"latest",
|
||||
],
|
||||
];
|
||||
|
||||
for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
||||
const packDescriptions = `[${packs
|
||||
.map((pack) => JSON.stringify(pack))
|
||||
.join(", ")}]`;
|
||||
test(`ML-powered JS queries status report is "${expectedStatus}" for packs = ${packDescriptions}`, (t) => {
|
||||
return util.withTmpDir(async (tmpDir) => {
|
||||
const config: Config = {
|
||||
languages: [],
|
||||
queries: {},
|
||||
paths: [],
|
||||
pathsIgnore: [],
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
toolCacheDir: tmpDir,
|
||||
codeQLCmd: "",
|
||||
gitHubVersion: {
|
||||
type: util.GitHubVariant.DOTCOM,
|
||||
} as util.GitHubVersion,
|
||||
dbLocation: "",
|
||||
packs: {
|
||||
javascript: packs,
|
||||
},
|
||||
debugMode: false,
|
||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||
};
|
||||
|
||||
t.is(util.getMlPoweredJsQueriesStatus(config), expectedStatus);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user