Skip to content

Commit bf4eeae

Browse files
committed
Add code coverage with mocha/istanbul
1 parent b1fc3d6 commit bf4eeae

File tree

18 files changed

+8843
-8918
lines changed

18 files changed

+8843
-8918
lines changed

.babelrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"presets": ["es2015"],
3+
"env": {
4+
"test": {
5+
"plugins": ["istanbul"]
6+
}
7+
}
8+
}

.codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
codecov:
2+
branch: master

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
.DS_Store
2+
.nyc_output
23
node_modules/
34
npm-debug.log
45
docs/_site
56
docs/.sass-cache
7+
coverage
68
dist
79
bin
810
test/**.js.xml

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ lib/
22
docs/
33
tasks/
44
test/
5+
coverage/
56
node_modules/
67
gulpfile.js
78
.grenrc

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ language:
22
- node_js
33

44
node_js:
5-
- "7.0"
5+
- "7.9"
66

77
cache:
88
directories:
99
- node_modules
1010

1111
before_install:
1212
- npm install -g gulp-cli
13+
- npm install -g codecov
14+
- npm install -g mocha
1315

1416
script:
15-
- gulp test
17+
- npm run test
18+
19+
after_success:
20+
- codecov

docs/_includes/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="site-header">
22
<nav class="site-nav">
3-
<a class="page-link" href="https://github.com/github-tools/github-release-notes">Github</a>
3+
<a class="page-link" href="https://github.com/github-tools/github-release-notes">Github repo</a>
44
{% for page in site.pages %}
55
{% if page.title %}
66
<a class="page-link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>

gulpfile.js

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
const babel = require('gulp-babel');
2+
const chmod = require('gulp-chmod');
3+
const eslint = require('gulp-eslint');
4+
const ghPages = require('gulp-gh-pages');
15
const gulp = require('gulp');
6+
const gulpIf = require('gulp-if');
27
const mocha = require('gulp-mocha');
3-
const eslint = require('gulp-eslint');
4-
const watch = require('gulp-watch');
58
const sass = require('gulp-sass');
6-
const gulpIf = require('gulp-if');
7-
const ghPages = require('gulp-gh-pages');
8-
const babel = require('gulp-babel');
9-
const chmod = require('gulp-chmod');
10-
const nodeunit = require('gulp-nodeunit');
9+
const watch = require('gulp-watch');
1110

1211
gulp.task('deploy', ['build'], function() {
13-
return gulp.src('./docs/**/*')
14-
.pipe(ghPages());
12+
return gulp.src('./docs/**/*')
13+
.pipe(ghPages());
1514
});
1615

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

2726
gulp.src('./lib/*.js')
28-
.pipe(babel({
29-
presets: ['es2015']
30-
}))
27+
.pipe(babel())
3128
.pipe(chmod(0o755))
3229
.pipe(gulp.dest('bin'));
33-
3430
});
3531

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

56-
gulp.task('test', () => {
57-
gulp.src('test/**/*.js')
58-
.pipe(nodeunit({
59-
reporter: 'junit',
60-
reporterOptions: {
61-
output: 'test'
62-
}
63-
}));
64-
});
65-
66-
gulp.task('build', ['lint', 'scripts', 'test']);
52+
gulp.task('build', ['lint', 'scripts']);
6753
gulp.task('default', ['build', 'watch']);

lib/src/_utils.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,29 +117,6 @@ function dashToCamelCase(value) {
117117
.replace(/-([a-z])/g, (match) => match[1].toUpperCase());
118118
}
119119

120-
/**
121-
* Create a literal object of the node module options
122-
*
123-
* @since 0.1.0
124-
* @public
125-
*
126-
* @param {Array} args The array of arguments (the module arguments start from index 2)
127-
*
128-
* @return {Object} The object containg the key/value options
129-
*/
130-
function getBashOptions(args) {
131-
const options = minimist(args.slice(2));
132-
const settings = {};
133-
134-
Object.keys(options).forEach((optionName) => {
135-
if (optionName !== '_') {
136-
settings[dashToCamelCase(optionName)] = options[optionName];
137-
}
138-
});
139-
140-
return settings;
141-
}
142-
143120
/**
144121
* Converts an array like string to an actual Array,
145122
* converting also underscores to spaces
@@ -228,7 +205,6 @@ module.exports = {
228205
printTask,
229206
task,
230207
clearTasks,
231-
getBashOptions,
232208
dashToCamelCase,
233209
isInRange,
234210
convertStringToArray,

0 commit comments

Comments
 (0)