mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-17 05:02:23 +08:00
27 lines
755 B
JavaScript
27 lines
755 B
JavaScript
import 'jest-enzyme/lib/index';
|
|
|
|
// setup file
|
|
import { configure } from 'enzyme';
|
|
import Adapter from 'enzyme-adapter-react-16';
|
|
|
|
import * as emotion from 'emotion';
|
|
import { createSerializer } from 'jest-emotion';
|
|
|
|
expect.addSnapshotSerializer(createSerializer(emotion));
|
|
// mock console.info calls for cleaner test execution
|
|
global.console.info = jest.fn().mockImplementation(() => {});
|
|
|
|
configure({ adapter: new Adapter() });
|
|
|
|
/* Fail tests on PropType warnings
|
|
This allows us to throw an error in tests environments when there are prop-type warnings. This should keep the tests
|
|
free of warnings going forward.
|
|
*/
|
|
|
|
const throwError = message => {
|
|
throw new Error(message);
|
|
};
|
|
|
|
global.console.error = throwError;
|
|
global.console.warn = throwError;
|