diff --git a/lib/modules/manager/docker-compose/extract.spec.ts b/lib/modules/manager/docker-compose/extract.spec.ts index b9436050d88ae1..a089c8b465a612 100644 --- a/lib/modules/manager/docker-compose/extract.spec.ts +++ b/lib/modules/manager/docker-compose/extract.spec.ts @@ -56,6 +56,33 @@ describe('modules/manager/docker-compose/extract', () => { expect(res?.deps).toHaveLength(1); }); + it('extracts can parse yaml tags for version 3', () => { + const compose = codeBlock` + web: + image: node:20.0.0 + ports: + - "80:8000" + worker: + extends: + service: web + ports: !reset null + `; + const res = extractPackageFile(compose, '', {}); + expect(res).toEqual({ + deps: [ + { + depName: 'node', + currentValue: '20.0.0', + currentDigest: undefined, + replaceString: 'node:20.0.0', + autoReplaceStringTemplate: + '{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}', + datasource: 'docker', + }, + ], + }); + }); + it('extracts image and replaces registry', () => { const compose = codeBlock` version: "3" diff --git a/lib/util/yaml.spec.ts b/lib/util/yaml.spec.ts index de9491f458054a..74f37c3e89f560 100644 --- a/lib/util/yaml.spec.ts +++ b/lib/util/yaml.spec.ts @@ -281,5 +281,23 @@ describe('util/yaml', () => { }, }); }); + + it('should parse content with yaml tags', () => { + expect( + parseSingleYaml( + codeBlock` + myObject: + aString: value + aStringWithTag: !reset null + `, + { removeTemplates: true }, + ), + ).toEqual({ + myObject: { + aString: 'value', + aStringWithTag: 'null', + }, + }); + }); }); });