This uses a custom snapshot serializer to reduce escaping in snapshot files and make them easier to read. Snapshot serializers are documented here: https://facebook.github.io/jest/docs/configuration.html#snapshotserializers-array-string
15 lines
237 B
JavaScript
15 lines
237 B
JavaScript
const RAW = Symbol.for("raw");
|
|
|
|
module.exports = {
|
|
print(val) {
|
|
return val[RAW];
|
|
},
|
|
test(val) {
|
|
return (
|
|
val &&
|
|
Object.prototype.hasOwnProperty.call(val, RAW) &&
|
|
typeof val[RAW] === "string"
|
|
);
|
|
}
|
|
};
|