Skip to content

Commit 8221f6f

Browse files
committed
[chore] update makefile to run coverage.
1 parent 04d3171 commit 8221f6f

File tree

6 files changed

+35
-26
lines changed

6 files changed

+35
-26
lines changed

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@ node_js:
77
before_script:
88
- export DISPLAY=:99.0
99
- sh -e /etc/init.d/xvfb start
10-
after_success:
11-
- cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
1210
script:
1311
- make tests-ci

Makefile

+25-14
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,32 @@ NODE=$(shell which node)
22
NPM=$(shell which npm)
33
YARN=$(shell which yarn)
44
JQ=$(shell which jq)
5+
COVERALLS=./node_modules/coveralls/bin/coveralls.js
56

67
REMOTE="[email protected]:reactjs/react-modal"
78

89
VERSION=$(shell jq ".version" package.json)
910

11+
COVERAGE?=true
12+
1013
help: info
1114
@echo
1215
@echo "Current version: $(VERSION)"
1316
@echo
1417
@echo "List of commands:"
1518
@echo
16-
@echo " make info - display node, npm and yarn versions..."
17-
@echo " make deps - install all dependencies."
18-
@echo " make serve - start the server."
19-
@echo " make tests - run tests."
20-
@echo " make lint - run lint."
21-
@echo " make docs - build and serve the docs."
22-
@echo " make build - build project artifacts."
23-
@echo " make publish - build and publish version on npm."
24-
@echo " make publish-docs - build the docs and publish to gh-pages."
25-
@echo " make publish-all - publish version and docs."
19+
@echo " make info - display node, npm and yarn versions..."
20+
@echo " make deps - install all dependencies."
21+
@echo " make serve - start the server."
22+
@echo " make tests - run tests."
23+
@echo " make tests-single-run - run tests (used by continuous integration)."
24+
@echo " make coveralls - show coveralls."
25+
@echo " make lint - run lint."
26+
@echo " make docs - build and serve the docs."
27+
@echo " make build - build project artifacts."
28+
@echo " make publish - build and publish version on npm."
29+
@echo " make publish-docs - build the docs and publish to gh-pages."
30+
@echo " make publish-all - publish version and docs."
2631

2732
info:
2833
@echo node version: `$(NODE) --version` "($(NODE))"
@@ -46,9 +51,15 @@ serve:
4651
tests:
4752
@npm run test
4853

49-
tests-ci:
54+
tests-single-run:
5055
@npm run test -- --single-run
5156

57+
coveralls: ./coverage/lcov.info
58+
@[[ -f "$<" ]] && (cat $< | $(COVERALLS) 2> /dev/null) || echo
59+
60+
tests-ci: clean lint tests-single-run coveralls
61+
@COVERAGE=$(COVERAGE) make -C tests-single-run
62+
5263
lint:
5364
@npm run lint
5465

@@ -91,9 +102,6 @@ publish-version: release-commit release-tag
91102

92103
publish-finished: clean
93104

94-
clean:
95-
@rm -rf .version .branch
96-
97105
pre-publish: clean .branch .version deps-project tests-ci build
98106

99107
publish: pre-publish publish-version publish-finished
@@ -111,3 +119,6 @@ publish-docs: deps-docs build-docs
111119
cd ..
112120

113121
publish-all: publish publish-docs
122+
123+
clean:
124+
@rm -rf .version .branch ./coverage

karma.conf.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const browsers = [process.env.CONTINUOUS_INTEGRATION ? 'Firefox' : 'Chrome'];
2+
13
module.exports = function(config) {
24
config.set({
35

@@ -10,7 +12,7 @@ module.exports = function(config) {
1012
],
1113

1214
preprocessors: {
13-
'specs/spec_index.js': [ 'webpack', 'sourcemap' ]
15+
'specs/spec_index.js': ['webpack', 'sourcemap']
1416
},
1517

1618
webpack: require('./webpack.test.config'),
@@ -27,7 +29,8 @@ module.exports = function(config) {
2729

2830
coverageReporter: {
2931
type : 'lcov',
30-
dir : 'coverage/'
32+
dir : 'coverage/',
33+
subdir: '.'
3134
},
3235

3336
port: 9876,
@@ -38,9 +41,10 @@ module.exports = function(config) {
3841

3942
autoWatch: true,
4043

41-
browsers: [ (process.env.CONTINUOUS_INTEGRATION) ? 'Firefox' : 'Chrome' ],
44+
browsers,
4245

43-
captureTimeout: 60000,
46+
// Increase timeouts to prevent the issue with disconnected tests (https://goo.gl/nstA69)
47+
captureTimeout: 4 * 60 * 1000,
4448

4549
singleRun: (process.env.CONTINUOUS_INTEGRATION)
4650
});

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"scripts": {
1616
"start": "./node_modules/.bin/webpack-dev-server --inline --host 127.0.0.1 --content-base examples/",
1717
"test": "cross-env NODE_ENV=test karma start",
18-
"test:full": "npm-run-all -p 'test -- --single-run' lint",
1918
"lint": "eslint lib/"
2019
},
2120
"authors": [
@@ -30,6 +29,7 @@
3029
"babel-preset-react": "^6.5.0",
3130
"babel-preset-stage-2": "^6.24.1",
3231
"codeclimate-test-reporter": "^0.4.0",
32+
"coveralls": "^2.13.1",
3333
"cross-env": "^5.0.1",
3434
"envify": "^3.4.1",
3535
"eslint": "^3.9.1",

specs/Modal.spec.js

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import {
1414
renderModal, unmountModal, emptyDOM
1515
} from './helper';
1616

17-
import './Modal.events.spec';
18-
import './Modal.style.spec';
19-
2017
describe('State', () => {
2118
afterEach('check if test cleaned up rendered modals', emptyDOM);
2219

webpack.test.config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
const path = require('path');
22
const commonConfig = require('./webpack.config');
33

4-
54
commonConfig.plugins = [];
65
commonConfig.entry = undefined;
76
commonConfig.debug = true;
87
commonConfig.devtool = 'inline-source-map';
98

109
if (process.env.CONTINUOUS_INTEGRATION || process.env.COVERAGE) {
11-
commonConfig.module.postLoaders = commonConfig.module.postLoaders || []
10+
commonConfig.module.postLoaders = commonConfig.module.postLoaders || [];
1211
commonConfig.module.postLoaders.push({
1312
test: /\.js$/,
1413
include: path.resolve('lib'),

0 commit comments

Comments
 (0)