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 committed Jan 1, 2017
1 parent 596f423 commit a09ff8d
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 26 deletions.
11 changes: 11 additions & 0 deletions .codeclimate.yml
@@ -0,0 +1,11 @@
engines:
eslint:
enabled: true
channel: "eslint-3"
duplication:
enabled: true
ratings:
paths:
- lib/**
- specs/**
- "**.js"
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@ examples/**/*-bundle.js
node_modules/
.idea/
_book
coverage
7 changes: 6 additions & 1 deletion karma.conf.js
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
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -37,6 +37,7 @@
"babel-preset-latest": "^6.16.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-2": "^6.18.0",
"codeclimate-test-reporter": "^0.4.0",
"envify": "^3.4.1",
"eslint": "^3.9.1",
"eslint-config-airbnb": "latest",
Expand All @@ -45,9 +46,11 @@
"eslint-plugin-react": "^6.6.0",
"expect": "1.10.0",
"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 Expand Up @@ -85,4 +88,4 @@
"modal",
"dialog"
]
}
}
10 changes: 10 additions & 0 deletions specs/spec_index.js
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
@@ -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;

0 comments on commit a09ff8d

Please sign in to comment.