Mithril serializer plugin for pretty-format
const m = require('mithril');
test('node with content', () => {
const vnode = m('div', 'Hello');
expect(vnode).toMatchInlineSnapshot(`
<div>
Hello
</div>
`);
});
Check our own test cases for more examples.
Add this plugin to your devDependencies with:
npm install --save-dev mithril-serializer
Add the following config to your jest.config.js
file:
snapshotSerializers: ['mithril-serializer']
Now Jest is able to pretty print Mithril's vnodes in your snapshots.