[Pkg-javascript-commits] [node-mocks-http] 161/296: added; gulp tasks for running tests and generating coverage report

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

alteholz pushed a commit to branch master
in repository node-mocks-http.

commit 89834e0221be9463b1c077376627d733f122cec5
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date:   Mon Apr 6 15:03:54 2015 +0800

    added; gulp tasks for running tests and generating coverage report
---
 gulpfile.js | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644
index 0000000..3d3d86f
--- /dev/null
+++ b/gulpfile.js
@@ -0,0 +1,42 @@
+'use strict';
+
+var gulp = require('gulp');
+var mocha = require('gulp-mocha');
+var istanbul = require('gulp-istanbul');
+var open = require('gulp-open');
+
+var src = {
+  lib: ['./lib/**/*.js'],
+  test: ['./test/**/*.spec.js']
+};
+
+gulp.task('test', function () {
+    return gulp.src(src.test, {read: false})
+      .pipe(mocha({reporter: 'dot'}));
+});
+
+gulp.task('spec', function () {
+    return gulp.src(src.test, {read: false})
+      .pipe(mocha({reporter: 'spec'}));
+});
+
+gulp.task('coverage', function (done) {
+    gulp.src(src.lib)
+      .pipe(istanbul())
+      .pipe(istanbul.hookRequire())
+      .on('finish', function () {
+          gulp.src(src.test)
+              .pipe(mocha({reporter: 'dot'}))
+              .pipe(istanbul.writeReports({
+                  dir: './coverage',
+                  reporters: ['lcov', 'json', 'html'],
+                  reportOpts: { dir: './coverage' }
+                }))
+              .on('end', done);
+      });
+});
+
+gulp.task('open', function(){
+    gulp.src('./coverage/index.html')
+      .pipe(open('<%file.path%>'));
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocks-http.git



More information about the Pkg-javascript-commits mailing list