Skip to content

Commit

Permalink
Add code coverage with mocha/istanbul
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcanessa committed Sep 25, 2017
1 parent b1fc3d6 commit 9777c38
Show file tree
Hide file tree
Showing 17 changed files with 552 additions and 585 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["es2015"],
"env": {
"test": {
"plugins": ["istanbul"]
}
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.DS_Store
.nyc_output
node_modules/
npm-debug.log
docs/_site
docs/.sass-cache
coverage
dist
bin
test/**.js.xml
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ lib/
docs/
tasks/
test/
coverage/
node_modules/
gulpfile.js
.grenrc
Expand Down
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ cache:

before_install:
- npm install -g gulp-cli
- npm install -g codecov
- npm install

script:
- gulp test
- npm run test

after_success:
- codecov
2 changes: 1 addition & 1 deletion docs/_includes/header.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="site-header">
<nav class="site-nav">
<a class="page-link" href="https://github.com/github-tools/github-release-notes">Github</a>
<a class="page-link" href="https://github.com/github-tools/github-release-notes">Github repo</a>
{% for page in site.pages %}
{% if page.title %}
<a class="page-link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>
Expand Down
34 changes: 10 additions & 24 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
const babel = require('gulp-babel');
const chmod = require('gulp-chmod');
const eslint = require('gulp-eslint');
const ghPages = require('gulp-gh-pages');
const gulp = require('gulp');
const gulpIf = require('gulp-if');
const mocha = require('gulp-mocha');
const eslint = require('gulp-eslint');
const watch = require('gulp-watch');
const sass = require('gulp-sass');
const gulpIf = require('gulp-if');
const ghPages = require('gulp-gh-pages');
const babel = require('gulp-babel');
const chmod = require('gulp-chmod');
const nodeunit = require('gulp-nodeunit');
const watch = require('gulp-watch');

gulp.task('deploy', ['build'], function() {
return gulp.src('./docs/**/*')
.pipe(ghPages());
return gulp.src('./docs/**/*')
.pipe(ghPages());
});

gulp.task('scripts', () => {
Expand All @@ -25,12 +24,9 @@ gulp.task('scripts', () => {
.pipe(gulp.dest('dist'));

gulp.src('./lib/*.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(babel())
.pipe(chmod(0o755))
.pipe(gulp.dest('bin'));

});

gulp.task('lint', () => {
Expand All @@ -53,15 +49,5 @@ gulp.task('watch', () => {
return gulp.watch('./lib/**/*.js', ['lint', 'scripts']);
});

gulp.task('test', () => {
gulp.src('test/**/*.js')
.pipe(nodeunit({
reporter: 'junit',
reporterOptions: {
output: 'test'
}
}));
});

gulp.task('build', ['lint', 'scripts', 'test']);
gulp.task('build', ['lint', 'scripts']);
gulp.task('default', ['build', 'watch']);
24 changes: 0 additions & 24 deletions lib/src/_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,29 +117,6 @@ function dashToCamelCase(value) {
.replace(/-([a-z])/g, (match) => match[1].toUpperCase());
}

/**
* Create a literal object of the node module options
*
* @since 0.1.0
* @public
*
* @param {Array} args The array of arguments (the module arguments start from index 2)
*
* @return {Object} The object containg the key/value options
*/
function getBashOptions(args) {
const options = minimist(args.slice(2));
const settings = {};

Object.keys(options).forEach((optionName) => {
if (optionName !== '_') {
settings[dashToCamelCase(optionName)] = options[optionName];
}
});

return settings;
}

/**
* Converts an array like string to an actual Array,
* converting also underscores to spaces
Expand Down Expand Up @@ -228,7 +205,6 @@ module.exports = {
printTask,
task,
clearTasks,
getBashOptions,
dashToCamelCase,
isInRange,
convertStringToArray,
Expand Down
Loading

0 comments on commit 9777c38

Please sign in to comment.