New simple implementation for YAML serialization
Tiny in size so we don't need to fetch the 80KB yaml package for simple YAML serializaiton needs in various pages. It's also 8x faster than yaml package so that's a big plus for debug logging.
This commit is contained in:
1 parent
134ca46dde
commit
cc89fd92d7
8 files changed
+1096
-21
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import ava from "ava";
|
||||
import * as yaml from "yaml";
|
||||
import { stringify } from "../lib/common/yaml";
|
||||
|
||||
import testCases from "./yaml-tests.json";
|
||||
|
||||
ava("stringify", (t) => {
|
||||
for (const testCase of testCases) {
|
||||
let str = stringify(testCase);
|
||||
if (str.startsWith(">2")) str = ">3" + str.slice(2);
|
||||
if (str.startsWith("|2")) str = "|3" + str.slice(2);
|
||||
t.deepEqual(yaml.parse(yaml.stringify(testCase)), yaml.parse(str));
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user