forked from theintern/intern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
71 lines (61 loc) · 1.58 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
define([
'require',
'dojo/Deferred',
'./lib/args',
'./lib/util'
], function (require, Deferred, args, util) {
return {
/**
* The mode in which Intern is currently running. Either 'client' or 'runner'.
*/
mode: null,
/**
* The arguments received from the environment for the current test run.
*/
args: args,
/**
* The configuration data in use for the current test run.
*/
config: null,
/**
* 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: [],
/**
* The tunnel for the current Selenium provider.
*/
tunnel: null,
/*
* A regular expression that will be used to filter tests. Only tests with IDs matching the expression will be
* executed. By default, all tests will be executed.
*/
grep: /.*/,
/**
* 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();
}
});
}));
return dfd.promise;
},
/**
* AMD plugin API interface for easy loading of test interfaces.
*/
load: function (id, parentRequire, callback) {
require([ './lib/interfaces/' + id ], callback);
}
};
});