Skip to content

Commit 88a78f0

Browse files
committed
Fix unit tests
1 parent aa434aa commit 88a78f0

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed

lib/config-utils.test.js

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config-utils.test.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,6 +2314,7 @@ test("downloadPacks-with-registries", async (t) => {
23142314

23152315
const codeQL = setCodeQL({
23162316
packDownload: packDownloadStub,
2317+
getVersion: () => Promise.resolve("2.10.5"),
23172318
});
23182319

23192320
// packs are supplied for go, java, and python
@@ -2348,3 +2349,50 @@ test("downloadPacks-with-registries", async (t) => {
23482349
t.deepEqual(process.env.CODEQL_REGISTRIES_AUTH, "not-a-registries-auth");
23492350
});
23502351
});
2352+
2353+
test("downloadPacks-with-registries fails on 2.10.4", async (t) => {
2354+
// same thing, but this time include a registries block and
2355+
// associated env vars
2356+
return await util.withTmpDir(async (tmpDir) => {
2357+
process.env.GITHUB_TOKEN = "not-a-token";
2358+
process.env.CODEQL_REGISTRIES_AUTH = "not-a-registries-auth";
2359+
const logger = getRunnerLogger(true);
2360+
2361+
const registries = [
2362+
{
2363+
url: "http://ghcr.io",
2364+
packages: ["codeql/*", "dsp-testing/*"],
2365+
token: "not-a-token",
2366+
},
2367+
{
2368+
url: "https://containers.GHEHOSTNAME1/v2/",
2369+
packages: "semmle/*",
2370+
token: "still-not-a-token",
2371+
},
2372+
];
2373+
2374+
const codeQL = setCodeQL({
2375+
getVersion: () => Promise.resolve("2.10.4"),
2376+
});
2377+
await t.throwsAsync(
2378+
async () =>
2379+
// packs are supplied for go, java, and python
2380+
// analyzed languages are java, javascript, and python
2381+
{
2382+
/* packs are supplied for go, java, and python*/
2383+
/* analyzed languages are java, javascript, and python*/
2384+
return await configUtils.downloadPacks(
2385+
codeQL,
2386+
[Language.javascript, Language.java, Language.python],
2387+
{},
2388+
registries,
2389+
sampleApiDetails,
2390+
tmpDir,
2391+
logger
2392+
);
2393+
},
2394+
{ instanceOf: Error },
2395+
"'registries' input is not supported on CodeQL versions less than 2.10.5."
2396+
);
2397+
});
2398+
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy