forked from openedx-unsupported/edx-analytics-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (50 loc) · 1.86 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
(function() {
'use strict';
var gulp = require('gulp'),
Server = require('karma').Server,
path = require('path'),
extend = require('util')._extend, // eslint-disable-line no-underscore-dangle
paths = {
spec: [
'analytics_dashboard/static/js/**/*.js',
'analytics_dashboard/static/js/test/**/*.js',
'analytics_dashboard/static/apps/**/*.js'
],
templates: [
'analytics_dashboard/analytics_dashboard/templates/analytics_dashboard/*.html',
'analytics_dashboard/courses/templates/courses/*.html',
'analytics_dashboard/templates/*.html'
],
sass: ['analytics_dashboard/static/sass/*.scss'],
karmaConf: 'karma.conf.js'
};
// kicks up karma to the tests once
function runKarma(configFile, cb, options) {
var defaultOptions = {
configFile: path.resolve(configFile),
singleRun: true,
browsers: ['PhantomJS']
};
new Server(extend(defaultOptions, options), cb).start();
}
// this task runs the tests. It doesn't give you very detailed results,
// so you may need to run the jasmine test page directly:
// http://127.0.0.1:8000/static/js/test/spec-runner.html
gulp.task('test', function(cb) {
runKarma(paths.karmaConf, cb);
});
gulp.task('test-debug', function(cb) {
runKarma(paths.karmaConf, cb, {
singleRun: false,
autoWatch: true,
browsers: ['Chrome'],
reporters: ['kjhtml']
});
});
// these are the default tasks when you run gulp
gulp.task('default', ['test']);
// type 'gulp watch' to continuously run tests
gulp.task('watch', function() {
gulp.watch(paths.spec, ['test']);
});
}());