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 04d3171 commit bf18a96
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 24 deletions.
38 changes: 24 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@ REMOTE="git@github.com: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 +50,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

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

lint:
@npm run lint

Expand Down Expand Up @@ -91,9 +101,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 +118,6 @@ publish-docs: deps-docs build-docs
cd ..

publish-all: publish publish-docs

clean:
@rm -rf .version .branch ./coverage
14 changes: 10 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 @@ -6,11 +8,11 @@ module.exports = function(config) {
frameworks: ['mocha'],

files: [
'specs/spec_index.js'
'specs/spec_index.js'
],

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

webpack: require('./webpack.test.config'),
Expand Down Expand Up @@ -38,9 +40,13 @@ 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,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 1,
browserNoActivityTimeout: 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 bf18a96

Please sign in to comment.