Skip to content

Commit

Permalink
[chore] update makefile to run coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
diasbruno committed Jun 15, 2017
1 parent ba2c124 commit 0374b6b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 26 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ node_js:
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
after_success:
- cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
script:
- make tests-ci
39 changes: 25 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,32 @@ NODE=$(shell which node)
NPM=$(shell which npm)
YARN=$(shell which yarn)
JQ=$(shell which jq)
COVERALLS=./node_modules/coveralls/bin/coveralls.js

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

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

COVERAGE?=true

help: info
@echo
@echo "Current version: $(VERSION)"
@echo
@echo "List of commands:"
@echo
@echo " make info - display node, npm and yarn versions..."
@echo " make deps - install all dependencies."
@echo " make serve - start the server."
@echo " make tests - run tests."
@echo " make lint - run lint."
@echo " make docs - build and serve the docs."
@echo " make build - build project artifacts."
@echo " make publish - build and publish version on npm."
@echo " make publish-docs - build the docs and publish to gh-pages."
@echo " make publish-all - publish version and docs."
@echo " make info - display node, npm and yarn versions..."
@echo " make deps - install all dependencies."
@echo " make serve - start the server."
@echo " make tests - run tests."
@echo " make tests-single-run - run tests (used by continuous integration)."
@echo " make coveralls - show coveralls."
@echo " make lint - run lint."
@echo " make docs - build and serve the docs."
@echo " make build - build project artifacts."
@echo " make publish - build and publish version on npm."
@echo " make publish-docs - build the docs and publish to gh-pages."
@echo " make publish-all - publish version and docs."

info:
@echo node version: `$(NODE) --version` "($(NODE))"
Expand All @@ -46,9 +51,15 @@ serve:
tests:
@npm run test

tests-ci:
tests-single-run:
@npm run test -- --single-run

coveralls:
-cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js 2>/dev/null

tests-ci: clean lint
@COVERAGE=$(COVERAGE) make tests-single-run coveralls

lint:
@npm run lint

Expand Down Expand Up @@ -91,9 +102,6 @@ publish-version: release-commit release-tag

publish-finished: clean

clean:
@rm -rf .version .branch

pre-publish: clean .branch .version deps-project tests-ci build

publish: pre-publish publish-version publish-finished
Expand All @@ -111,3 +119,6 @@ publish-docs: deps-docs build-docs
cd ..

publish-all: publish publish-docs

clean:
@rm -rf .version .branch ./coverage/*
12 changes: 8 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const browsers = [process.env.CONTINUOUS_INTEGRATION ? 'Firefox' : 'Chrome'];

module.exports = function(config) {
config.set({

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

preprocessors: {
'specs/spec_index.js': [ 'webpack', 'sourcemap' ]
'specs/spec_index.js': ['webpack', 'sourcemap']
},

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

coverageReporter: {
type : 'lcov',
dir : 'coverage/'
dir : 'coverage/',
subdir: '.'
},

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

autoWatch: true,

browsers: [ (process.env.CONTINUOUS_INTEGRATION) ? 'Firefox' : 'Chrome' ],
browsers,

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

singleRun: (process.env.CONTINUOUS_INTEGRATION)
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"scripts": {
"start": "./node_modules/.bin/webpack-dev-server --inline --host 127.0.0.1 --content-base examples/",
"test": "cross-env NODE_ENV=test karma start",
"test:full": "npm-run-all -p 'test -- --single-run' lint",
"lint": "eslint lib/"
},
"authors": [
Expand All @@ -30,6 +29,7 @@
"babel-preset-react": "^6.5.0",
"babel-preset-stage-2": "^6.24.1",
"codeclimate-test-reporter": "^0.4.0",
"coveralls": "^2.13.1",
"cross-env": "^5.0.1",
"envify": "^3.4.1",
"eslint": "^3.9.1",
Expand Down
3 changes: 0 additions & 3 deletions specs/Modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ import {
renderModal, unmountModal, emptyDOM
} from './helper';

import './Modal.events.spec';
import './Modal.style.spec';

describe('State', () => {
afterEach('check if test cleaned up rendered modals', emptyDOM);

Expand Down
3 changes: 1 addition & 2 deletions webpack.test.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
const path = require('path');
const commonConfig = require('./webpack.config');


commonConfig.plugins = [];
commonConfig.entry = undefined;
commonConfig.debug = true;
commonConfig.devtool = 'inline-source-map';

if (process.env.CONTINUOUS_INTEGRATION || process.env.COVERAGE) {
commonConfig.module.postLoaders = commonConfig.module.postLoaders || []
commonConfig.module.postLoaders = commonConfig.module.postLoaders || [];
commonConfig.module.postLoaders.push({
test: /\.js$/,
include: path.resolve('lib'),
Expand Down

0 comments on commit 0374b6b

Please sign in to comment.