-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathcuke-watcher.js
More file actions
34 lines (25 loc) · 823 Bytes
/
Copy pathcuke-watcher.js
File metadata and controls
34 lines (25 loc) · 823 Bytes
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
#!/usr/bin/env node
var watch = require('node-watch');
var child_process = require('child_process');
var running = false;
var cucumber;
var JS_EXT = /^.*\.js/i;
var options = ['node_modules/.bin/cucumber-js',
'features',
'-r', 'features/step_definitions',
'-f', 'pretty'];
watch(['./features/step_definitions', './script'], {recursive:true}, function(filename) {
if(!running && filename.match(JS_EXT)) {
running = true;
cucumber = child_process.spawn('node', options)
.on('exit', function() {
running = false;
});
cucumber.stdout.on('data', function(d) {
console.log(String(d));
});
cucumber.stderr.on('data', function(d) {
console.error(String(d));
});
}
});