Files
meteor/packages/tinytest/tinytest_server.js
Geoff Schmidt f41d692cf5 method invocation context object
(including support for async methods, server-side
method ordering, running simulated methods
correctly)
2012-02-29 00:42:38 -08:00

27 lines
643 B
JavaScript

Meteor.startup(function () {
Meteor._ServerTestResults.remove();
});
App.publish('tinytest/results', {
collection: Meteor._ServerTestResults,
selector: function (params) { return {run_id: params.run_id} }
});
App.methods({
'tinytest/run': function (run_id) {
var request = this;
request.beginAsync();
var reportFunc = function (report) {
Meteor._ServerTestResults.insert({run_id: run_id, report: report});
};
var testRun = Meteor._TestManager.createRun(reportFunc);
test._currentRun.withValue(testRun, function () {
testRun.run(function () {
request.respond();
});
});
}
});