forked from cerner/terra-clinical
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjestsetup.js
21 lines (18 loc) · 808 Bytes
/
jestsetup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Make Enzyme functions available in all test files without importing
// eslint-disable-next-line import/no-extraneous-dependencies
import { shallow, render, mount } from 'enzyme';
global.shallow = shallow;
global.render = render;
global.mount = mount;
// TODO: Test running jest with this removed and see if tests still work
// More info: https://github.com/cerner/terra-react-svg-loader/pull/1#discussion_r100876464
// Skip createElement warnings but fail tests on any other warning
// eslint-disable-next-line no-console
console.error = (message) => {
if (!/(React.createElement: type should not be null)/.test(message)) {
throw new Error(message);
}
};
const htmlTag = document.getElementsByTagName('html')[0];
htmlTag.setAttribute('class', 'terra-Base');
htmlTag.setAttribute('dir', 'ltr');