2009-05-29 03:02:15 +00:00
|
|
|
/**
|
|
|
|
* Runner
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {jasmine.Env} env
|
|
|
|
*/
|
|
|
|
jasmine.Runner = function(env) {
|
2009-08-13 05:12:28 +00:00
|
|
|
var self = this;
|
|
|
|
self.env = env;
|
2009-08-13 14:52:44 +00:00
|
|
|
self.queue = new jasmine.Queue(env);
|
2009-09-28 23:23:21 +00:00
|
|
|
self.before_ = [];
|
|
|
|
self.after_ = [];
|
2009-09-02 14:52:11 +00:00
|
|
|
self.suites_ = [];
|
2009-05-29 03:02:15 +00:00
|
|
|
};
|
|
|
|
|
2009-07-09 01:33:15 +00:00
|
|
|
jasmine.Runner.prototype.execute = function() {
|
2009-08-13 05:12:28 +00:00
|
|
|
var self = this;
|
|
|
|
if (self.env.reporter.reportRunnerStarting) {
|
|
|
|
self.env.reporter.reportRunnerStarting(this);
|
2009-07-09 01:33:15 +00:00
|
|
|
}
|
2009-08-19 14:42:47 +00:00
|
|
|
self.queue.start(function () {
|
|
|
|
self.finishCallback();
|
|
|
|
});
|
2009-07-09 01:33:15 +00:00
|
|
|
};
|
|
|
|
|
2009-09-28 23:23:21 +00:00
|
|
|
jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
|
|
|
|
beforeEachFunction.typeName = 'beforeEach';
|
|
|
|
this.before_.push(beforeEachFunction);
|
|
|
|
};
|
|
|
|
|
|
|
|
jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
|
|
|
|
afterEachFunction.typeName = 'afterEach';
|
|
|
|
this.after_.push(afterEachFunction);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-05-29 03:02:15 +00:00
|
|
|
jasmine.Runner.prototype.finishCallback = function() {
|
2009-07-09 01:01:05 +00:00
|
|
|
this.env.reporter.reportRunnerResults(this);
|
2009-05-29 03:02:15 +00:00
|
|
|
};
|
|
|
|
|
2009-08-19 14:42:47 +00:00
|
|
|
jasmine.Runner.prototype.addSuite = function(suite) {
|
2009-09-02 14:52:11 +00:00
|
|
|
this.suites_.push(suite);
|
2009-08-19 14:42:47 +00:00
|
|
|
};
|
2009-08-11 00:50:03 +00:00
|
|
|
|
2009-08-13 05:12:28 +00:00
|
|
|
jasmine.Runner.prototype.add = function(block) {
|
2009-08-19 14:42:47 +00:00
|
|
|
if (block instanceof jasmine.Suite) {
|
|
|
|
this.addSuite(block);
|
2009-08-11 00:50:03 +00:00
|
|
|
}
|
2009-08-13 05:12:28 +00:00
|
|
|
this.queue.add(block);
|
|
|
|
};
|
|
|
|
|
2009-10-16 01:58:52 +00:00
|
|
|
jasmine.Runner.prototype.specs = function () {
|
|
|
|
var suites = this.suites();
|
|
|
|
var specs = [];
|
|
|
|
for (var i = 0; i < suites.length; i++) {
|
|
|
|
specs = specs.concat(suites[i].specs());
|
|
|
|
}
|
|
|
|
return specs;
|
|
|
|
};
|
|
|
|
|
2009-09-02 14:52:11 +00:00
|
|
|
|
|
|
|
jasmine.Runner.prototype.suites = function() {
|
|
|
|
return this.suites_;
|
2009-08-11 00:50:03 +00:00
|
|
|
};
|
|
|
|
|
2009-09-28 18:13:44 +00:00
|
|
|
jasmine.Runner.prototype.results = function() {
|
|
|
|
return this.queue.results();
|
2009-08-13 05:12:28 +00:00
|
|
|
};
|