-
Notifications
You must be signed in to change notification settings - Fork 12
/
buildJSTDConfiguration.js
executable file
·50 lines (39 loc) · 1.41 KB
/
buildJSTDConfiguration.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
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('jstd');
var data = 'server: http://localhost:9876\n\n',
sources = '',
specs = '';
var loadSource = function(object, base){
for (var j = 0; j < object.length; j++)
sources += ' - "../' + (base || '') + object[j] + '.js"\n';
};
var loadSpec = function(object, base){
for (var j = 0; j < object.length; j++)
specs += ' - "../' + (base || '') + object[j] + '.js"\n';
};
loadSource([
'Runner/Jasmine/jasmine',
'Runner/JSTD-Adapter/src/JasmineAdapter',
'Runner/Helpers/Syn',
'Runner/Helpers/JSSpecToJasmine',
'Runner/Helpers/Sinon.JS/lib/sinon',
'Runner/Helpers/Sinon.JS/lib/sinon/util/fake_xml_http_request',
'Runner/Helpers/Sinon.JS/lib/sinon/util/xhr_ie',
'Runner/Helpers/Sinon.JS/lib/sinon/util/fake_timers',
'Runner/Helpers/Sinon.JS/lib/sinon/util/timers_ie',
]);
SpecLoader.setSourceLoader(loadSource).setSpecLoader(loadSpec).run();
data += 'load:\n' + sources + '\n';
data += 'test:\n' + specs + '\n';
// TODO check why JSTD Coverage fails
if (options.coverage){
data += 'plugin:\n';
data += ' - name: "coverage"\n';
data += ' jar: "JSTestDriver/plugins/coverage.jar"\n';
}
var fs = require('fs');
fs.writeFile('./jsTestDriver.conf', data);