This repository has been archived by the owner on Sep 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·69 lines (58 loc) · 1.78 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
var gulp = require('gulp');
//These paths need to be changed based on the location of the respective files on your application
var paths = {
html:['views/**/*.html'],
css:['public/**/*.css'],
js:['public/**/*.js','routes/**/*.js','app.js'],
};
var runSequence = require('run-sequence');
var karma = require('karma').server;
var mocha = require('gulp-mocha');
var bower = require('gulp-bower');
var shell = require('gulp-shell');
/*
Gulp tasks for linting
*/
gulp.task('default', function(callback) {
runSequence('lint', 'dev-unit', callback);
});
gulp.task('lint-js', shell.task(
['node_modules/.bin/jshint app.js routes/ --reporter=node_modules/jshint-junit-reporter/reporter.js > test/jslint.xml'],
{ cwd: __dirname, ignoreErrors: false }
));
gulp.task('lint-css', shell.task(
['node_modules/.bin/csslint public/**/*.css --ignore=box-model,ids --format=junit-xml > test/csslint.xml'],
{ cwd: __dirname, ignoreErrors: false }
));
gulp.task('lint', ['lint-js','lint-css']);
/*
Gulp tasks for unit tests
*/
//Task for karma (frontend) unit tests
gulp.task('dev-karma', function(done) {
karma.start({
configFile: __dirname + '/test/karma.conf.js',
singleRun: true,
}, done);
});
//Task for mocha (server) unit tests
gulp.task('dev-mocha', function() {
return gulp.src('test/unit/server/**/*spec.js', {read: false})
.pipe(mocha({
globals:['expect'],
timeout: 3000,
ignoreLeaks: true,
ui: 'bdd',
colors: true,
reporter: 'mocha-jenkins-reporter',
reporterOptions: {
junit_report_name: 'Mocha Unit Tests for Server',
junit_report_path: 'test/mocha-report.xml',
junit_report_stack: 1,
},
}));
});
gulp.task('dev-setup', function() {
return bower();
});
gulp.task('dev-unit', ['dev-karma','dev-mocha']);