jest-serializer-html-string
A slightly better Jest snapshot serializer for working with strings containing rendered html.
Example
Given:
{ return `<body> <div class="home active"> <h1><img src="" alt="Foo"/></h1><div>Hello</div> <p><span class="something">Hey</span> <img src="" /></p> </div> </body> `;} ;
Produces beautified snapshot:
Hello Hey
Setup
Install from npm:
npm install --save-dev jest-serializer-html-string
Add it to your Jest config:
"jest":
Please refer to the Jest snapshotSerializers config docs if you need more info.
License
MIT © Ruy Adorno