-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (57 loc) · 1.65 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
// 引入模块
var gulp = require('gulp');
var Server = require('karma').Server;
var mocha = require('gulp-mocha');
// var imageResize = require('gulp-image-resize');
// var gm = require('gulp-gm');
var prepare = require('./task/prepare');
/**
* 【准备工作】将组件模板写入配置文件
*/
gulp.task('buildTemplateCfg', function(cb) {
prepare.buildTemplateCfg(cb);
});
/**
* 【单元测试】Karma & mocha chai
*/
gulp.task('unitTest', ['buildTemplateCfg'], function(done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
/**
* 【UI测试】selenium-webdriver & mocha chai
*/
gulp.task('UITest', function() {
return gulp.src('./spec/UITest/**/*.spec.js', {
read: false
}).pipe(mocha({
// reporter: 'spec',
// timeout: 5000
reporter: 'mochawesome',
reporterOptions: {
reportDir: 'reporter/UITest',
reportName: 'UITestReporter'
}
}));
});
// gulp.task('width', function () {
// gulp.src('./img/test.png')
// .pipe(imageResize({
// width: 100
// }))
// .pipe(gulp.dest('./dist'));
// });
// gulp.task('test', function () {
// gulp.src('./img/test.png')
// .pipe(gm(function (gmfile) {
// return gmfile.resize(100, 100);
// }))
// .pipe(gulp.dest('./dist'));
// });
// 默认任务
gulp.task('default', ['unitTest', 'UITest']);
// 监视文件变化
gulp.watch(['spec/unitTest/**/*.js'], ['unitTest']);
gulp.watch(['spec/UITest/**/*.js'], ['UITest']);