-
Notifications
You must be signed in to change notification settings - Fork 2
/
GruntFile.js
100 lines (95 loc) · 3.09 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
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
typescript: {
src: {
src: ['src/**/*.ts'],
dest: 'js',
options: {
module: 'commonjs',
target: 'es5',
sourceMap: true,
declaration: false,
experimentalDecorators: true,
watch: true
}
},
test: {
src: ['test/**/*.ts'],
dest: 'js-test',
options: {
module: 'commonjs', //or
target: 'es5', //or es3
sourceMap: true,
declaration: false,
experimentalDecorators: true
}
}
},
'node_mocha': {
test: {
src: ['js-test/test/**/*.js'],
options: {
mochaOptions: {
globals: ['expect'],
timeout: 3000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'landing'
}
}
},
coverage: {
src: ['js-test/test/**/*.js'],
options: {
mochaOptions: {
globals: ['expect'],
timeout: 3000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'spec'
},
reportFormats: ['html'], // other grunt-mocha-istanbul can be added here
runCoverage: true // Run the unit test and generate coverage test
}
}
},
'http-server': {
'coverage': {
root: 'coverage'
}
},
shell: {
debug: {
command: 'node-debug js/rest/rest-crud.js'
}
},
nodemon: {
dev: {
script: 'js/rest/rest-crud.js'
}
},
tsd: {
refresh: {
options: {
command: 'reinstall',
latest: true,
config: 'tsd.json'
}
}
}
});
grunt.loadNpmTasks('grunt-typescript');
grunt.loadNpmTasks('grunt-node-mocha');
grunt.loadNpmTasks('grunt-http-server');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-tsd');
grunt.registerTask('build', ['tsd', 'typescript:src']);
grunt.registerTask('test', ['typescript:test', 'node_mocha:test']);
grunt.registerTask('coverage', ['typescript:test', 'node_mocha:coverage', 'http-server:coverage']);
grunt.registerTask('run', ['nodemon']);
// Must have installed node-inspector globally 'sudo npm install -g node-inspector'
grunt.registerTask('debug', ['shell:debug']);
};