Esc

tinyaml

Correctness

Every library scored on the yaml-test-suite against its expected answers.

yaml-test-suite cases right, %

scripts/correctness.ts runs every library on the yaml-test-suite and scores it against the suite's own answers. A valid case has to load to the JSON in its in.json, and an invalid case has to throw. The 29 cases without expected JSON are left out. Each library uses its YAML 1.2 core schema where it has one. yaml runs with schema: "core" and resolveKnownTags: false, and tinyaml with merge: false. yamljs has one fixed schema, and @std/yaml's core still reads some YAML 1.1 forms. A valid case a library refuses only because it has no type for a custom tag like !foo is counted in its own column, since that's a choice and not a misreading. The first column and the chart leave those cases out.

yamljs reads one document, so it's scored on the 256 valid cases with exactly one. Of the 18 valid streams with several documents, it reads the first document right in 3 and throws on 11. On the 5 empty streams it returns null for 3.

Library Valid YAML read right Refused for an unknown tag Invalid YAML rejected
tinyaml 279 of 279 0 94 of 94
js-yaml 4.3.2 244 of 264 15 80 of 94
js-yaml 5.5.0 263 of 263 16 94 of 94
yaml 2.9.1 276 of 279 0 92 of 94
yamljs 0.3.0 97 of 256 0 49 of 94
@std/yaml 1.3.0 217 of 264 15 70 of 94

tinyaml's root gets every case right, including the 5 that yaml gets wrong and the 34 that js-yaml 4 gets wrong. js-yaml 5 is the only other library with no wrong answers, and it refuses 16 valid cases for their tags. Each list below links the cases a library gets wrong.