-
Notifications
You must be signed in to change notification settings - Fork 2
/
gruntfile.js
81 lines (76 loc) · 1.8 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
/*global module */
"use strict";
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jsbeautifier');
grunt.loadNpmTasks('grunt-run');
grunt.initConfig({
alljsfiles: ['lib/**/*.js', 'test/**/*.js', 'gruntfile.js', 'package.json', 'index.js'],
jsbeautifier: {
beautify: {
src: '<%= alljsfiles%>',
options: {
config: '.jsbeautifyrc'
}
},
check: {
src: '<%= alljsfiles%>',
options: {
mode: 'VERIFY_ONLY',
config: '.jsbeautifyrc'
}
}
},
jshint: {
files: '<%= alljsfiles%>',
options: {
browser: true,
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: false,
boss: true,
eqnull: true,
node: true,
expr: true,
globals: {
'xit': true,
'xdescribe': true,
'it': true,
'describe': true,
'expect': true,
'before': true,
'after': true,
'done': true
}
}
},
watch: {
all: {
files: '<%= alljsfiles%>',
tasks: ['default']
}
},
run: {
test: {
exec: 'npx jest'
},
coverage: {
exec: 'npx jest --coverage'
}
}
});
grunt.registerTask('beautify', ['jsbeautifier:beautify']);
grunt.registerTask('test', ['run:test']);
grunt.registerTask('coverage', ['run:coverage']);
grunt.registerTask('default', ['beautify', 'jshint', 'test']);
// Print a timestamp (useful for when watching)
grunt.registerTask('timestamp', function () {
grunt.log.subhead(Date());
});
};