-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner.js
55 lines (41 loc) · 1.35 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
var _ = require('./node_modules/lodash/lodash');
var curl = require('./node_modules/curl-amd/dist/curl-for-ssjs/curl');
var walk = require('./src/walker').walk;
var path = require('path');
exports.matchJsFiles = function(p) {
return p.match(/.*.js$/);
};
exports.mapFile = function(p) {
return {
name: path.basename(p, '.js'),
path: p
};
};
exports.run = function(baseconf) {
walk(path.join(baseconf.baseUrl, baseconf.testRoot), function(err, results) {
if (err) throw err;
var tests =
_.chain(results)
.filter(baseconf.includeTestFileFn||exports.matchJsFiles)
.map(baseconf.testFileMappingFn||exports.mapFile).value();
_.each(tests, function(desc) {
baseconf.paths[desc.name] = desc.path;
});
curl.config(baseconf);
var paramArr = _.reduce(tests, function(acc, elem) {
acc.push(elem.name);
return acc;
}, []);
define("app", paramArr, function() {});
curl("app").then(start, fail);
function start() {
// No need to do anything
}
function fail(ex) {
console.log("Something went wrong (", __filename, "):\n",
ex,
"\nUsed conf:\n",
baseconf);
}
});
};