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
103 lines (97 loc) · 3.35 KB
/
test.js
File metadata and controls
103 lines (97 loc) · 3.35 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
101
102
103
'use strict';
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var path = require('path');
var Server = require('karma').Server;
var reporter = require('./helpers/reporter');
module.exports = function(gulp, config) {
gulp.task('jshint', function() {
var paths = config.paths;
return gulp.src(paths.scripts, {cwd: paths.cwd})
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
var testTimezone = '';
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: ['dots'],
singleRun: true
}, function(code) {
gutil.log('Karma has exited with ' + code);
done();
}).start();
}));
gulp.task('karma:server', gulp.series('ng:test/templates', function karmaServer(done) {
new Server({
configFile: path.join(config.dirname, 'test/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: ['progress'],
autoWatch: true,
singleRun: false
}, 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'],
singleRun: true
}, function(code) {
gutil.log('Karma has exited with ' + 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'],
singleRun: true
}, function(code) {
gutil.log('Karma has exited with ' + 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'],
singleRun: true
}, function(code) {
gutil.log('Karma has exited with ' + code);
done();
}).start();
}));
gulp.task('test', gulp.series('ng:test/templates', gulp.parallel('jshint', '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('jshint', 'karma:unit'));
});
gulp.task('test:server', gulp.series('ng:test/templates', 'karma:server'));
};