Skip to content

DiogoDoreto/mithril-serializer

Repository files navigation

mithril-serializer

Build Status

Mithril serializer plugin for pretty-format

Examples

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.

How to use

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.