Describe the bug
When parsing a document like this:
The errors array on the parsed document is empty, and toJS will throw ReferenceError: Unresolved alias
To Reproduce
> const yaml = await import("yaml")
undefined
> const docs = yaml.parseAllDocuments("foo: *bar")
undefined
> docs.length
1
> docs[0].errors
[]
> docs[0].toJS()
Uncaught ReferenceError: Unresolved alias (the anchor must be set before the alias): bar
at Alias.toJSON (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/Alias.js:42:19)
at Object.toJS (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/toJS.js:22:26)
at Object.addPairToJSMap (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/addPairToJSMap.js:32:34)
at YAMLMap.toJSON (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/YAMLMap.js:124:28)
at Object.toJS (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/nodes/toJS.js:22:26)
at Document.toJS (/Users/steffen/work/github/garden/core/node_modules/yaml/dist/doc/Document.js:301:26)
>
Expected behaviour
I expect an error on the document after calling yaml.parseAllDocuments.
> docs[0].errors.length
1
Versions (please complete the following information):
- Environment: Node.js v18.15.0
yaml: 2.3.2
Describe the bug
When parsing a document like this:
The
errorsarray on the parsed document is empty, andtoJSwill throwReferenceError: Unresolved aliasTo Reproduce
Expected behaviour
I expect an error on the document after calling
yaml.parseAllDocuments.Versions (please complete the following information):
yaml: 2.3.2