This repository has been archived by the owner on Feb 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
gulpfile.js
executable file
·92 lines (78 loc) · 2.55 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
89
90
91
92
/* 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 path = require('path');
var child_process = require('child_process');
var argv = require('minimist')(process.argv.slice(2)); // eslint-disable-line
// #############################################################################
// SETTINGS
var PROJECT_ROOT = __dirname;
var PROJECT_PATH = {
js: PROJECT_ROOT + '/aldryn_events/boilerplates/bootstrap3/static/js/',
tests: PROJECT_ROOT + '/aldryn_events/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'
]
];
// #############################################################################
// 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]
var pathToBin = child_process.execSync('npm bin').toString().trim();
var pathToCasper = path.join(pathToBin, 'casperjs');
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),
waitForMigrations: 120,
pathToCasper: pathToCasper
}));
gulp.task('tests:watch', function () {
var server = new KarmaServer({
configFile: PROJECT_PATH.tests + '/karma.conf.js'
});
server.start();
});
// #############################################################################
// COMMANDS
gulp.task('default', ['lint']);