Hey @glennsl
I was trying to add the "binding" to expect.addSnapshotSerializer() in bs-jest and I found creating too much crap for this particular case.
How it works it's simple, while expect.extend adds prototype methods to the matches, expect.addSnapshotSerializer adds transformations to the snapshots and both methods are called once on top of the file (or in any setup.js file)
That's a valid serializer:
const serializer = {
test: () => true
print: (value) => JSON.stringify(value)
}
expect.addSnapshotSerializer(serializer);
So, a serializer it's a
type serializer = <
test :value -> bool;
print :value -> serialize -> indent -> string
> Js.t
But I end up adding addSnapshotSerializer to the prototype with the affirm. Would you mind some advice on how to add it without too much hassle?
Thanks!
Hey @glennsl
I was trying to add the "binding" to
expect.addSnapshotSerializer()in bs-jest and I found creating too much crap for this particular case.How it works it's simple, while expect.extend adds prototype methods to the matches, expect.addSnapshotSerializer adds transformations to the snapshots and both methods are called once on top of the file (or in any setup.js file)
That's a valid serializer:
So, a serializer it's a
But I end up adding addSnapshotSerializer to the prototype with the affirm. Would you mind some advice on how to add it without too much hassle?
Thanks!