mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
tinytest: drop results for a run when requested by client, not onComplete.
Should be useful for a non-browser-based test runner.
This commit is contained in:
@@ -35,13 +35,15 @@ Meteor._runTestsEverywhere = function (onReport, onComplete) {
|
||||
}
|
||||
});
|
||||
|
||||
Meteor.subscribe(Meteor._ServerTestResultsSubscription, runId);
|
||||
var handle = Meteor.subscribe(Meteor._ServerTestResultsSubscription, runId);
|
||||
|
||||
Meteor.call('tinytest/run', runId, function (error, result) {
|
||||
if (error)
|
||||
// XXX better report error
|
||||
throw new Error("Test server returned an error");
|
||||
remoteComplete = true;
|
||||
handle.stop();
|
||||
Meteor.call('tinytest/clearResults', runId);
|
||||
maybeDone();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -48,17 +48,21 @@
|
||||
};
|
||||
|
||||
var onComplete = function() {
|
||||
_.each(handlesForRun[runId], function (handle) {
|
||||
handle.stop();
|
||||
});
|
||||
delete handlesForRun[runId];
|
||||
delete reportsForRun[runId];
|
||||
future.ret();
|
||||
};
|
||||
|
||||
Meteor._runTests(onReport, onComplete);
|
||||
|
||||
future.wait();
|
||||
},
|
||||
'tinytest/clearResults': function (runId) {
|
||||
_.each(handlesForRun[runId], function (handle) {
|
||||
// XXX this doesn't actually notify the client that it has been
|
||||
// unsubscribed.
|
||||
handle.stop();
|
||||
});
|
||||
delete handlesForRun[runId];
|
||||
delete reportsForRun[runId];
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
Reference in New Issue
Block a user