-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJakefile.js
More file actions
51 lines (39 loc) · 1.03 KB
/
Jakefile.js
File metadata and controls
51 lines (39 loc) · 1.03 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
var fs = require('fs'),
cp = require('child_process');
function rmdir (dir) {
try {
fs.readdirSync(dir).forEach(function(file){
fs.unlinkSync(dir + '/' + file);
});
fs.rmdirSync(dir);
} catch (e){}
}
desc('Node event machine builder');
task('default', function(params) {
jake.Task['unittest'].execute();
});
task('cleanup', function(){
rmdir('./lib-cov');
rmdir('./test-coverage');
});
task('unittest', function(){
jake.Task['cleanup'].invoke();
require('nodeunit').reporters.default.run(['test']);
})
task('coverage', function(){
jake.Task['cleanup'].execute();
cp.exec('node-jscoverage lib lib-cov', function(err, stdout){
if (err) {
console.log(err.message);
return;
}
try {
fs.mkdirSync('./test-coverage', 0755);
}catch (e){}
var cont ;
cont = fs.readFileSync('test/event_machine.js').toString()
.replace('../lib/event_machine', '../lib-cov/event_machine');
fs.writeFileSync('test-coverage/event_machine.js', cont);
require('nodeunit-coverage/lib/reporter').run(['test-coverage']);
});
})