forked from purifycss/purify-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
117 lines (98 loc) · 3.19 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
* Gulpfile
*/
var gulp = require("gulp");
var eslint = require("gulp-eslint");
var jscs = require("gulp-jscs");
var mdox = require("gulp-mdox");
var nodemon = require('gulp-nodemon');
var mocha = require('gulp-mocha-co');
var exit = require('gulp-exit');
var jest = require('jest-cli');
// ----------------------------------------------------------------------------
// Constants
// ----------------------------------------------------------------------------
var JS_FILES = [
"app/*.js",
"server/*.js",
"*.js"
];
// ----------------------------------------------------------------------------
// EsLint
// ----------------------------------------------------------------------------
gulp.task("eslint", function () {
return gulp
.src(JS_FILES)
.pipe(eslint())
.pipe(eslint.formatEach("stylish", process.stderr))
.pipe(eslint.failOnError());
});
// ----------------------------------------------------------------------------
// JsCs
// ----------------------------------------------------------------------------
gulp.task("jscs", function () {
return gulp
.src(JS_FILES)
.pipe(jscs());
});
// ----------------------------------------------------------------------------
// API Test
// ----------------------------------------------------------------------------
gulp.task('nodemon', function() {
nodemon({
script: 'server.js',
env: {PORT: 8000},
nodeArgs: ['--harmony']
}).on('restart');
})
gulp.task('endpoint', function(){
gulp.src(['test/server/*.js'])
.pipe(mocha({
reporter: 'nyan'
}))
});
// ----------------------------------------------------------------------------
// Jest
// ----------------------------------------------------------------------------
gulp.task('jest', function (callback) {
var onComplete = function (result) {
if (result) {
} else {
console.log('!!! Jest tests failed! You should fix them soon. !!!');
}
callback();
}
jest.runCLI({}, __dirname, onComplete);
});
// ----------------------------------------------------------------------------
// Quality
// ----------------------------------------------------------------------------
gulp.task("style", ["jscs", "eslint"]);
gulp.task("style:ci", ["jscs", "eslint"]);
gulp.task("style:all", ["jscs", "eslint"]);
// ----------------------------------------------------------------------------
// Testing
// ----------------------------------------------------------------------------
gulp.task('test:client', ['jest']);
gulp.task('test:server', ['endpoint']);
gulp.task('test', ['jest','endpoint']);
// ----------------------------------------------------------------------------
// Docs
// ----------------------------------------------------------------------------
// gulp.task("docs", function () {
// return gulp
// .src([
// "lib/**/*.js"
// ])
// .pipe(mdox({
// src: "./README.md",
// name: "README.md",
// start: "## Plugins",
// end: "## Contributions"
// }))
// .pipe(gulp.dest("./"));
// });
// ----------------------------------------------------------------------------
// Aggregations
// ----------------------------------------------------------------------------
gulp.task('default', ['nodemon']);