-
Notifications
You must be signed in to change notification settings - Fork 18
/
run-node.js
52 lines (45 loc) · 1.35 KB
/
run-node.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
/*jshint node:true, browser:false */
var jasmineRequire = require('jasmine-core/lib/jasmine-core/jasmine.js');
var JasmineConsoleReporter = require('jasmine-console-reporter');
var Montage = require('montage');
var PATH = require("path");
// Init
var jasmine = jasmineRequire.core(jasmineRequire);
var jasmineEnv = jasmine.getEnv();
// Export interface
var jasmineInterface = jasmineRequire.interface(jasmine, jasmineEnv);
global.jasmine = jasmine;
global.jasmineRequire = jasmineRequire;
for (var property in jasmineInterface) {
if (jasmineInterface.hasOwnProperty(property)) {
global[property] = jasmineInterface[property];
}
}
// Default reporter
jasmineEnv.addReporter(jasmineInterface.jsApiReporter);
// Html reporter
var consoleReporter = new JasmineConsoleReporter({
colors: 1,
cleanStack: 1,
verbosity: 4,
listStyle: 'indent',
activity: false
});
jasmineEnv.addReporter(consoleReporter);
// Exit code
var exitCode = 0;
jasmineEnv.addReporter({
specDone: function(result) {
exitCode = exitCode || result.status === 'failed';
}
});
// Execute
Montage.loadPackage(PATH.join(__dirname, "."), {
mainPackageLocation: PATH.join(__dirname, "../")
})
.then(function (mr) {
return mr.async("all");
}).then(function () {
console.log('Done');
process.exit(exitCode);
}).thenReturn();