Skip to content

Commit 41e020b

Browse files
committed
[Tests] improvements:
- `node` `v7`/`v4.6`; drop `v5` - re-enable karma builds, but allow them to fail - correct before_script settings for karma tests - install appropriate react version, per `$REACT` - Ensure tests aren’t ran twice
1 parent 5385116 commit 41e020b

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

.travis.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
language: node_js
22
node_js:
3+
- "7"
34
- "6"
4-
- "5"
55
- "4"
6-
- "4.2"
6+
- "4.6"
77
- "iojs"
88
before_script:
9-
- 'if [ "${TRAVIS_NODE_VERSION}" = 6 ]; then export DISPLAY=:99.0; fi'
10-
- 'if [ "${TRAVIS_NODE_VERSION}" = 6 ]; then sh -e /etc/init.d/xvfb start; fi'
11-
- 'if [ "${TRAVIS_NODE_VERSION}" = 6 ]; then sleep 3; fi'
9+
- 'if [ -n "${KARMA-}" ]; then export DISPLAY=:99.0; fi'
10+
- 'if [ -n "${KARMA-}" ]; then sh -e /etc/init.d/xvfb start; fi'
11+
- 'if [ -n "${KARMA-}" ]; then sleep 3; fi'
12+
- 'if [ -n "${REACT-}" ] && [ -n "${TEST-}" ]; then sh install-relevant-react.sh; fi'
1213
script:
1314
- 'if [ -n "${LINT-}" ]; then npm run lint ; fi'
1415
- 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi'
1516
- 'if [ -n "${KARMA-}" ]; then npm run tests-karma ; fi'
16-
- 'if [ -n "${REACT-}" ]; then npm run tests-only; fi'
1717
after_success:
1818
- 'if [ "${TRAVIS_NODE_VERSION}" = "4.2" ]; then npm run cover; cat ./coverage/lcov.info | ./node_modules/.bin/coveralls ; fi'
1919
env:
2020
global:
21-
- REACT=0.14
22-
matrix:
2321
- TEST=true
22+
matrix:
23+
- REACT=0.14
24+
- REACT=15
2425
sudo: false
2526
matrix:
2627
fast_finish: true
2728
include:
28-
# - node_js: "node"
29-
# env: KARMA=true
29+
- node_js: "node"
30+
env: KARMA=true
3031
- node_js: "node"
3132
env: LINT=true
3233
allow_failures:
3334
- node_js: "iojs"
35+
- env: KARMA=true

install-relevant-react.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
REACT=${REACT:-15}
4+
5+
echo "installing React $REACT"
6+
7+
if [ "$REACT" = "0.14" ]; then
8+
npm run react:14
9+
fi
10+
11+
if [ "$REACT" = "15" ]; then
12+
npm run react:15
13+
fi

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"cover:mocha": "babel-node ./node_modules/istanbul/lib/cli cover node_modules/mocha/bin/_mocha -- --compilers js:babel-register,jsx:babel-register --require airbnb-js-shims --recursive ./test/_helpers test/**/*",
1616
"lint": "eslint --ext .js,.jsx src test",
1717
"mocha": "mocha --compilers js:babel-register,jsx:babel-register --require airbnb-js-shims --recursive ./test/_helpers",
18+
"react:clean": "rimraf node_modules/react node_modules/react-dom node_modules/react-addons-test-utils",
19+
"react:14": "rimraf node_modules/.bin/npm && npm run react:clean && npm i [email protected] [email protected] [email protected]",
20+
"react:15": "rimraf node_modules/.bin/npm && npm run react:clean && npm i react@15 react-dom@15 react-addons-test-utils@15",
1821
"pretest": "npm run --silent lint",
1922
"tests-only": "npm run mocha --silent test",
2023
"tests-karma": "karma start",

0 commit comments

Comments
 (0)