Skip to content

Commit 315d1e1

Browse files
claydiffrientdiasbruno
authored andcommitted
Add code climate and code coverage
1 parent 1c326a1 commit 315d1e1

File tree

9 files changed

+278
-70
lines changed

9 files changed

+278
-70
lines changed

.codeclimate.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
engines:
2+
eslint:
3+
enabled: true
4+
channel: "eslint-3"
5+
duplication:
6+
enabled: true
7+
config:
8+
languages:
9+
javascript:
10+
ratings:
11+
paths:
12+
- lib/**
13+
- "**.js"
14+
exclude_paths:
15+
- "specs/"
16+
- "dist/"
17+
- "examples/"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ examples/**/*-bundle.js
44
node_modules/
55
.idea/
66
_book
7-
coverage/*
87
*.patch
98
*.diff
109
examples/__build__
10+
coverage

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ 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
1012
script:
1113
- make tests-ci

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Accessible modal dialog component for React.JS
44

55
[![Build Status](https://travis-ci.org/reactjs/react-modal.svg?branch=v1)](https://travis-ci.org/reactjs/react-modal)
6+
[![Code Climate](https://codeclimate.com/github/reactjs/react-modal/badges/gpa.svg)](https://codeclimate.com/github/reactjs/react-modal)
7+
[![Coverage Status](https://coveralls.io/repos/github/reactjs/react-modal/badge.svg?branch=master)](https://coveralls.io/github/reactjs/react-modal?branch=master)
68
![gzip size](http://img.badgesize.io/https://unpkg.com/react-modal/dist/react-modal.min.js?compression=gzip)
79

810
## Active Development

karma.conf.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@ module.exports = function(config) {
1919
stats: 'errors-only'
2020
},
2121

22-
reporters: ['mocha'],
22+
reporters: ['mocha', 'coverage'],
2323

2424
mochaReporter: {
2525
showDiff: true
2626
},
2727

28+
coverageReporter: {
29+
type : 'lcov',
30+
dir : 'coverage/'
31+
},
32+
2833
port: 9876,
2934

3035
colors: true,

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"babel-preset-es2015": "^6.6.0",
3030
"babel-preset-react": "^6.5.0",
3131
"babel-preset-stage-2": "^6.24.1",
32+
"codeclimate-test-reporter": "^0.4.0",
3233
"cross-env": "^5.0.1",
3334
"envify": "^3.4.1",
3435
"eslint": "^3.9.1",
@@ -38,9 +39,11 @@
3839
"eslint-plugin-react": "^6.6.0",
3940
"expect": "^1.20.2",
4041
"gitbook-cli": "^2.3.0",
42+
"istanbul-instrumenter-loader": "0.2.0",
4143
"karma": "^1.3.0",
4244
"karma-chrome-launcher": "2.0.0",
4345
"karma-cli": "1.0.1",
46+
"karma-coverage": "^1.1.1",
4447
"karma-firefox-launcher": "1.0.0",
4548
"karma-mocha": "^1.3.0",
4649
"karma-mocha-reporter": "^2.2.1",

specs/spec_index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ testsContext.keys().forEach((path) => {
77
console.error(err);
88
}
99
});
10+
11+
const componentsContext = require.context('../lib', true, /\.js$/);
12+
componentsContext.keys().forEach((path) => {
13+
try {
14+
componentsContext(path);
15+
} catch (err) {
16+
console.error(`[ERROR] WITH LIB FILE: ${path}`);
17+
console.error(err);
18+
}
19+
});

webpack.test.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1+
const path = require('path');
12
const commonConfig = require('./webpack.config');
23

4+
35
commonConfig.plugins = [];
46
commonConfig.entry = undefined;
57
commonConfig.debug = true;
68
commonConfig.devtool = 'inline-source-map';
79

10+
if (process.env.CONTINUOUS_INTEGRATION || process.env.COVERAGE) {
11+
commonConfig.module.postLoaders = commonConfig.module.postLoaders || []
12+
commonConfig.module.postLoaders.push({
13+
test: /\.js$/,
14+
include: path.resolve('lib'),
15+
loader: 'istanbul-instrumenter'
16+
});
17+
}
18+
819
module.exports = commonConfig;

0 commit comments

Comments
 (0)