-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathGulpfile.js
More file actions
100 lines (86 loc) · 3.18 KB
/
Gulpfile.js
File metadata and controls
100 lines (86 loc) · 3.18 KB
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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var changed = require('gulp-changed');
var imagemin = require('gulp-imagemin');
var minifyHTML = require('gulp-minify-html');
var clean = require('gulp-clean');
var protractor = require('gulp-protractor').protractor;
var karma = require('gulp-karma');
// var jasmine = require('gulp-jasmine');
var paths = {
scripts: ['client/app/**/*.js', 'server/**/*.js'],
//OTHER PATHS TBD:
// libs: ['scripts/libs/jquery/dist/jquery.js', 'scripts/libs/underscore/underscore.js', 'scripts/backbone/backbone.js'],
styles: ['client/assets/styles/**/*.css'],
html: ['client/app/**/*.html','client/index.html']
// images: ['images/**/*.png'],
// extras: ['crossdomain.xml', 'humans.txt', 'manifest.appcache', 'robots.txt', 'favicon.ico'],
};
//delete the contents of dist folder
gulp.task('clean', function() {
return gulp.src('dist/', {
read: false
})
.pipe(clean());
});
/*************************************************************
Server side unit tests with Mocha + Chai
**************************************************************/
gulp.task('test', function(){
gulp.src('./server/test/unit/*.js')
.pipe(mocha({reporter: 'nyan'}));
});
/*************************************************************
Client side unit tests with Karma + Mocha + Chai
**************************************************************/
gulp.task('karma', function(done) {
gulp.src('./foobar')
.pipe(karma({
configFile: './client/test/unit/config/karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
// console.log(err);
this.emit('end'); //instead of erroring the stream, end it
});
});
/*************************************************************
End to end testing with Protractor
**************************************************************/
gulp.task('e2e', function(done) {
gulp.src(['./client/test/e2e/*.spec.js'])
.pipe(protractor({
configFile: 'client/test/e2e/config/protractor.conf.js',
}))
.on('error', function(error) { throw error; });
});
//pipe all scripts within the src/scripts folder to the jshint object, and outputs errors to the console
gulp.task('jshint', function() {
gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'));
// .pipe(gulp.dest('dist/')); //this creates the dist folder with manipulated files dropped in. I don't think we're ready for this yet :).
});
gulp.task('unit-tests', ['karma','test']);
gulp.task('e2e-tests', ['e2e']);
gulp.task('default', ['jshint','test']);
//------------We'll need these later, please leave them here.
// gulp.task('imagemin', function() {
// var imgSrc = './src/images/**/*';
// var imgDst = './dist/images';
// gulp.src(imgSrc)
// .pipe(changed(imgDst))
// .pipe(imagemin())
// .pipe(gulp.dest(...))
// });
// gulp.task('htmlpage', function() {
// var htmlSrc = './src/*.html',
// htmlDst = './build';
// gulp.src(htmlSrc)
// .pipe(changed(htmlDst))
// .pipe(minifyHTML())
// .pipe(gulp.dest(htmlDst));
// });
//-----------------------------------------------------------