tinyaml
Correctness
Every library scored on the yaml-test-suite against its expected answers.
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.
js-yaml 4: 34 cases wrong
Section titled "js-yaml 4: 34 cases wrong"- Valid YAML read to the wrong value (5): 82AN, 8G76, 98YD, HWV9, QT73
- Valid YAML rejected (15): 4MUZ/00, 4MUZ/01, 4MUZ/02, 5MUD, 9KAX, 9SA2, DK3J, FP8R, K3WX, M7A3, NJ66, UT92, VJP3/01, W4TN, WZ62
- Invalid YAML accepted (14): 3HFZ, 4JVG, 9C9N, 9JBA, 9KBC, CVW2, CXX2, DK95/01, H7J7, QB6E, S98Z, SU5Z, Y79Y/000, Y79Y/003
yaml: 5 cases wrong
Section titled "yaml: 5 cases wrong"yamljs: 204 cases wrong
Section titled "yamljs: 204 cases wrong"- Valid YAML read to the wrong value (51): 26DV, 27NA, 2G84/02, 2G84/03, 2SXE, 36F6, 3ALJ, 4ZYM, 52DL, 565N, 58MP, 5T43, 6BCT, 6CA3, 6JWB, 735Y, 7BMT, 7FWL, 7ZZ5, 82AN, 8MK2, 9SA2, AB8U, DC7X, DK95/02, DK95/08, EXG3, F2C7, FBC9, G4RS, JEF9/02, K54U, K858, L24T/00, L24T/01, L9U5, LE5A, MUS6/02, MUS6/03, MUS6/05, MUS6/06, NAT4, R4YG, S4JQ, UV7Q, W42U, WZ62, XLQ9, Y79Y/001, Z67P, ZH7C
- Valid YAML rejected (108): 2LFX, 2XXW, 3MYT, 3R3P, 3RLN/00, 3RLN/01, 3RLN/02, 3RLN/03, 3RLN/04, 3RLN/05, 4CQQ, 4Q9F, 57H4, 5GBF, 5MUD, 5WE3, 652Z, 6CK3, 6FWR, 6HB6, 6JQW, 6LVF, 6VJK, 6WPF, 753E, 7A4E, 7T8X, 7TMG, 7W2P, 87E4, 8KB6, 8UDB, 93WF, 96L6, 9BXH, 9MQT/00, 9TFX, 9YRD, A2M4, A984, B3HG, BEC7, BU8L, C2DT, C4HZ, CC74, CN3R, CT4Q, CUP7, DE56/00, DE56/01, DE56/02, DE56/03, DE56/04, DE56/05, DK3J, DK95/03, DK95/04, DWX9, E76Z, EHF6, EX5H, FP8R, G992, GH63, HMQ5, HS5T, JTV5, K3WX, K527, L94M, LP6E, LQZ7, M29M, M5C3, M7NX, M9B4, MJS9, MYW6, NB6Z, NJ66, NP9H, P76L, P94K, PRH3, Q8AD, QF4Y, RR7F, RTP8, S4T7, S9E8, SKE5, T26H, T4YY, T5N4, TL85, TS54, U3C3, U3XV, UGM3, VJP3/01, X8DW, XV9V, Y79Y/002, Z9M4, ZF4X, ZK9H, ZWK4
- Invalid YAML accepted (45): 2G84/00, 2G84/01, 4JVG, 55WF, 5LLU, 5U3A, 8XDJ, 9C9N, 9JBA, 9KBC, 9MAG, 9MMA, B63P, BF9H, CTN5, CXX2, DK95/01, EW3V, G5U8, H7TQ, HRE5, LHL4, MUS6/00, MUS6/01, QB6E, QLJ7, RHX7, S4GJ, S98Z, SF5V, SR86, SU5Z, SU74, SY6V, U99R, W9L4, X4QW, Y79Y/004, Y79Y/005, Y79Y/006, Y79Y/008, Y79Y/009, YJV2, ZCZ6, ZVH3
@std/yaml: 71 cases wrong
Section titled "@std/yaml: 71 cases wrong"- Valid YAML read to the wrong value (23): 6KGN, 6WPF, 7A4E, 82AN, 8G76, 98YD, 9TFX, DE56/01, DE56/03, DE56/04, DE56/05, DK3J, FP8R, HWV9, M7A3, NAT4, NP9H, PRH3, Q8AD, QT73, T4YY, TL85, W4TN
- Valid YAML rejected (24): 26DV, 2AUY, 2SXE, 33X3, 4MUZ/00, 4MUZ/01, 4MUZ/02, 5MUD, 74H7, 7BMT, 7FWL, 9KAX, 9SA2, E76Z, F2C7, HMQ5, K3WX, L94M, NJ66, U3XV, UT92, VJP3/01, WZ62, ZH7C
- Invalid YAML accepted (24): 3HFZ, 4EJS, 62EZ, 9C9N, 9JBA, 9KBC, 9MAG, CTN5, CVW2, DK95/01, DK95/06, H7J7, JY7Z, QB6E, S98Z, SU5Z, Y79Y/000, Y79Y/003, Y79Y/004, Y79Y/005, Y79Y/006, Y79Y/007, Y79Y/008, Y79Y/009