UNPKG

1.3 kBJavaScriptView Raw
1'use strict';
2
3var gulp = require('gulp');
4var istanbul = require('gulp-istanbul');
5var mocha = require('gulp-mocha');
6var plato = require('gulp-plato');
7var runSequence = require('run-sequence');
8var coveralls = require('gulp-coveralls');
9
10function test(cb) {
11 gulp
12 .src(['index.js'])
13 .pipe(istanbul())
14 .on('finish', function () {
15 gulp
16 .src(['test/main.js'])
17 .pipe(mocha({
18 reporter: 'nyan'
19 }))
20 .pipe(istanbul.writeReports())
21 .on('end', cb);
22 });
23}
24
25
26function complexity() {
27
28 var jsHintArgs = {
29 options: {
30 strict: true
31 }
32 },
33 complexityArgs = {
34 trycatch: true
35 },
36 platoArgs = {
37 jshint: jsHintArgs,
38 complexity: complexityArgs
39 };
40
41
42 gulp.src(['index.js'])
43 .pipe(plato('plato', platoArgs));
44}
45
46function lcov(){
47 gulp
48 .src('coverage/**/lcov.info')
49 .pipe(coveralls());
50}
51
52
53function ci(cb) {
54 runSequence('test', 'complexity', cb);
55}
56
57
58gulp
59 .task('test', test)
60 .task('complexity', complexity)
61 .task('coveralls', lcov)
62 .task('ci', ci);
\No newline at end of file