@nikkij/jest-jsonshot
v1.0.6
Published
Snapshot serializer that will serialize objects into JSON strings.
Downloads
16
Readme
@nikkij/jest-JSONshot
Motivation
I like to use generate mocks for my unit tests from the output of my end-to-end tests. When data snapshots are serialized in a JSON format, it is more convenient to use when creating the mocks.
Usage
using a jest setup file:
// setup.js
require("@nikkij/jest-jsonshot")
inline testing:
// test.js
require("@nikkij/jest-jsonshot")
Typescript
Add the type definition for expect().toMatchJSONshot()
// global.d.ts
import("@nikkij/jest-jsonshot");