Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not artificially restrict the set of supported languages #779

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add test
  • Loading branch information
esbena committed Oct 28, 2021
commit 91e3c857abf66fbd599732edecadde3999a5af76
74 changes: 72 additions & 2 deletions src/config-utils.test.ts
Original file line number Diff line number Diff line change
@@ -974,7 +974,7 @@ test("No detected languages", async (t) => {
});
});

test("Unknown languages", async (t) => {
test("Unknown, unsupported languages", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
const languages = "rubbish,english";

@@ -998,7 +998,77 @@ test("Unknown languages", async (t) => {
} catch (err) {
t.deepEqual(
err,
new Error(configUtils.getUnsupportedLanguagesError(["rubbish", "english"]))
new Error(
configUtils.getUnsupportedLanguagesError(["rubbish", "english"])
)
);
}
});
});

test("Unknown, supported languages", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
const languages = "ql";

const codeQL = setCodeQL({
async resolveLanguages() {
return {
ql: ["/tmp/ql-for-ql-pack"],
};
},
});

let config: configUtils.Config = await configUtils.initConfig(
languages,
undefined,
undefined,
undefined,
undefined,
{ owner: "github", repo: "example " },
tmpDir,
tmpDir,
codeQL,
tmpDir,
gitHubVersion,
sampleApiDetails,
getRunnerLogger(true)
);
t.deepEqual(config.languages, ["ql"]);
});
});

test("Partially supported languages", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
const languages = "rubbish,ql";

const codeQL = setCodeQL({
async resolveLanguages() {
return {
ql: ["/tmp/ql-for-ql-pack"],
};
},
});
try {
await configUtils.initConfig(
languages,
undefined,
undefined,
undefined,
undefined,
{ owner: "github", repo: "example " },
tmpDir,
tmpDir,
codeQL,
tmpDir,
gitHubVersion,
sampleApiDetails,
getRunnerLogger(true)
);
throw new Error("initConfig did not throw error");
} catch (err) {
t.deepEqual(
err,
new Error(configUtils.getUnsupportedLanguagesError(["rubbish"]))
);
}
});