mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
introduce new syntax for built-in query suites
This commit is contained in:
9
lib/config-utils.test.js
generated
9
lib/config-utils.test.js
generated
@@ -87,6 +87,7 @@ ava_1.default("load non-empty input", async (t) => {
|
||||
name: my config
|
||||
disable-default-queries: true
|
||||
queries:
|
||||
- uses: ./
|
||||
- uses: ./foo
|
||||
- uses: foo/bar@dev
|
||||
paths-ignore:
|
||||
@@ -98,12 +99,14 @@ ava_1.default("load non-empty input", async (t) => {
|
||||
const expectedConfig = new configUtils.Config();
|
||||
expectedConfig.name = 'my config';
|
||||
expectedConfig.disableDefaultQueries = true;
|
||||
expectedConfig.additionalQueries.push('foo');
|
||||
expectedConfig.additionalQueries.push(tmpDir);
|
||||
expectedConfig.additionalQueries.push(path.join(tmpDir, 'foo'));
|
||||
expectedConfig.externalQueries = [new configUtils.ExternalQuery('foo/bar', 'dev')];
|
||||
expectedConfig.pathsIgnore = ['a', 'b'];
|
||||
expectedConfig.paths = ['c/d'];
|
||||
fs.writeFileSync(path.join(tmpDir, 'input'), inputFileContents, 'utf8');
|
||||
setInput('config-file', 'input');
|
||||
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
||||
const actualConfig = await configUtils.loadConfig();
|
||||
// Should exactly equal the object we constructed earlier
|
||||
t.deepEqual(actualConfig, expectedConfig);
|
||||
@@ -195,7 +198,9 @@ const testInputs = {
|
||||
"foo/bar": configUtils.getQueryUsesIncorrect("foo/bar"),
|
||||
"foo/bar@v1@v2": configUtils.getQueryUsesIncorrect("foo/bar@v1@v2"),
|
||||
"foo@master": configUtils.getQueryUsesIncorrect("foo@master"),
|
||||
"https://github.com/foo/bar@master": configUtils.getQueryUsesIncorrect("https://github.com/foo/bar@master")
|
||||
"https://github.com/foo/bar@master": configUtils.getQueryUsesIncorrect("https://github.com/foo/bar@master"),
|
||||
"./foo": configUtils.getLocalPathDoesNotExist("foo"),
|
||||
"./..": configUtils.getLocalPathOutsideOfRepository(".."),
|
||||
};
|
||||
for (const [input, result] of Object.entries(testInputs)) {
|
||||
ava_1.default("load invalid input - queries uses \"" + input + "\"", async (t) => {
|
||||
|
||||
Reference in New Issue
Block a user