forked from lfryc/grunt-external-daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
142 lines (131 loc) · 3.35 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
* grunt-external-daemon
* https://github.com/jlindsey/grunt-external-daemon
*
* Copyright (c) 2013 Joshua Lindsey
* Licensed under the MIT license.
*/
'use strict';
var fs = require('fs');
module.exports = function(grunt) {
grunt.initConfig({
clean: {
test: ['test/TEST_SUCCESSFUL', 'test/SIGTERM', 'test/SIGUSR2', 'test/OUTPUT']
},
jshint: {
options: {
"laxcomma": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"node": true,
"es5": true
},
files: ['Gruntfile.js', 'tasks/*.js', 'test/**/*.js']
},
// Configs for testing
external_daemon: {
server_1: {
options: {
startCheckInterval: 1.0,
startCheck: function(stdout, stderr) {
return (stdout.indexOf("Listening on 8123") > -1);
}
},
cmd: 'node',
args: ['test/fixtures/server_1.js']
},
server_2: {
options: {
startCheck: function(stdout, stderr) {
return (stdout.indexOf("Listening on 8234") > -1);
},
startCheckTimeout: 1.0
},
cmd: 'node',
args: ['test/fixtures/server_2.js']
},
server_2a: {
options: {
startCheck: function() { return false; },
startCheckTimeout: false
},
cmd: 'node',
args: ['test/fixtures/server_2.js']
},
server_3: {
options: {
verbose: true,
startCheck: function() { return false; },
startCheckTimeout: 5.0
},
cmd: 'node',
args: ['test/fixtures/server_3.js']
},
server_4: {},
server_4a: {
cmd: 'echo',
args: 'hello'
},
server_4b: {
options: {
startCheck: false
},
cmd: 'echo'
},
signal_server_1: {
cmd: 'node',
args: ['test/fixtures/signal_server.js']
},
signal_server_2: {
options: {
killSignal: 'SIGUSR2'
},
cmd: 'node',
args: ['test/fixtures/signal_server.js']
},
output_server_1: {
options: {
startCheck: function (stdout) { return (stdout.indexOf('STDOUT Message') > -1); },
stdout: fs.openSync('test/OUTPUT', 'w')
},
cmd: 'node',
args: ['test/fixtures/output_server.js']
},
output_server_2: {
options: {
startCheck: function (stdout) { return (stdout.indexOf('STDOUT Message') > -1); },
stderr: fs.openSync('test/OUTPUT', 'w')
},
cmd: 'node',
args: ['test/fixtures/output_server.js']
}
},
nodeunit: {
all: ['test/*_test.js']
},
watch: {
jshint: {
files: ['<%= jshint.files %>'],
tasks: ['default'],
options: {
interrupt: true
}
}
}
});
grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['clean', 'jshint', 'nodeunit', 'clean']);
grunt.registerTask('dev', ['default', 'watch']);
};