jest-serializer-simple v5.0.0-0.1
jest-serializer-simple
A Jest serializer to simplify your snapshots.
Sometimes you just want to print an object or a string without all the escapes
and Object [null prototype] {
annotations. When you want that, this is a
simple solution for it.
Crowd-funded open-source software
To help us develop this software sustainably under the MIT license, we ask all individuals and businesses that use it to help support its ongoing maintenance and development via sponsorship.
Click here to find out more about sponsors and sponsorship.
And please give some love to our featured sponsors 🤩:
* Sponsors the entire Graphile suite
Usage:
yarn add jest-serializer-simple
Then add it to your Jest config:
module.exports = {
testEnvironment: "node",
snapshotSerializers: [`jest-serializer-simple`],
//...
};
To tell Jest that you want the object to be printed simply, you must wrap it in
an object with just the __
key: { __: YOUR_VALUE_HERE }
, for example:
expect({ __: data }).toMatchInlineSnapshot(`
{
forums: [
{
name: 'Cats',
},
{
name: 'Dogs',
},
{
name: 'Postgres',
},
],
}
`);
8 months ago
8 months ago
9 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago