diff --git a/.travis.yml b/.travis.yml index 5497a21f..8635d814 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Makefile b/Makefile index 78048f7f..62fb8987 100644 --- a/Makefile +++ b/Makefile @@ -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))" @@ -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 @@ -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 @@ -111,3 +118,6 @@ publish-docs: deps-docs build-docs cd .. publish-all: publish publish-docs + +clean: + @rm -rf .version .branch ./coverage diff --git a/karma.conf.js b/karma.conf.js index f49914cd..64738499 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,3 +1,5 @@ +const browsers = [process.env.CONTINUOUS_INTEGRATION ? 'Firefox' : 'Chrome']; + module.exports = function(config) { config.set({ @@ -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'), @@ -27,7 +29,8 @@ module.exports = function(config) { coverageReporter: { type : 'lcov', - dir : 'coverage/' + dir : 'coverage/', + subdir: '.' }, port: 9876, @@ -38,9 +41,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) }); diff --git a/package.json b/package.json index eb3faa5b..df2eac89 100644 --- a/package.json +++ b/package.json @@ -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": [ @@ -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", diff --git a/specs/Modal.spec.js b/specs/Modal.spec.js index 8e5ffd66..4309b47a 100644 --- a/specs/Modal.spec.js +++ b/specs/Modal.spec.js @@ -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); diff --git a/webpack.test.config.js b/webpack.test.config.js index 6a416857..9639e227 100644 --- a/webpack.test.config.js +++ b/webpack.test.config.js @@ -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'),