Skip to content

Commit 805aeee

Browse files
committed
Merge pull request #2356 from rackt/coverage
Add Code Coverage
2 parents 80f44fd + 9c7403b commit 805aeee

File tree

5 files changed

+31
-13
lines changed

5 files changed

+31
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules
55
npm-debug.log
66
website/index.html
77
website/tags/*
8+
coverage

.travis.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
language: node_js
22
node_js:
3-
- "4"
3+
- "4"
44
sudo: false
55
before_script:
6-
- wget http://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip
7-
- unzip BrowserStackLocal-linux-x64.zip
8-
- "./BrowserStackLocal $BROWSER_STACK_ACCESS_KEY localhost,8001,0 > /dev/null &"
9-
- sleep 10
6+
- wget http://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip
7+
- unzip BrowserStackLocal-linux-x64.zip
8+
- "./BrowserStackLocal $BROWSER_STACK_ACCESS_KEY localhost,8001,0 > /dev/null &"
9+
- sleep 10
10+
after_success:
11+
- cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
12+
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
1013
branches:
1114
except:
1215
- latest

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
[![build status](https://img.shields.io/travis/rackt/react-router/master.svg?style=flat-square)](https://travis-ci.org/rackt/react-router)
1+
<img src="https://rackt.github.io/react-router/img/vertical.png" width="300">
2+
23
[![npm package](https://img.shields.io/npm/v/react-router.svg?style=flat-square)](https://www.npmjs.org/package/react-router)
4+
[![build status](https://img.shields.io/travis/rackt/react-router/master.svg?style=flat-square)](https://travis-ci.org/rackt/react-router)
5+
[![Coverage Status](https://img.shields.io/coveralls/rackt/react-router.svg?style=flat-square)](https://coveralls.io/github/rackt/react-router)
36
[![#rackt on freenode](https://img.shields.io/badge/irc-rackt_on_freenode-61DAFB.svg?style=flat-square)](https://webchat.freenode.net/)
47

5-
<img src="https://rackt.github.io/react-router/img/vertical.png" width="300"/>
6-
78
A complete routing library for React
89

910
React Router keeps your UI in sync with the URL. It has a simple API

karma.conf.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var webpack = require('webpack')
2+
var path = require('path')
23

34
module.exports = function (config) {
45
// Browsers to run on BrowserStack
@@ -59,7 +60,7 @@ module.exports = function (config) {
5960

6061
browsers: [ 'Chrome' ],
6162
frameworks: [ 'mocha' ],
62-
reporters: [ 'mocha' ],
63+
reporters: [ 'mocha', 'coverage' ],
6364

6465
files: [
6566
'tests.webpack.js'
@@ -73,7 +74,8 @@ module.exports = function (config) {
7374
devtool: 'inline-source-map',
7475
module: {
7576
loaders: [
76-
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' }
77+
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' },
78+
{ test: /\.js$/, exclude: /__tests__/, include: path.resolve('modules/'), loader: 'isparta' }
7779
]
7880
},
7981
plugins: [
@@ -85,12 +87,19 @@ module.exports = function (config) {
8587

8688
webpackServer: {
8789
noInfo: true
90+
},
91+
92+
coverageReporter: {
93+
reporters: [
94+
{ type: 'html', subdir: 'html' },
95+
{ type: 'lcovonly', subdir: '.' }
96+
]
8897
}
8998
})
9099

91100
if (process.env.USE_CLOUD) {
92101
config.browsers = Object.keys(customLaunchers)
93-
config.reporters = [ 'dots' ]
102+
config.reporters = [ 'dots', 'coverage' ]
94103
config.browserDisconnectTimeout = 10000
95104
config.browserDisconnectTolerance = 3
96105
config.browserNoActivityTimeout = 30000

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
"babel-eslint": "^3.1.23",
3737
"babel-loader": "^5.0.0",
3838
"bundle-loader": "^0.5.2",
39+
"codecov.io": "^0.1.6",
40+
"coveralls": "^2.11.4",
3941
"css-loader": "^0.19.0",
4042
"eslint": "1.4.0",
4143
"eslint-plugin-react": "3.3.2",
@@ -44,9 +46,11 @@
4446
"express-urlrewrite": "^1.2.0",
4547
"gzip-size": "^3.0.0",
4648
"history": "^1.12.5",
47-
"karma": "^0.13.8",
49+
"isparta-loader": "^1.0.0",
50+
"karma": "^0.13.13",
4851
"karma-browserstack-launcher": "^0.1.4",
4952
"karma-chrome-launcher": "^0.2.0",
53+
"karma-coverage": "^0.5.3",
5054
"karma-firefox-launcher": "^0.1.6",
5155
"karma-mocha": "^0.2.0",
5256
"karma-mocha-reporter": "^1.1.1",
@@ -56,8 +60,8 @@
5660
"pretty-bytes": "^2.0.1",
5761
"qs": "^4.0.0",
5862
"react": "0.14.0",
59-
"react-addons-test-utils": "0.14.0",
6063
"react-addons-css-transition-group": "^0.14.0",
64+
"react-addons-test-utils": "0.14.0",
6165
"react-dom": "0.14.0",
6266
"rf-changelog": "^0.4.0",
6367
"style-loader": "^0.12.4",

0 commit comments

Comments
 (0)