Make variable name less ambiguous
This commit is contained in:
parent
d677f16692
commit
18cd03ab62
3 changed files with 25 additions and 25 deletions
24
lib/config-utils.test.js
generated
24
lib/config-utils.test.js
generated
|
|
@ -176,8 +176,8 @@ ava_1.default("load non-empty input", async (t) => {
|
||||||
codeQLCmd: codeQL.getPath(),
|
codeQLCmd: codeQL.getPath(),
|
||||||
};
|
};
|
||||||
const languages = 'javascript';
|
const languages = 'javascript';
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
const actualConfig = await configUtils.initConfig(languages, undefined, configFile, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
const actualConfig = await configUtils.initConfig(languages, undefined, configFilePath, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
||||||
// Should exactly equal the object we constructed earlier
|
// Should exactly equal the object we constructed earlier
|
||||||
t.deepEqual(actualConfig, expectedConfig);
|
t.deepEqual(actualConfig, expectedConfig);
|
||||||
});
|
});
|
||||||
|
|
@ -212,8 +212,8 @@ ava_1.default("Default queries are used", async (t) => {
|
||||||
- foo`;
|
- foo`;
|
||||||
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
||||||
const languages = 'javascript';
|
const languages = 'javascript';
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
await configUtils.initConfig(languages, undefined, configFile, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
await configUtils.initConfig(languages, undefined, configFilePath, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
||||||
// Check resolve queries was called correctly
|
// Check resolve queries was called correctly
|
||||||
t.deepEqual(resolveQueriesArgs.length, 1);
|
t.deepEqual(resolveQueriesArgs.length, 1);
|
||||||
t.deepEqual(resolveQueriesArgs[0].queries, ['javascript-code-scanning.qls']);
|
t.deepEqual(resolveQueriesArgs[0].queries, ['javascript-code-scanning.qls']);
|
||||||
|
|
@ -242,7 +242,7 @@ ava_1.default("Queries can be specified in config file", async (t) => {
|
||||||
name: my config
|
name: my config
|
||||||
queries:
|
queries:
|
||||||
- uses: ./foo`;
|
- uses: ./foo`;
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
||||||
const resolveQueriesArgs = [];
|
const resolveQueriesArgs = [];
|
||||||
const codeQL = codeql_1.setCodeQL({
|
const codeQL = codeql_1.setCodeQL({
|
||||||
|
|
@ -252,7 +252,7 @@ ava_1.default("Queries can be specified in config file", async (t) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = 'javascript';
|
const languages = 'javascript';
|
||||||
const config = await configUtils.initConfig(languages, undefined, configFile, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
const config = await configUtils.initConfig(languages, undefined, configFilePath, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for the default queries
|
// It'll be called once for the default queries
|
||||||
// and once for `./foo` from the config file.
|
// and once for `./foo` from the config file.
|
||||||
|
|
@ -271,7 +271,7 @@ ava_1.default("Queries from config file can be overridden in workflow file", asy
|
||||||
name: my config
|
name: my config
|
||||||
queries:
|
queries:
|
||||||
- uses: ./foo`;
|
- uses: ./foo`;
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
// This config item should take precedence over the config file but shouldn't affect the default queries.
|
// This config item should take precedence over the config file but shouldn't affect the default queries.
|
||||||
const queries = './override';
|
const queries = './override';
|
||||||
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
||||||
|
|
@ -284,7 +284,7 @@ ava_1.default("Queries from config file can be overridden in workflow file", asy
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = 'javascript';
|
const languages = 'javascript';
|
||||||
const config = await configUtils.initConfig(languages, queries, configFile, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
const config = await configUtils.initConfig(languages, queries, configFilePath, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for the default queries and once for `./override`,
|
// It'll be called once for the default queries and once for `./override`,
|
||||||
// but won't be called for './foo' from the config file.
|
// but won't be called for './foo' from the config file.
|
||||||
|
|
@ -304,7 +304,7 @@ ava_1.default("Queries in workflow file can be used in tandem with the 'disable
|
||||||
const inputFileContents = `
|
const inputFileContents = `
|
||||||
name: my config
|
name: my config
|
||||||
disable-default-queries: true`;
|
disable-default-queries: true`;
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
const queries = './workflow-query';
|
const queries = './workflow-query';
|
||||||
fs.mkdirSync(path.join(tmpDir, 'workflow-query'));
|
fs.mkdirSync(path.join(tmpDir, 'workflow-query'));
|
||||||
const resolveQueriesArgs = [];
|
const resolveQueriesArgs = [];
|
||||||
|
|
@ -315,7 +315,7 @@ ava_1.default("Queries in workflow file can be used in tandem with the 'disable
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = 'javascript';
|
const languages = 'javascript';
|
||||||
const config = await configUtils.initConfig(languages, queries, configFile, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
const config = await configUtils.initConfig(languages, queries, configFilePath, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for `./workflow-query`,
|
// It'll be called once for `./workflow-query`,
|
||||||
// but won't be called for the default one since that was disabled
|
// but won't be called for the default one since that was disabled
|
||||||
|
|
@ -364,7 +364,7 @@ ava_1.default("Queries in workflow file can be added to the set of queries witho
|
||||||
name: my config
|
name: my config
|
||||||
queries:
|
queries:
|
||||||
- uses: ./foo`;
|
- uses: ./foo`;
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
// These queries shouldn't override anything, because the value is prefixed with "+"
|
// These queries shouldn't override anything, because the value is prefixed with "+"
|
||||||
const queries = '+./additional1,./additional2';
|
const queries = '+./additional1,./additional2';
|
||||||
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
||||||
|
|
@ -378,7 +378,7 @@ ava_1.default("Queries in workflow file can be added to the set of queries witho
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = 'javascript';
|
const languages = 'javascript';
|
||||||
const config = await configUtils.initConfig(languages, queries, configFile, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
const config = await configUtils.initConfig(languages, queries, configFilePath, { owner: 'github', repo: 'example ' }, tmpDir, tmpDir, codeQL, tmpDir, 'token', 'https://github.example.com', logging_1.getRunnerLogger(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for the default queries,
|
// It'll be called once for the default queries,
|
||||||
// once for each of additional1 and additional2,
|
// once for each of additional1 and additional2,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -255,12 +255,12 @@ test("load non-empty input", async t => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const languages = 'javascript';
|
const languages = 'javascript';
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
|
|
||||||
const actualConfig = await configUtils.initConfig(
|
const actualConfig = await configUtils.initConfig(
|
||||||
languages,
|
languages,
|
||||||
undefined,
|
undefined,
|
||||||
configFile,
|
configFilePath,
|
||||||
{ owner: 'github', repo: 'example '},
|
{ owner: 'github', repo: 'example '},
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -309,12 +309,12 @@ test("Default queries are used", async t => {
|
||||||
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
||||||
|
|
||||||
const languages = 'javascript';
|
const languages = 'javascript';
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
|
|
||||||
await configUtils.initConfig(
|
await configUtils.initConfig(
|
||||||
languages,
|
languages,
|
||||||
undefined,
|
undefined,
|
||||||
configFile,
|
configFilePath,
|
||||||
{ owner: 'github', repo: 'example '},
|
{ owner: 'github', repo: 'example '},
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -355,7 +355,7 @@ test("Queries can be specified in config file", async t => {
|
||||||
queries:
|
queries:
|
||||||
- uses: ./foo`;
|
- uses: ./foo`;
|
||||||
|
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
|
|
||||||
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
||||||
|
|
||||||
|
|
@ -372,7 +372,7 @@ test("Queries can be specified in config file", async t => {
|
||||||
const config = await configUtils.initConfig(
|
const config = await configUtils.initConfig(
|
||||||
languages,
|
languages,
|
||||||
undefined,
|
undefined,
|
||||||
configFile,
|
configFilePath,
|
||||||
{ owner: 'github', repo: 'example '},
|
{ owner: 'github', repo: 'example '},
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -403,7 +403,7 @@ test("Queries from config file can be overridden in workflow file", async t => {
|
||||||
queries:
|
queries:
|
||||||
- uses: ./foo`;
|
- uses: ./foo`;
|
||||||
|
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
|
|
||||||
// This config item should take precedence over the config file but shouldn't affect the default queries.
|
// This config item should take precedence over the config file but shouldn't affect the default queries.
|
||||||
const queries = './override';
|
const queries = './override';
|
||||||
|
|
@ -424,7 +424,7 @@ test("Queries from config file can be overridden in workflow file", async t => {
|
||||||
const config = await configUtils.initConfig(
|
const config = await configUtils.initConfig(
|
||||||
languages,
|
languages,
|
||||||
queries,
|
queries,
|
||||||
configFile,
|
configFilePath,
|
||||||
{ owner: 'github', repo: 'example '},
|
{ owner: 'github', repo: 'example '},
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -456,7 +456,7 @@ test("Queries in workflow file can be used in tandem with the 'disable default q
|
||||||
const inputFileContents = `
|
const inputFileContents = `
|
||||||
name: my config
|
name: my config
|
||||||
disable-default-queries: true`;
|
disable-default-queries: true`;
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
|
|
||||||
const queries = './workflow-query';
|
const queries = './workflow-query';
|
||||||
fs.mkdirSync(path.join(tmpDir, 'workflow-query'));
|
fs.mkdirSync(path.join(tmpDir, 'workflow-query'));
|
||||||
|
|
@ -474,7 +474,7 @@ test("Queries in workflow file can be used in tandem with the 'disable default q
|
||||||
const config = await configUtils.initConfig(
|
const config = await configUtils.initConfig(
|
||||||
languages,
|
languages,
|
||||||
queries,
|
queries,
|
||||||
configFile,
|
configFilePath,
|
||||||
{ owner: 'github', repo: 'example '},
|
{ owner: 'github', repo: 'example '},
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -553,7 +553,7 @@ test("Queries in workflow file can be added to the set of queries without overri
|
||||||
name: my config
|
name: my config
|
||||||
queries:
|
queries:
|
||||||
- uses: ./foo`;
|
- uses: ./foo`;
|
||||||
const configFile = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
|
|
||||||
// These queries shouldn't override anything, because the value is prefixed with "+"
|
// These queries shouldn't override anything, because the value is prefixed with "+"
|
||||||
const queries = '+./additional1,./additional2';
|
const queries = '+./additional1,./additional2';
|
||||||
|
|
@ -575,7 +575,7 @@ test("Queries in workflow file can be added to the set of queries without overri
|
||||||
const config = await configUtils.initConfig(
|
const config = await configUtils.initConfig(
|
||||||
languages,
|
languages,
|
||||||
queries,
|
queries,
|
||||||
configFile,
|
configFilePath,
|
||||||
{ owner: 'github', repo: 'example '},
|
{ owner: 'github', repo: 'example '},
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue