-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
63 lines (55 loc) · 1.55 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
'use strict';
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
karma = require('karma').server,
express = require('express'),
protractor = require('gulp-protractor'),
server;
gulp.task('default', ['unit', 'e2e', 'build']);
// Copy and minify project
gulp.task('build', function () {
return gulp.src('src/*.js')
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest('dist'));
});
// Examples server
gulp.task('server', function (done) {
server = express();
server.use(express.static(__dirname + '/examples/'));
server = server.listen(9999, function () {
console.log('Listening on port 9999');
done();
});
});
// Run unit tests once and exit
gulp.task('unit', function (done) {
var config = require('./karma.conf.js')();
config.singleRun = true;
karma.start(config, done);
});
// Continuously run unit tests
gulp.task('tdd', function (done) {
var config = require('./karma.conf.js')();
karma.start(config, done);
});
/// Run e2e tests once and exit
gulp.task('webdriverUpdate', protractor.webdriver_update);
gulp.task('e2e', ['server', 'webdriverUpdate'], function (done) {
var close = function (err) {
server.close(function () {
done(err);
});
};
gulp.src('test/e2e/*.spec.js')
.pipe(protractor.protractor({
configFile: 'protractor.conf.js',
args: ['--baseUrl', 'http://' + server.address().address + ':' + server.address().port]
}))
.on('error', close)
.on('end', close);
});