Skip to content

Instantly share code, notes, and snippets.

@agoiabel
Created September 26, 2018 05:47
Show Gist options
  • Save agoiabel/09006cb3aecd74e82d36e74200909a12 to your computer and use it in GitHub Desktop.
Save agoiabel/09006cb3aecd74e82d36e74200909a12 to your computer and use it in GitHub Desktop.
import React from 'react';
import Enzyme, { shallow, render, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { createSerializer } from 'enzyme-to-json';
import sinon from 'sinon';
expect.addSnapshotSerializer(createSerializer({mode: "deep"}));
//React 16 Enzyme adapter
Enzyme.configure({ adapter: new Adapter() });
//Make Enzyme functions available in all test files without importing
global.React = React;
global.shallow = shallow;
global.render = render;
global.mount = mount;
global.sinon = sinon;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment