Skip to content

Commit 6fc20b8

Browse files
authored
fix(yaml): parse without strict mode (#32264)
1 parent cd192d7 commit 6fc20b8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/util/yaml.spec.ts

+14
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,20 @@ describe('util/yaml', () => {
209209
});
210210
});
211211

212+
it('should parse invalid content using strict=false', () => {
213+
expect(
214+
parseSingleYaml(codeBlock`
215+
version: '2.1'
216+
217+
services:
218+
rtl_433:
219+
image: ubuntu:oracular-20240918
220+
# inserting a space before the hash on the next line makes Renovate work.
221+
command: "echo some text"# a comment
222+
`),
223+
).not.toBeNull();
224+
});
225+
212226
it('should parse content with single document with schema', () => {
213227
expect(
214228
parseSingleYaml(

lib/util/yaml.ts

+1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ function prepareParseOption(options: YamlOptions | undefined): YamlOptions {
158158
prettyErrors: true,
159159
// if we're removing templates, we can run into the situation where we have duplicate keys
160160
uniqueKeys: !options?.removeTemplates,
161+
strict: false,
161162
...options,
162163
};
163164
}

0 commit comments

Comments
 (0)