Yaml handling for TAP parsers and generatorstap-yaml
Yaml handling for TAP parsers and generators
const yaml = require('tap-yaml') const str = yaml.stringify(someObject) const obj = yaml.parse(someString)
- Symbol types are added, so that they don't throw. Shared symbols will (within the same process) retain the same Symbol identity through encoding and decoding. Unshared symbols will not retain their object identity.
- A "safe"
!functiontype is added. Functions aren't parsed to actual functions using
eval(), since that's obviously a Bad Idea, but they do parse to an empty function with a
toString()that contains the original string source.
Errortype is added, which does its best to maintain its properties, and always shows message, stack, and name, even if these are non-enumerable. If an Error has a custom inspect method that returns an object, then that is used as the source of extra properties, so you may filter out what gets dumped to your TAP stream.
- Binary types are implicitly allowed in a standard way. In Node.js, this means that a Buffer object is created, and Buffers can be dumped to YAML without any weirdness.
setare configured to refer to Map and Set objects.
- Objects with a
nullprototype maintain their null-prototyped-ness.
Domainobjects are stringified, but without their giant object graph, since that's often a performance issue.
Dateobjects are given a non-default
!datetag rather than the default YAML 1.1
!timestamp, so that they maintain their explicit date object nature through stringifying and re-parsing.
prettyErrorsoption is always enabled.