Merge in new HTML runner. Tests green, regression on focused running.

This commit is contained in:
ragaskar
2009-08-19 07:42:47 -07:00
20 changed files with 462 additions and 164 deletions

View File

@@ -216,6 +216,16 @@ jasmine.Matchers.prototype.toNotContain = function(item) {
'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.');
};
jasmine.Matchers.prototype.toBeLessThan = function(expected) {
return this.report(this.actual < expected,
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
};
jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
return this.report(this.actual > expected,
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
};
/**
* Matcher that checks that the expected exception was thrown by the actual.
*

View File

@@ -62,7 +62,7 @@ jasmine.NestedResults.prototype.addResult = function(result) {
this.rollupCounts(result);
} else {
this.totalCount++;
if (result.passed) {
if (result.passed()) {
this.passedCount++;
} else {
this.failedCount++;

View File

@@ -59,9 +59,11 @@ jasmine.Queue.prototype.finish = function () {
};
jasmine.Queue.prototype.getResults = function () {
var results = [];
var results = new jasmine.NestedResults();
for (var i = 0; i < this.blocks.length; i++) {
results.push(this.blocks[i].getResults());
if (this.blocks[i].getResults) {
results.addResult(this.blocks[i].getResults());
}
}
return results;
};

View File

@@ -8,6 +8,7 @@ jasmine.Runner = function(env) {
var self = this;
self.env = env;
self.queue = new jasmine.Queue(env);
self.suites = [];
};
jasmine.Runner.prototype.execute = function() {
@@ -15,25 +16,31 @@ jasmine.Runner.prototype.execute = function() {
if (self.env.reporter.reportRunnerStarting) {
self.env.reporter.reportRunnerStarting(this);
}
self.queue.start(function () { self.finishCallback(); });
self.queue.start(function () {
self.finishCallback();
});
};
jasmine.Runner.prototype.finishCallback = function() {
this.env.reporter.reportRunnerResults(this);
};
jasmine.Runner.prototype.addSuite = function(suite) {
this.suites.push(suite);
};
jasmine.Runner.prototype.add = function(block) {
if (block instanceof jasmine.Suite) {
this.addSuite(block);
}
this.queue.add(block);
};
jasmine.Runner.prototype.getAllSuites = function() {
return this.suites;
};
jasmine.Runner.prototype.getResults = function() {
var results = new jasmine.NestedResults();
var runnerResults = this.queue.getResults();
for (var i=0; i < runnerResults.length; i++) {
var suiteResults = runnerResults[i];
for (var j=0; j < suiteResults.length; j++) {
results.rollupCounts(suiteResults[j]);
}
}
return results;
return this.queue.getResults();
};

View File

@@ -50,6 +50,9 @@ jasmine.Suite.prototype.getResults = function() {
};
jasmine.Suite.prototype.add = function(block) {
if (block instanceof jasmine.Suite) {
this.env.currentRunner.addSuite(block);
}
this.queue.add(block);
};

View File

@@ -40,12 +40,16 @@ jasmine.MessageResult = function(text) {
jasmine.ExpectationResult = function(passed, message, details) {
this.type = 'ExpectationResult';
this.passed = passed;
this.passed_ = passed;
this.message = message;
this.details = details;
this.trace = new Error(message); // todo: test better
};
jasmine.ExpectationResult.prototype.passed = function () {
return this.passed_;
};
/**
* Getter for the Jasmine environment. Ensures one gets created
*/