-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsentry
executable file
·36 lines (32 loc) · 1.13 KB
/
sentry
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
#!/usr/bin/env node
var sentry = require("sentry");
var sys = require('util');
var exec = require('child_process').exec;
console.log("Sentry is watching for changes in the project.");
//Check for changes on the source files and test them if there is any.
sentry.watch("src/*.js", function(filename){
console.log("Source file " + filename + " modified, running unit test...");
var test_filename = filename.replace(".js", ".spec.js").replace("src/", "spec/unit/");
exec("jasmine-node " + test_filename, function (error, stdout, stderr) {
sys.print(stdout);
if (error === null) {
//Run all tests.
exec("jasmine-node spec/", function (error, stdout, stderr) {
sys.print(stdout);
});
}
});
});
//Check for changes on the test files and test them if there is any.
sentry.watch("spec/unit/*.spec.js", function(filename){
console.log("Test file " + filename + " modified, running test...");
exec("jasmine-node " + filename, function (error, stdout, stderr) {
sys.print(stdout);
if (error === null) {
//Run all tests.
exec("jasmine-node spec/", function (error, stdout, stderr) {
sys.print(stdout);
});
}
});
});