Skip to content

Commit

Permalink
feat(coverage): add coverage for codeclimate
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicoder86 committed Apr 13, 2016
1 parent 139a0e2 commit b6c9817
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist
.idea
node_modules
coverage
npm-debug.log
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
language: node_js
node_js:
- "4.4.2"
- "4.4.2"
after_success:
- 'cat coverage/lcov.info | ./node_modules/.bin/codeclimate-test-reporter'
2 changes: 1 addition & 1 deletion client/app/posts/services/post.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from 'angular2/core';
import { Http } from 'angular2/http';
import { BehaviorSubject } from 'rxjs';
import { RequestService } from '../../auth/services/request';
import { RequestService } from '../../auth';

@Injectable()
export class PostService {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"main": "server/index.js",
"scripts": {
"start": "node server/index.js",
"test": "gulp test",
"test": "COVERAGE_ENABLED=true gulp test",
"webdriver-update": "webdriver-manager update"
},
"repository": {
Expand Down Expand Up @@ -40,12 +40,14 @@
"babel-core": "6.7.4",
"babel-eslint": "6.0.2",
"babel-loader": "6.2.4",
"babel-plugin-__coverage__": "0.111111.0",
"babel-plugin-angular2-annotations": "5.0.0",
"babel-plugin-transform-class-properties": "6.6.0",
"babel-plugin-transform-decorators-legacy": "1.3.4",
"babel-plugin-transform-flow-strip-types": "6.7.0",
"babel-preset-es2015": "6.6.0",
"bootstrap": "3.3.6",
"codeclimate-test-reporter": "0.3.1",
"del": "2.2.0",
"es6-promise": "3.1.2",
"es6-shim": "0.35.0",
Expand All @@ -60,6 +62,7 @@
"gulp-watch": "4.3.5",
"jasmine-core": "2.4.1",
"karma": "0.13.22",
"karma-coverage": "0.5.5",
"karma-jasmine": "0.3.8",
"karma-phantomjs-launcher": "1.0.0",
"karma-sourcemap-loader": "0.3.7",
Expand Down
13 changes: 12 additions & 1 deletion tasks/config/karma.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
'use strict';
let path = require('path');
let coverageEnabled = process.env.COVERAGE_ENABLED === 'true';

module.exports = function(config) {
let webpackConfig = require('./webpack.test');
let reporters = ['dots'];
if (coverageEnabled) {
reporters.push('coverage');
}

config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
Expand Down Expand Up @@ -35,7 +40,13 @@ module.exports = function(config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['dots'],
reporters: reporters,

coverageReporter: {
type: 'lcov',
dir: 'coverage',
subdir: '.'
},

webpack: webpackConfig,

Expand Down
18 changes: 12 additions & 6 deletions tasks/config/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
let path = require('path');
let webpack = require('webpack');
let config = require('./index').client;
let coverageEnabled = process.env.COVERAGE_ENABLED === 'true';
let babelPlugins = [
'angular2-annotations',
'transform-decorators-legacy',
'transform-class-properties',
'transform-flow-strip-types'
];

if (coverageEnabled) {
babelPlugins.push('__coverage__');
}

module.exports = {
entry: {
Expand All @@ -20,12 +31,7 @@ module.exports = {
exclude: /(node_modules)/,
query: {
presets: ['es2015'],
plugins: [
'angular2-annotations',
'transform-decorators-legacy',
'transform-class-properties',
'transform-flow-strip-types'
]
plugins: babelPlugins
}
},
{
Expand Down

0 comments on commit b6c9817

Please sign in to comment.