-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGruntfile.js
More file actions
83 lines (74 loc) · 2.59 KB
/
Gruntfile.js
File metadata and controls
83 lines (74 loc) · 2.59 KB
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
var path = require('path');
module.exports = function(grunt) {
var TEST_RUNNER = path.join(process.cwd(), 'test', 'test_runner');
var ALL_TESTS = 'test/**/*_test.js';
// NPM tasks, alphabetical
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-docco');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-bump');
grunt.initConfig({
// Clean
clean: {
docs: ['docs'],
coverage: ['test/coverage.html']
},
// https://www.npmjs.com/package/grunt-mocha-test
mochaTest: {
test: {
options: {
reporter: 'spec',
require: './test/test_runner',
ui: 'bdd',
timeout: 200
},
src: ['test/**/*_test.js']
}
},
//Bump up version
bump: {
options: {
files: ['package.json'],
updateConfigs: [],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
regExp: false
}
},
// Documentation
docco: {
main: {
src: ['lib/**/*.js'],
options: {
output: 'docs/'
}
}
},
// Watches filesystem for changes to run tasks automatically
watch: {
docco: {
options: { spawn: false },
files: ['lib/**/*.js'],
tasks: ['docco:main']
}
}
});
// Runs all unit tests
grunt.registerTask('test', 'All unit tests', ['mochaTest:test']);
// TODO: Migrate this to https://www.npmjs.com/package/grunt-mocha-test#instrumenting-source-files-with-coverage-data-before-running-tests
// Generates test coverage report
// As a substitute, just use `npm test` instead
// grunt.registerTask('coverage', 'Unit test code coverage', ['clean:coverage', 'mochaTest:instrument', 'mochaTest:coverage']);
// Generates documentation
grunt.registerTask('docs', 'Generate documentation', ['clean:docs', 'docco:main']);
};