forked from SparkPost/node-sparkpost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
77 lines (69 loc) · 1.96 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
var matchdep = require('matchdep')
, gruntTimer = require('time-grunt');
module.exports = function(grunt) {
// Dynamically load any preexisting grunt tasks/modules
matchdep.filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Pretty timing on grunt commands
gruntTimer(grunt);
var config = {
binPath: './node_modules/.bin'
};
var reporter = grunt.option('reporter') || 'xunit-file';
// Configure existing grunt tasks and create custom ones
grunt.initConfig({
config: config,
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: [
'index.js',
'lib/{,*/}*.js',
'examples/{,*/}*.js'
],
options: {
reporter: require('jshint-stylish'),
jshintrc: './.jshintrc'
}
},
bump: {
options: {
files: [ 'package.json' ]
, updateConfigs: [ 'pkg' ]
, commit: true
, commitMessage: 'Release %VERSION%'
, commitFiles: [ 'package.json', 'CHANGELOG.md' ]
, createTag: true
, tagName: '%VERSION%'
, tagMessage: '%VERSION%'
, push: true
, pushTo: 'upstream'
, gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
}
},
shell: {
test: {
command : '<%= config.binPath %>/istanbul cover --report lcov --dir test/reports/ <%= config.binPath %>/_mocha test/spec -- --reporter ' + reporter,
options : {
stdout : true,
failOnError : true
}
}
},
coveralls: {
options: {
force: true
},
grunt_coveralls_coverage: {
src: 'test/reports/lcov.info'
}
}
});
// grunt lint - leverages grunt-contrib-jshint command, lints our code
grunt.registerTask('lint', [ 'jshint' ]);
// grunt test - runs linting and then our unit tests
grunt.registerTask('test', [
'lint',
'shell:test'
]);
// register default grunt command as grunt test
grunt.registerTask('default', [ 'test' ]);
};