mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Allow testAsyncMulti functions to return promises.
This commit is contained in:
@@ -139,16 +139,18 @@ testAsyncMulti = function (name, funcs) {
|
||||
}, timeout);
|
||||
|
||||
test.extraDetails.asyncBlock = i++;
|
||||
try {
|
||||
func.apply(context, [test, _.bind(em.expect, em)]);
|
||||
} catch (exception) {
|
||||
if (em.cancel())
|
||||
|
||||
new Promise(resolve => {
|
||||
resolve(func.apply(context, [test, _.bind(em.expect, em)]));
|
||||
}).then(result => {
|
||||
em.done();
|
||||
}, exception => {
|
||||
if (em.cancel()) {
|
||||
test.exception(exception);
|
||||
// Because we called test.exception, we're not to call onComplete.
|
||||
}
|
||||
Meteor.clearTimeout(timer);
|
||||
// Because we called test.exception, we're not to call onComplete.
|
||||
return;
|
||||
}
|
||||
em.done();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user