-
Notifications
You must be signed in to change notification settings - Fork 12
/
runner.js
executable file
·63 lines (47 loc) · 1.59 KB
/
runner.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
#!/usr/bin/env node
// Runs Specs in NodeJS
var puts = require('sys').puts;
var options = require('./Helpers/RunnerOptions').parseOptions(process.argv[2]);
if (!options) return;
// Initialize
var loader = require('./Helpers/Loader');
var SpecLoader = loader.SpecLoader(require('../Configuration').Configuration, options);
SpecLoader.setEnvName('nodejs');
// set method to require all the sourcefiles and append the objects to this object
var self = this;
var append = function(original){
for (var i = 1, l = arguments.length; i < l; i++){
var extended = arguments[i] || {};
for (var key in extended) original[key] = extended[key];
}
return original;
};
SpecLoader.setSourceLoader(function(object, base){
for (var j = 0; j < object.length; j++){
if (object[j] == 'Slick/Slick.Parser'){
Slick = require('../' + (base || '') + object[j]).Slick;
append(self, Slick);
} else {
append(self, require('../' + (base || '') + object[j]));
}
}
});
// Set method to get all the spec files
var specs = [];
SpecLoader.setSpecLoader(function(object, base){
for (var j = 0; j < object.length; j++)
specs.push(__dirname + '/../' + (base || '') + object[j]);
});
// Run loader
SpecLoader.run();
// Fire jasmine
var jasmine = require('./Jasmine-Node/lib/jasmine'),
sys = require('sys');
for(var key in jasmine)
global[key] = jasmine[key];
require('./Helpers/JSSpecToJasmine');
var reporter = require('./Jasmine-Node/lib/reporters/' + (options.reporter || 'console')).Reporter;
reporter.done = function(runner, log){
process.exit(runner.results().failedCount);
};
jasmine.runSpecs(specs, reporter);