Skip to content

Commit

Permalink
Add code climate and code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
claydiffrient authored and diasbruno committed Jun 15, 2017
1 parent 1c326a1 commit 315d1e1
Show file tree
Hide file tree
Showing 9 changed files with 278 additions and 70 deletions.
17 changes: 17 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
engines:
eslint:
enabled: true
channel: "eslint-3"
duplication:
enabled: true
config:
languages:
javascript:
ratings:
paths:
- lib/**
- "**.js"
exclude_paths:
- "specs/"
- "dist/"
- "examples/"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ examples/**/*-bundle.js
node_modules/
.idea/
_book
coverage/*
*.patch
*.diff
examples/__build__
coverage
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Accessible modal dialog component for React.JS

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

## Active Development
Expand Down
7 changes: 6 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ module.exports = function(config) {
stats: 'errors-only'
},

reporters: ['mocha'],
reporters: ['mocha', 'coverage'],

mochaReporter: {
showDiff: true
},

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

port: 9876,

colors: true,
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-2": "^6.24.1",
"codeclimate-test-reporter": "^0.4.0",
"cross-env": "^5.0.1",
"envify": "^3.4.1",
"eslint": "^3.9.1",
Expand All @@ -38,9 +39,11 @@
"eslint-plugin-react": "^6.6.0",
"expect": "^1.20.2",
"gitbook-cli": "^2.3.0",
"istanbul-instrumenter-loader": "0.2.0",
"karma": "^1.3.0",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "1.0.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.1",
Expand Down
10 changes: 10 additions & 0 deletions specs/spec_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ testsContext.keys().forEach((path) => {
console.error(err);
}
});

const componentsContext = require.context('../lib', true, /\.js$/);
componentsContext.keys().forEach((path) => {
try {
componentsContext(path);
} catch (err) {
console.error(`[ERROR] WITH LIB FILE: ${path}`);
console.error(err);
}
});
11 changes: 11 additions & 0 deletions webpack.test.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
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.push({
test: /\.js$/,
include: path.resolve('lib'),
loader: 'istanbul-instrumenter'
});
}

module.exports = commonConfig;
Loading

0 comments on commit 315d1e1

Please sign in to comment.