forked from mondaycom/vibe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.init.js
24 lines (21 loc) · 808 Bytes
/
jest.init.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import 'regenerator-runtime/runtime'
import ReactDOM from "react-dom";
ReactDOM.createPortal = node => node;
const { testing } = process.env;
const TESTING_STORYBOOK = testing === "storybook";
if (TESTING_STORYBOOK) {
jest.mock('react-transition-group', () => {
const FakeTransition = jest.fn(({children}) => children)
const FakeCSSTransition = jest.fn(props =>
props.in ? <FakeTransition>{props.children}</FakeTransition> : null,
)
return {CSSTransition: FakeCSSTransition, Transition: FakeTransition, SwitchTransition: FakeTransition}
})
}
let error = console.error;
console.error = function(warning) {
if (/(Invalid prop|Failed prop type)/.test(warning) && !warning.includes("of value `not valid`")) {
throw new Error(warning);
}
error.apply(console, arguments);
};