forked from mondaycom/vibe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.init.js
26 lines (23 loc) · 863 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
25
26
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 };
});
}
const error = console.error;
console.error = function(warning) {
if (
/(Invalid prop|Failed prop type)/.test(warning) &&
!warning.includes("of value `not valid`") &&
!warning.includes("`ForwardRef`.")
) {
throw new Error(warning);
}
error.apply(console, arguments);
};