forked from divio/aldryn-newsblog
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
executable file
·88 lines (73 loc) · 2.34 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* eslint strict: [2, "global"] */
/**
* @author: Divio AG
* @copyright: http://www.divio.ch
*/
'use strict';
// #############################################################################
// IMPORTS
var gulp = require('gulp');
var gutil = require('gulp-util');
var KarmaServer = require('karma').Server;
var eslint = require('gulp-eslint');
var integrationTests = require('djangocms-casper-helpers/gulp');
var argv = require('minimist')(process.argv.slice(2)); // eslint-disable-line
// #############################################################################
// SETTINGS
var PROJECT_ROOT = __dirname;
var PROJECT_PATH = {
js: PROJECT_ROOT + '/aldryn_newsblog/boilerplates/bootstrap3/static/js/',
tests: PROJECT_ROOT + '/aldryn_newsblog/tests/frontend'
};
var PROJECT_PATTERNS = {
lint: [
PROJECT_PATH.js + '/addons/*.js',
PROJECT_PATH.tests + '/**/*.js',
'!' + PROJECT_PATH.tests + '/coverage/**/*.js',
PROJECT_ROOT + '/gulpfile.js'
]
};
var INTEGRATION_TESTS = [
[
'crud',
'related-articles'
]
];
// #############################################################################
// LINTING
gulp.task('lint', function () {
// DOCS: http://eslint.org
return gulp.src(PROJECT_PATTERNS.lint)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
// #########################################################
// TESTS
gulp.task('tests', ['tests:unit', 'tests:lint', 'tests:integration']);
gulp.task('tests:lint', ['lint']);
gulp.task('tests:unit', function (done) {
var server = new KarmaServer({
configFile: PROJECT_PATH.tests + '/karma.conf.js',
singleRun: true
}, done);
server.start();
});
// gulp tests:integration [--clean] [--screenshots] [--tests=loginAdmin,toolbar]
gulp.task('tests:integration', integrationTests({
tests: INTEGRATION_TESTS,
pathToTests: PROJECT_PATH.tests,
argv: argv,
dbPath: 'local.sqlite',
serverCommand: 'test_settings.py server',
logger: gutil.log.bind(gutil)
}));
gulp.task('tests:unit:watch', function () {
var server = new KarmaServer({
configFile: PROJECT_PATH.tests + '/karma.conf.js'
});
server.start();
});
// #############################################################################
// COMMANDS
gulp.task('default', ['lint']);