-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
103 lines (99 loc) · 3.19 KB
/
Gruntfile.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
93
94
95
96
97
98
99
100
101
102
103
// use as: grunt karma:dev for continuous testing or
// grunt karma:unit to just run the test once
// grunt test-server to display the test runner page
module.exports = function(grunt) {
var path = require('path');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-lint-inline');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
karma: {
unit: {
configFile: 'conf/karma.conf.js',
singleRun: true,
browsers: ['Firefox']
},
ci: {
configFile: 'conf/karma.conf.js',
singleRun: true,
browsers: ['Firefox']
},
dev: {
configFile: 'conf/karma.conf.js',
singleRun: false,
browsers: ['Firefox']
},
},
connect: {
server: {
options: {
port: 9001,
base: __dirname+'/../',
keepalive: true,
open: 9001+'/'+path.basename(__dirname)+'/index.html'
}
}
},
csslint: {
lax: {
options: {
"adjoining-classes": false,
"box-model": false,
"box-sizing": false,
"bulletproof-font-face": false,
"compatible-vendor-prefixes": false,
"ids": false,
"important": false,
"outline-none": false,
"overqualified-elements": false,
"qualified-headings": false,
"regex-selectors": false,
"star-property-hack": false,
"underscore-property-hack": false,
"universal-selector": false,
"unique-headings": false,
"unqualified-attributes": false,
"vendor-prefix": false,
"zero-units": false
},
src: [
"component.css"
]
},
},
jshint: {
options: {
"-W054": true, // The Function constructor is a form of eval
"-W069": true // thing["property"] is better written in dot notation
},
files: [
"Gruntfile.js",
"test/**/*.js"
]
},
inlinelint: {
html: ['index.html', 'component.html', 'test/**/*.html'],
}
});
grunt.registerTask('lint', 'check the code', ["inlinelint", "jshint", "csslint"]);
grunt.registerTask('test-server', 'start web server for tests in browser', function() {
grunt.event.once('connect.server.listening', function(host, port) {
var specRunnerUrl = 'http://' + host + ':' + 9001+'/'+path.basename(__dirname)+'/index.html';
grunt.log.writeln('test runner available at: ' + specRunnerUrl);
require('open')(specRunnerUrl);
});
grunt.task.run('connect:server');
});
grunt.registerTask('default', 'help message', function() {
grunt.log.writeln('\n\nRun:\n\'grunt karma:dev\' for continuous testing');
grunt.log.writeln('\'grunt karma:unit\' to just run the test once');
grunt.log.writeln('\'grunt test-server\' to display the test runner page');
grunt.log.writeln('\'grunt lint\' to check the code');
});
// grunt.registerTask('default', ['connect']);
};