Add API call for languages if java in input
If a user explicitly includes java in their language inputs, always make an api call to check for kotlin in the repo. Also, add some suggestions from code reviews.
This commit is contained in:
parent
ad7ca9bf21
commit
eb19ecbad1
12 changed files with 112 additions and 92 deletions
20
lib/util.test.js
generated
20
lib/util.test.js
generated
|
|
@ -449,10 +449,28 @@ const mockRepositoryNwo = (0, repository_1.parseRepositoryNwo)("owner/repo");
|
|||
expected: true,
|
||||
expectedApiCall: true,
|
||||
},
|
||||
{
|
||||
name: "bypass java from input if there is kotlin in repository",
|
||||
features: [feature_flags_1.Feature.BypassToolcacheKotlinSwiftEnabled],
|
||||
hasCustomCodeQL: false,
|
||||
languagesInput: "java",
|
||||
languagesInRepository: ["kotlin", "other"],
|
||||
expected: true,
|
||||
expectedApiCall: true,
|
||||
},
|
||||
{
|
||||
name: "don't bypass java from input if there is no kotlin in repository",
|
||||
features: [feature_flags_1.Feature.BypassToolcacheKotlinSwiftEnabled],
|
||||
hasCustomCodeQL: false,
|
||||
languagesInput: "java",
|
||||
languagesInRepository: ["java", "other"],
|
||||
expected: false,
|
||||
expectedApiCall: true,
|
||||
},
|
||||
].forEach((args) => {
|
||||
(0, ava_1.default)(`shouldBypassToolcache: ${args.name}`, async (t) => {
|
||||
const mockRequest = (0, testing_utils_1.mockLanguagesInRepo)(args.languagesInRepository);
|
||||
const mockLogger = (0, testing_utils_1.getRecordingLogger)([]);
|
||||
const mockLogger = (0, logging_1.getRunnerLogger)(true);
|
||||
const featureEnablement = (0, testing_utils_1.createFeatures)(args.features);
|
||||
const codeqlUrl = args.hasCustomCodeQL ? "custom-codeql-url" : undefined;
|
||||
const actual = await util.shouldBypassToolcache(featureEnablement, codeqlUrl, args.languagesInput, mockRepositoryNwo, mockLogger);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue