forked from enzymejs/enzyme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetupAdapters.js
More file actions
31 lines (28 loc) · 883 Bytes
/
setupAdapters.js
File metadata and controls
31 lines (28 loc) · 883 Bytes
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
/* eslint global-require: 0, import/no-extraneous-dependencies: 0, import/no-unresolved: 0 */
/**
* This file is needed only because we run our unit tests on multiple
* versions of React at a time. This file basically figures out which
* version of React is loaded, and configures enzyme to use the right
* corresponding adapter.
*/
const {
REACT013,
REACT014,
REACT15,
REACT155,
REACT16,
} = require('./version');
const Enzyme = require('enzyme');
let Adapter = null;
if (REACT013) {
Adapter = require('enzyme-adapter-react-13');
} else if (REACT014) {
Adapter = require('enzyme-adapter-react-14');
} else if (REACT155) {
Adapter = require('enzyme-adapter-react-15');
} else if (REACT15) {
Adapter = require('enzyme-adapter-react-15.4');
} else if (REACT16) {
Adapter = require('enzyme-adapter-react-16');
}
Enzyme.configure({ adapter: new Adapter() });