Skip to content
Snippets Groups Projects
Unverified Commit 7272dd2d authored by Shingo Sato's avatar Shingo Sato Committed by GitHub
Browse files

fix(manager/circleci): optional jobs parameter (#30251)

parent 8a5e291b
No related branches found
Tags 37.434.1
No related merge requests found
version: 2.1
orbs:
nodejs: circleci/node@5.2.0
workflows:
Test:
jobs:
- nodejs/test
......@@ -4,6 +4,7 @@ import { extractPackageFile } from '.';
const file1 = Fixtures.get('config.yml');
const file2 = Fixtures.get('config2.yml');
const file3 = Fixtures.get('config3.yml');
const file4 = Fixtures.get('config4.yml');
describe('modules/manager/circleci/extract', () => {
describe('extractPackageFile()', () => {
......@@ -65,5 +66,17 @@ describe('modules/manager/circleci/extract', () => {
),
).toBeNull();
});
it('extracts orbs without jobs', () => {
const res = extractPackageFile(file4);
expect(res?.deps).toMatchObject([
{
depName: 'nodejs',
currentValue: '5.2.0',
datasource: 'orb',
depType: 'orb',
},
]);
});
});
});
......@@ -30,7 +30,7 @@ export function extractPackageFile(
});
}
for (const job of Object.values(parsed.jobs)) {
for (const job of Object.values(parsed.jobs ?? {})) {
for (const dockerElement of coerceArray(job.docker)) {
deps.push({
...getDep(dockerElement.image),
......
......@@ -10,6 +10,6 @@ export const CircleCiJob = z.object({
export const CircleCiFile = z.object({
aliases: z.array(CircleCiDocker).optional(),
jobs: z.record(z.string(), CircleCiJob),
jobs: z.record(z.string(), CircleCiJob).optional(),
orbs: z.record(z.string()).optional(),
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment