0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-03-16 09:03:59 +00:00

fix(yaml): parse without strict mode ()

This commit is contained in:
Rhys Arkins 2024-11-01 09:30:44 +01:00 committed by GitHub
parent cd192d7118
commit 6fc20b8420
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -209,6 +209,20 @@ describe('util/yaml', () => {
});
});
it('should parse invalid content using strict=false', () => {
expect(
parseSingleYaml(codeBlock`
version: '2.1'
services:
rtl_433:
image: ubuntu:oracular-20240918
# inserting a space before the hash on the next line makes Renovate work.
command: "echo some text"# a comment
`),
).not.toBeNull();
});
it('should parse content with single document with schema', () => {
expect(
parseSingleYaml(

View file

@ -158,6 +158,7 @@ function prepareParseOption(options: YamlOptions | undefined): YamlOptions {
prettyErrors: true,
// if we're removing templates, we can run into the situation where we have duplicate keys
uniqueKeys: !options?.removeTemplates,
strict: false,
...options,
};
}