-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathGruntfile.js
85 lines (78 loc) · 2.93 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
/*jslint node: true */
"use strict";
const c8 = "npx c8 -x Gruntfile.js -x 'test/**'";
module.exports = function (grunt)
{
grunt.initConfig(
{
eslint: {
target: [
'Gruntfile.js',
'index.js',
'lib/*.js',
'test/**/*.js',
'bench/**/*.js'
]
},
mochaTest: {
default: {
src: [
'test/common.js',
'test/test_spec.js',
'test/lock_spec.js',
...(process.platform === 'win32' ? [] : ['test/disruptor_streams_spec.js'])
]
},
stress: {
src: [
'test/common.js',
'test/multiple_queues_spec.js'
]
},
multi: {
src: [
'test/common.js',
'test/rabbitmq_bindings.js',
'test/rabbitmq_spec.js'
]
},
options: {
bail: true
}
},
apidox: {
input: ['lib/qlobber-fsq.js', 'lib/events_doc.js'],
output: 'README.md',
fullSourceDescription: true,
extraHeadingLevels: 1,
sections: {
'QlobberFSQ': '\n## Constructor',
'QlobberFSQ.prototype.subscribe': '\n## Publish and subscribe',
'QlobberFSQ.prototype.stop_watching': '\n## Lifecycle',
'QlobberFSQ.events.start': '\n## Events'
},
doxOptions: { skipSingleStar: true }
},
exec: Object.fromEntries(Object.entries({
cover: `${c8} grunt test ${process.argv.slice(3).join(' ')}`,
cover_report: `${c8} report -r lcov`,
cover_check: `${c8} check-coverage --statements 90 --branches 85 --functions 95 --lines 95`,
bench: `npx bench -c 1 -i bench/implementations/qlobber-fsq.js --data "${Buffer.from(JSON.stringify(process.argv.slice(3))).toString('hex')}"`,
diagrams: 'dot diagrams/how_it_works.dot -Tsvg -odiagrams/how_it_works.svg'
}).map(([k, cmd]) => [k, { cmd, stdio: 'inherit' }]))
});
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-apidox');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('lint', 'eslint');
grunt.registerTask('test', 'mochaTest:default');
grunt.registerTask('test-stress', 'mochaTest:stress');
grunt.registerTask('test-multi', 'mochaTest:multi');
grunt.registerTask('docs', ['exec:diagrams', 'apidox']);
grunt.registerTask('coverage', ['exec:cover',
'exec:cover_report',
'exec:cover_check']);
grunt.registerTask('bench', 'exec:bench');
grunt.registerTask('default', ['lint', 'mochaTest:default']);
};