Download this file

Gruntfile.js    81 lines (76 with data), 2.0 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
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc',
ignores: []
},
all: {
src: [
'Gruntfile.js',
'tasks/**/*.js',
'test/**/**/*.js',
'backend/**/*.js',
'frontend/js/**/*.js'
]
}
},
jscs: {
options: {
config: '.jscsrc'
},
all: {
src: ['<%= jshint.all.src %>']
}
},
lint_pattern: {
options: {
rules: [
{ pattern: /(describe|it)\.only/, message: 'Must not use .only in tests' }
]
},
all: {
src: ['<%= jshint.all.src %>']
},
css: {
options: {
rules: [
{ pattern: /important;(\s*$|(?=\s+[^\/]))/, message: 'CSS important rules only allowed with explanatory comment' }
]
},
src: [
'frontend/css/**/*.less'
]
}
},
mochacli: {
options: {
require: ['chai', 'mockery'],
reporter: 'spec',
timeout: process.env.TEST_TIMEOUT || 20000
},
backend: {
options: {
files: ['test/unit-backend/all.js', grunt.option('test') || 'test/unit-backend/**/*.js']
}
}
},
karma: {
unit: {
configFile: './test/config/karma.conf.js',
browsers: ['PhantomJS']
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-lint-pattern');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-mocha-cli');
grunt.loadNpmTasks('grunt-karma');
grunt.registerTask('linters', 'Check code for lint', ['jshint:all', 'jscs:all', 'lint_pattern']);
grunt.registerTask('test-unit-backend', 'Test backend code', ['mochacli:backend']);
grunt.registerTask('test-unit-frontend', 'Test frontend code', ['karma:unit']);
grunt.registerTask('test', ['linters', 'test-unit-frontend', 'test-unit-backend']);
grunt.registerTask('default', ['test']);
};