Make variable name less ambiguous

This commit is contained in:
Sam Partington 2020-09-08 10:14:51 +01:00
parent d677f16692
commit 18cd03ab62
3 changed files with 25 additions and 25 deletions

View file

@ -176,8 +176,8 @@ ava_1.default("load non-empty input", async (t) => {
codeQLCmd: codeQL.getPath(),
};
const languages = 'javascript';
const configFile = 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 configFilePath = createConfigFile(inputFileContents, tmpDir);
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
t.deepEqual(actualConfig, expectedConfig);
});
@ -212,8 +212,8 @@ ava_1.default("Default queries are used", async (t) => {
- foo`;
fs.mkdirSync(path.join(tmpDir, 'foo'));
const languages = 'javascript';
const configFile = 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));
const configFilePath = createConfigFile(inputFileContents, tmpDir);
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
t.deepEqual(resolveQueriesArgs.length, 1);
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
queries:
- uses: ./foo`;
const configFile = createConfigFile(inputFileContents, tmpDir);
const configFilePath = createConfigFile(inputFileContents, tmpDir);
fs.mkdirSync(path.join(tmpDir, 'foo'));
const resolveQueriesArgs = [];
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 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
// It'll be called once for the default queries
// 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
queries:
- 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.
const queries = './override';
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 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
// It'll be called once for the default queries and once for `./override`,
// 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 = `
name: my config
disable-default-queries: true`;
const configFile = createConfigFile(inputFileContents, tmpDir);
const configFilePath = createConfigFile(inputFileContents, tmpDir);
const queries = './workflow-query';
fs.mkdirSync(path.join(tmpDir, 'workflow-query'));
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 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
// It'll be called once for `./workflow-query`,
// 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
queries:
- uses: ./foo`;
const configFile = createConfigFile(inputFileContents, tmpDir);
const configFilePath = createConfigFile(inputFileContents, tmpDir);
// These queries shouldn't override anything, because the value is prefixed with "+"
const queries = '+./additional1,./additional2';
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 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
// It'll be called once for the default queries,
// once for each of additional1 and additional2,

File diff suppressed because one or more lines are too long

View file

@ -255,12 +255,12 @@ test("load non-empty input", async t => {
};
const languages = 'javascript';
const configFile = createConfigFile(inputFileContents, tmpDir);
const configFilePath = createConfigFile(inputFileContents, tmpDir);
const actualConfig = await configUtils.initConfig(
languages,
undefined,
configFile,
configFilePath,
{ owner: 'github', repo: 'example '},
tmpDir,
tmpDir,
@ -309,12 +309,12 @@ test("Default queries are used", async t => {
fs.mkdirSync(path.join(tmpDir, 'foo'));
const languages = 'javascript';
const configFile = createConfigFile(inputFileContents, tmpDir);
const configFilePath = createConfigFile(inputFileContents, tmpDir);
await configUtils.initConfig(
languages,
undefined,
configFile,
configFilePath,
{ owner: 'github', repo: 'example '},
tmpDir,
tmpDir,
@ -355,7 +355,7 @@ test("Queries can be specified in config file", async t => {
queries:
- uses: ./foo`;
const configFile = createConfigFile(inputFileContents, tmpDir);
const configFilePath = createConfigFile(inputFileContents, tmpDir);
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(
languages,
undefined,
configFile,
configFilePath,
{ owner: 'github', repo: 'example '},
tmpDir,
tmpDir,
@ -403,7 +403,7 @@ test("Queries from config file can be overridden in workflow file", async t => {
queries:
- 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.
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(
languages,
queries,
configFile,
configFilePath,
{ owner: 'github', repo: 'example '},
tmpDir,
tmpDir,
@ -456,7 +456,7 @@ test("Queries in workflow file can be used in tandem with the 'disable default q
const inputFileContents = `
name: my config
disable-default-queries: true`;
const configFile = createConfigFile(inputFileContents, tmpDir);
const configFilePath = createConfigFile(inputFileContents, tmpDir);
const queries = './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(
languages,
queries,
configFile,
configFilePath,
{ owner: 'github', repo: 'example '},
tmpDir,
tmpDir,
@ -553,7 +553,7 @@ test("Queries in workflow file can be added to the set of queries without overri
name: my config
queries:
- uses: ./foo`;
const configFile = createConfigFile(inputFileContents, tmpDir);
const configFilePath = createConfigFile(inputFileContents, tmpDir);
// These queries shouldn't override anything, because the value is prefixed with "+"
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(
languages,
queries,
configFile,
configFilePath,
{ owner: 'github', repo: 'example '},
tmpDir,
tmpDir,