This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathGruntfile.js
104 lines (92 loc) · 2.5 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
104
'use strict';
var testDatabase = require('./test/database/resetTestDatabase');
module.exports = function (grunt) {
// Show elapsed time at the end
require('time-grunt')(grunt);
// Load all grunt tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
clean: ['./build'],
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish'),
},
all: {
src: ['Gruntfile.js', 'src/*.js', 'test/**/*.js'],
},
},
jscs: {
src: ['Gruntfile.js', 'src/*.js', 'test/**/*.js'],
options: {
config: '.jscsrc',
esnext: false, // If you use ES6 http://jscs.info/overview.html#esnext
verbose: true, // If you need output with rule names http://jscs.info/overview.html#verbose
fix: true, // Autofix code style violations when possible.
reporter: 'node_modules/jscs-clang-reporter',
},
},
watch: {
all: {
files: ['Gruntfile.js', 'src/*.js', 'test/**/*.js', 'test/database/*'],
tasks: ['default'],
options: {
spawn: true,
atBegin: true,
},
},
},
jasmine_node: { // jshint ignore:line
options: {
coverage:{
reportFile: 'coverage.json',
print: 'both', // none, summary, detail, both
relativize: true,
thresholds: {
statements: 0,
branches: 0,
lines: 0,
functions: 0,
},
reportDir: './build/coverage',
report: [
'lcov',
],
collect: [// false to disable
'*coverage.json',
],
excludes: [],
},
forceExit: false,
match: '.',
matchAll: false,
specFolders: ['test/'],
extensions: 'js',
specNameMatcher: 'spec|e2e',
captureExceptions: true,
showColors: true,
isVerbose: true,
junitreport: {
report: false,
savePath: './build/reports/jasmine/',
useDotNotation: true,
consolidate: true,
},
},
src: 'src/*.js',
},
});
grunt.loadNpmTasks('grunt-jscs');
grunt.registerTask('resetTestDatabase', function () {
var done = this.async();
testDatabase.reset()
.then(function () {
done();
})
.fail(function (err) {
console.log(err);
done(false);
});
});
grunt.registerTask('default', ['jscs', 'jshint', 'clean', /*'resetTestDatabase',*/ 'jasmine_node']);
};