1 define([ 'util/ensureCallback', 'util/chainAsync' ], function (ensureCallback
, chainAsync
) {
3 run
: function run(name
, test
, callbacks
) {
4 var stepCallback
= callbacks
.step
|| function () { };
5 var doneCallback
= ensureCallback(callbacks
.done
);
7 if (typeof test
=== 'function') {
8 // We run the test twice (sadly): once to warm up the JIT and once for the actual test.
9 //test(function (_, _) {
10 test(function (err
, results
) {
11 stepCallback(err
, name
, results
);
12 doneCallback(err
, results
);
18 var subTests
= Object
.keys(test
).map(function (subName
) {
19 var newName
= name
? name
+ '.' + subName
: subName
;
20 return function (next
) {
21 testRunner
.run(newName
, test
[subName
], {
23 done: function (err
, results
) {
25 allResults
[subName
] = results
;
34 chainAsync(subTests
.concat([
36 doneCallback(null, allResults
);