UNPKG

sitecheck

Version:

Open Source web application security scanner

51 lines (43 loc) 1.61 kB
"use strict"; var gulp = require('gulp'); var jshint = require('gulp-jshint'); var mocha = require('gulp-mocha'); var jsdoc = require('gulp-jsdoc3'); var istanbul = require('gulp-istanbul'); var coveralls = require('gulp-coveralls'); gulp.task('lint', function () { return gulp.src(['src/**/*.js', 'bin/*.js', 'test/**/ut_*.js']) .pipe(jshint()) .pipe(jshint.reporter('default')) .pipe(jshint.reporter('fail')); }); gulp.task('pre-test', function () { return gulp.src(['src/**/*.js']) // Covering files .pipe(istanbul({ includeUntested: true })) // Use `require` statements to return covered files .pipe(istanbul.hookRequire()); }); gulp.task('test', ['pre-test'], function () { return gulp.src(['test/**/*.js']) .pipe(mocha()) // Creating the reports after tests ran .pipe(istanbul.writeReports()) // Enforce a coverage of at least x% .pipe(istanbul.enforceThresholds({ thresholds: { global: 1 } })); }); gulp.task('coveralls', function () { if (!process.env.CI) return; return gulp.src('./coverage/lcov.info') .pipe(coveralls()); }); gulp.task('doc', function (cb) { gulp.src(['README.md', './src/**/*.js'], { read: false }) .pipe(jsdoc(cb)); }); // same as "test" without code coverage. Useful to get bug reports without the erroneous line numbers generated by istanbul code instrumentation gulp.task('ut', function () { return gulp.src(['test/**/*.js']) .pipe(mocha()); }); gulp.task('default', ['lint']);