Skip to content

Commit

Permalink
Merge pull request #1702 from 18F/add-coverage
Browse files Browse the repository at this point in the history
Add code coverage report
  • Loading branch information
Julia Elman committed Feb 8, 2017
2 parents 3a5258b + dbf3299 commit f671bb6
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 8 deletions.
31 changes: 31 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
engines:
csslint:
enabled: false

eslint:
enabled: false

duplication:
enabled: true
config:
languages:
- javascript

nodesecurity:
enabled: false

golint:
enabled: false

rubocop:
enabled: false

ratings:
paths:
- src/js/**/*.js

exclude_paths:
- config/**/*.js
- dist/**/*.js
- spec/**/*
- src/js/vendor/**/*.js
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
node_modules/
npm-debug.log*

# code coverage
coverage/

# README: Ignore the dist directories
#
dist/
Expand Down
13 changes: 10 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ machine:
test:
pre:
- gulp -v
- npm install -g codeclimate-test-reporter
override:
- npm test # Run the package and docs test suite
# Run the package and docs test suite
- npm test
# Generate code coverage report
- npm run cover
# Build the release files
- npm run build
post:
- ls -agolf dist/ # Ensure that build:package worked
# Ensure that build:package worked
- ls -agolf dist/
- codeclimate-test-reporter < coverage/lcov.info

deployment:
npm:
Expand All @@ -18,4 +25,4 @@ deployment:
commands:
- npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
- npm run build:package # Build distributed package files
- npm run check-publish
- npm run check-publish
16 changes: 11 additions & 5 deletions config/gulp/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ var gulp = require('gulp');
var mocha = require('gulp-mocha');
var runSequence = require('run-sequence');

var mochaOpts = {
require: [
'jsdom-global/register'
]
};

gulp.task('test', function () {
return gulp.src('spec/**/*.spec.js')
.pipe(mocha({
require: [
'jsdom-global/register'
]
}));
.pipe(mocha(mochaOpts));
});

gulp.task('cover', function () {
return gulp.src('spec/unit/**/*.spec.js')
.pipe(mocha(mochaOpts));
});

gulp.task('test:watch', function () {
gulp.watch([
Expand Down
3 changes: 3 additions & 0 deletions config/istanbul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instrumentation:
root: src/js
excludes: []
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build:package": "gulp copy-vendor-sass && gulp release",
"build": "gulp build",
"test": "gulp eslint test",
"cover": "istanbul cover --config config/istanbul.yml gulp cover",
"preversion": "npm test",
"version": "npm run prepublish",
"watch": "watch 'npm run build' ./src"
Expand Down Expand Up @@ -59,6 +60,7 @@
"gulp-uglify": "^1.5.1",
"gulp-util": "^3.0.7",
"gulp-zip": "^3.1.0",
"istanbul": "^0.4.5",
"jquery": "^2.2.0",
"jsdom": "^9.0.0",
"jsdom-global": "^2.1.0",
Expand Down

0 comments on commit f671bb6

Please sign in to comment.