-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpretest.js
43 lines (39 loc) · 938 Bytes
/
pretest.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
'use strict';
const semver = require('semver');
const spawn = require('cross-spawn').sync;
const reactVersion = require('react/package.json').version;
// we test with multiple different versions of our react
// peerDependency, so we must install the appropriate companion
// libraries to go with the selected react version.
if (semver.satisfies(reactVersion, '^15.0.0')) {
const {status} = spawn(
'npm',
[
'install',
'react-dom@' + reactVersion,
'react-test-renderer@' + reactVersion,
],
{stdio: 'inherit'}
);
if (status) {
process.exit(1);
}
}
if (semver.satisfies(reactVersion, '0.14.x')) {
const {status} = spawn(
'npm',
[
'install',
'react-dom@' + reactVersion,
'react-addons-test-utils@' + (
reactVersion === '0.14.9'
? '0.14.8'
: reactVersion
),
],
{stdio: 'inherit'}
);
if (status) {
process.exit(1);
}
}