Merge remote-tracking branch 'upstream/main' into aeisenberg/pack-run
This commit is contained in:
commit
82388fd94a
36 changed files with 490 additions and 289 deletions
13
lib/analyze.test.js
generated
13
lib/analyze.test.js
generated
|
|
@ -58,7 +58,10 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
|||
for (const language of Object.values(languages_1.Language)) {
|
||||
codeql_1.setCodeQL({
|
||||
packDownload: async () => ({ packs: [] }),
|
||||
databaseAnalyze: async (_, sarifFile, searchPath) => {
|
||||
databaseRunQueries: async (_db, searchPath) => {
|
||||
searchPathsUsed.push(searchPath);
|
||||
},
|
||||
databaseInterpretResults: async (_db, _queriesRun, sarifFile) => {
|
||||
fs.writeFileSync(sarifFile, JSON.stringify({
|
||||
runs: [
|
||||
// variant 1 uses ruleId
|
||||
|
|
@ -88,7 +91,6 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
|||
{},
|
||||
],
|
||||
}));
|
||||
searchPathsUsed.push(searchPath);
|
||||
return "";
|
||||
},
|
||||
});
|
||||
|
|
@ -119,6 +121,7 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
|||
const hasPacks = language in packs;
|
||||
t.deepEqual(Object.keys(builtinStatusReport).length, hasPacks ? 2 : 1);
|
||||
t.true(`analyze_builtin_queries_${language}_duration_ms` in builtinStatusReport);
|
||||
t.true(`interpret_results_${language}_duration_ms` in builtinStatusReport);
|
||||
config.queries[language] = {
|
||||
builtin: [],
|
||||
custom: [
|
||||
|
|
@ -133,12 +136,13 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
|||
],
|
||||
};
|
||||
const customStatusReport = await analyze_1.runQueries(tmpDir, memoryFlag, addSnippetsFlag, threadsFlag, undefined, config, logging_1.getRunnerLogger(true));
|
||||
t.deepEqual(Object.keys(customStatusReport).length, 1);
|
||||
t.deepEqual(Object.keys(customStatusReport).length, 2);
|
||||
t.true(`analyze_custom_queries_${language}_duration_ms` in customStatusReport);
|
||||
const expectedSearchPathsUsed = hasPacks
|
||||
? [undefined, undefined, "/1", "/2", undefined]
|
||||
: [undefined, "/1", "/2"];
|
||||
t.deepEqual(searchPathsUsed, expectedSearchPathsUsed);
|
||||
t.true(`interpret_results_${language}_duration_ms` in customStatusReport);
|
||||
}
|
||||
verifyLineCounts(tmpDir);
|
||||
verifyQuerySuites(tmpDir);
|
||||
|
|
@ -146,8 +150,7 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
|||
function verifyLineCounts(tmpDir) {
|
||||
// eslint-disable-next-line github/array-foreach
|
||||
Object.keys(languages_1.Language).forEach((lang, i) => {
|
||||
verifyLineCountForFile(lang, path.join(tmpDir, `${lang}-builtin.sarif`), i + 1);
|
||||
verifyLineCountForFile(lang, path.join(tmpDir, `${lang}-custom.sarif`), i + 1);
|
||||
verifyLineCountForFile(lang, path.join(tmpDir, `${lang}.sarif`), i + 1);
|
||||
});
|
||||
}
|
||||
function verifyLineCountForFile(lang, filePath, lineCount) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue