-
Notifications
You must be signed in to change notification settings - Fork 4
/
jest.setup.js
56 lines (50 loc) · 1.23 KB
/
jest.setup.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import '@testing-library/jest-dom';
if (process.env.RSUITE_VERSION === '5') {
jest.mock(
'date-fns/_lib/toInteger/index.js',
() => {
return jest.requireActual('date-fns2/_lib/toInteger/index.js');
},
{ virtual: true }
);
jest.mock(
'date-fns/_lib/cloneObject',
() => {
return jest.requireActual('date-fns2/_lib/cloneObject');
},
{ virtual: true }
);
jest.mock('rsuite', () => {
return jest.requireActual('rsuite5');
});
} else {
jest.mock('rsuite', () => {
return jest.requireActual('rsuite4');
});
}
switch (process.env.REACT_VERSION) {
case '16':
jest.mock('react', () => {
return jest.requireActual('react16');
});
jest.mock('react-dom', () => {
return jest.requireActual('react-dom16');
});
jest.mock('react-dom/test-utils', () => {
return jest.requireActual('react-dom16/test-utils');
});
break;
case '17':
jest.mock('react', () => {
return jest.requireActual('react17');
});
jest.mock('react-dom', () => {
return jest.requireActual('react-dom17');
});
jest.mock('react-dom/test-utils', () => {
return jest.requireActual('react-dom17/test-utils');
});
break;
default:
break;
}