Permalink
Browse files

Coverage, Lint, Code-style

  • Loading branch information...
1 parent b28f77c commit 482b07ba1a5973f51b52ef687f01629d9f80cdc6 @iamvdo committed Mar 3, 2015
Showing with 44 additions and 14 deletions.
  1. +1 −1 .jshintrc
  2. +39 −11 Gulpfile.js
  3. +2 −0 package.json
  4. +2 −2 test/sourcemaps.js
View
@@ -7,7 +7,7 @@
"curly": true,
"eqeqeq": true,
"immed": true,
- "indent": 4,
+ "indent": 2,
"latedef": false,
"newcap": true,
"noarg": true,
View
@@ -42,23 +42,25 @@ gulp.task('standalone', ['clean'], function() {
* Lint JS files
*
*/
-gulp.task('lint', function() {
+gulp.task('lint', function(cb) {
var jshint = require('gulp-jshint');
gulp.src(['lib/**/*.js', 'test/**/*.js'])
.pipe(jshint())
- .pipe(jshint.reporter('jshint-stylish'));
+ .pipe(jshint.reporter('jshint-stylish'))
+ .on('finish', cb);
});
/**
*
* Coding style
*
*/
-gulp.task('jscs', function() {
+gulp.task('jscs', function(cb) {
var jscs = require('gulp-jscs');
gulp.src(['lib/**/*.js', 'test/**/*.js'])
- .pipe(jscs());
+ .pipe(jscs())
+ .on('finish', cb);
});
/**
@@ -68,14 +70,40 @@ gulp.task('jscs', function() {
* `gulp test --file cli` (test only cli.js file)
*
*/
-gulp.task('test', function () {
- require('should');
- var mocha = require('gulp-mocha');
- var args = require('yargs').argv;
- var file = args.file || '*';
+gulp.task('test', ['lint', 'jscs'], function () {
+ require('should');
+ var mocha = require('gulp-mocha');
+ var args = require('yargs').argv;
+ var file = args.file || '*';
+
+ gulp.src('test/' + file + '.js', {read: false})
+ .pipe(mocha({reporter: 'spec'}))
+
+});
- return gulp.src('test/' + file + '.js', {read: false})
- .pipe(mocha({reporter: 'spec'}));
+/**
+ *
+ * Coverage
+ *
+ */
+gulp.task('istanbul', function (cb) {
+ require('should');
+ var istanbul = require('gulp-istanbul');
+ var mocha = require('gulp-mocha');
+ gulp.src('lib/**/*.js')
+ .pipe(istanbul())
+ .pipe(istanbul.hookRequire())
+ .on('finish', function () {
+ gulp.src('test/*.js', {read: false})
+ .pipe(mocha({reporter: 'spec'}))
+ .pipe(istanbul.writeReports())
+ .on('end', cb)
+ });
+})
+gulp.task('coverage', ['istanbul'], function (cb) {
+ var coveralls = require('gulp-coveralls');
+ gulp.src('coverage/**/lcov.info')
+ .pipe(coveralls());
});
/**
View
@@ -44,6 +44,8 @@
"fs-extra": "~0.10.0",
"gulp": "3.8.6",
"gulp-bump": "~0.1.10",
+ "gulp-coveralls": "^0.1.3",
+ "gulp-istanbul": "^0.6.0",
"gulp-jscs": "^1.4.0",
"gulp-jshint": "~1.7.1",
"gulp-mocha": "~0.5.1",
View
@@ -349,12 +349,12 @@ describe('Sourcemaps', function () {
opts.sass = false;
opts.less = true;
- var processed = pleeease.process('a{a:a}', opts);
+ processed = pleeease.process('a{a:a}', opts);
processed.css.should.containEql('sourceMappingURL=');
opts.sass = opts.less = false;
opts.stylus = true;
- var processed = pleeease.process('a{a:a}', opts);
+ processed = pleeease.process('a{a:a}', opts);
processed.css.should.containEql('sourceMappingURL=');
});

0 comments on commit 482b07b

Please sign in to comment.