Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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 => {
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 = () => {
this.setState(({count}) => ({count: count + 1}))
}
render() {
const {count} = this.state
return (</button>