forked from mgcrea/angular-strap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
95 lines (90 loc) · 3.12 KB
/
test.js
File metadata and controls
95 lines (90 loc) · 3.12 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
'use strict';
var gutil = require('gulp-util');
var path = require('path');
var Server = require('karma').Server;
var reporter = require('./helpers/reporter');
module.exports = function (gulp, config) {
var testTimezone = '';
var hasWatchFlag = process.argv.indexOf('-w') !== -1;
gulp.task('karma:unit', gulp.series('ng:test/templates', function (done) {
// if testTimezone has value, set the environment timezone
// before starting karma, so PhantomJS picks up the
// timezone setting
if (testTimezone) {
gutil.log('Setting timezone to "%s"', testTimezone);
process.env.TZ = testTimezone;
}
new Server({
configFile: path.join(config.dirname, 'test/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: [hasWatchFlag ? 'progress' : 'dots'],
autoWatch: hasWatchFlag ? true : false,
singleRun: hasWatchFlag ? false : true
}, function (code) {
gutil.log('Karma has exited with ' + code);
done();
}).start();
}));
// codeclimate-test-reporter
gulp.task('karma:travis', gulp.series('ng:test/templates', function karmaTravis(done) {
new Server({
configFile: path.join(config.dirname, 'test/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: ['dots', 'coverage'],
autoWatch: hasWatchFlag ? true : false,
singleRun: hasWatchFlag ? false : true
}, function (code) {
gutil.log('Karma has exited with ' + code);
if (code) {
process.exit(code);
}
var token = process.env.CODE_CLIMATE_TOKEN;
if (!token) {
done();
return;
}
gulp.src('test/coverage/**/lcov.info', {read: false})
.pipe(reporter({token: token}))
.on('end', done);
}).start();
}));
gulp.task('karma:travis~1.2.0', gulp.series('ng:test/templates', function karmaTravis120(done) {
new Server({
configFile: path.join(config.dirname, 'test/~1.2.0/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: ['dots'],
autoWatch: hasWatchFlag ? true : false,
singleRun: hasWatchFlag ? false : true
}, function (code) {
gutil.log('Karma has exited with ' + code);
if (code) {
process.exit(code);
}
done();
}).start();
}));
gulp.task('karma:travis~1.3.0', gulp.series('ng:test/templates', function karmaTravis130(done) {
new Server({
configFile: path.join(config.dirname, 'test/~1.3.0/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: ['dots'],
autoWatch: hasWatchFlag ? true : false,
singleRun: hasWatchFlag ? false : true
}, function (code) {
gutil.log('Karma has exited with ' + code);
if (code) {
process.exit(code);
}
done();
}).start();
}));
gulp.task('test', gulp.series('ng:test/templates', gulp.parallel('karma:unit')));
gulp.task('test:timezone', function () {
// parse command line argument for optional timezone
// invoke like this:
// gulp test:timezone --Europe/Paris
var timezone = process.argv[3] || '';
testTimezone = timezone.replace(/-/g, '');
return gulp.series('ng:test/templates', gulp.parallel('karma:unit'));
});
};