How to use the snapshot-diff.getSnapshotDiffSerializer function in snapshot-diff

To help you get started, we’ve selected a few snapshot-diff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / support / jest / jest.framework.ts View on Github external
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// 

import 'jest-extended';

import toDiffableHtml from 'diffable-html';
import { prosemirrorSerializer } from 'jest-prosemirror';
import { getSnapshotDiffSerializer, toMatchDiffSnapshot } from 'snapshot-diff';

expect.addSnapshotSerializer(getSnapshotDiffSerializer());
expect.extend({ toMatchDiffSnapshot });

if (__E2E__) {
  jest.setTimeout(120000);
}

/* Make unhandledRejection errors easier to debug */
process.on('unhandledRejection', reason => {
  console.error('REJECTION', reason);
});

/**
 * Serializer for HTML content.
 */
expect.addSnapshotSerializer({
  test: object => {
github kentcdodds / jest-glamor-react / src / __tests__ / snapshot-diff.js View on Github external
import React from 'react'
import ReactDOM from 'react-dom'
import {Simulate} from 'react-dom/test-utils'
import * as glamor from 'glamor'
import {toMatchDiffSnapshot, getSnapshotDiffSerializer} from 'snapshot-diff'
import serializer, {fromHTMLString, fromDOMNode} from '../serializer'

expect.addSnapshotSerializer(getSnapshotDiffSerializer())
expect.addSnapshotSerializer(serializer)
expect.extend({toMatchDiffSnapshot})

function Button({count, ...props}) {
  const className = glamor.css({margin: 10 + count})
  return <button>
}

class Counter extends React.Component {
  state = {count: 0}
  increment = () =&gt; {
    this.setState(({count}) =&gt; ({count: count + 1}))
  }
  render() {
    const {count} = this.state
    return (</button>

snapshot-diff

Diffing Jest snapshots utility

MIT
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages