forked from theintern/intern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
47 lines (42 loc) · 1.1 KB
/
main.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
define([
'require',
'dojo/Deferred',
'./lib/util'
], function (require, Deferred, util) {
return {
/**
* Maximum number of suites to run concurrently. Currently used only by the server-side runner.
*/
maxConcurrency: Infinity,
/**
* Suites to run. Each suite defined here corresponds to a single environment.
*/
suites: [],
/**
* Runs all environmental suites concurrently, with a concurrency limit.
*/
run: function () {
var dfd = new Deferred(),
queue = util.createQueue(this.maxConcurrency),
numSuitesCompleted = 0,
numSuitesToRun = this.suites.length;
this.suites.forEach(queue(function (suite) {
return suite.run().always(function () {
if (++numSuitesCompleted === numSuitesToRun) {
dfd.resolve();
}
else {
console.log('%d environments left to test', numSuitesToRun - numSuitesCompleted);
}
});
}));
return dfd.promise;
},
/**
* AMD plugin API interface for easy loading of test interfaces.
*/
load: function (id, parentRequire, callback) {
require([ './lib/interfaces/' + id ], callback);
}
};
});