Rebuild jasmine.js
This commit is contained in:
parent
2a4241323d
commit
bc790d6b87
|
@ -40,12 +40,16 @@ jasmine.MessageResult = function(text) {
|
||||||
|
|
||||||
jasmine.ExpectationResult = function(passed, message, details) {
|
jasmine.ExpectationResult = function(passed, message, details) {
|
||||||
this.type = 'ExpectationResult';
|
this.type = 'ExpectationResult';
|
||||||
this.passed = passed;
|
this.passed_ = passed;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.details = details;
|
this.details = details;
|
||||||
this.trace = new Error(message); // todo: test better
|
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
|
* Getter for the Jasmine environment. Ensures one gets created
|
||||||
*/
|
*/
|
||||||
|
@ -1240,7 +1244,7 @@ jasmine.NestedResults.prototype.addResult = function(result) {
|
||||||
this.rollupCounts(result);
|
this.rollupCounts(result);
|
||||||
} else {
|
} else {
|
||||||
this.totalCount++;
|
this.totalCount++;
|
||||||
if (result.passed) {
|
if (result.passed()) {
|
||||||
this.passedCount++;
|
this.passedCount++;
|
||||||
} else {
|
} else {
|
||||||
this.failedCount++;
|
this.failedCount++;
|
||||||
|
@ -1437,9 +1441,11 @@ jasmine.Queue.prototype.finish = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.getResults = function () {
|
jasmine.Queue.prototype.getResults = function () {
|
||||||
var results = [];
|
var results = new jasmine.NestedResults();
|
||||||
for (var i = 0; i < this.blocks.length; i++) {
|
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;
|
return results;
|
||||||
};
|
};
|
||||||
|
@ -1488,6 +1494,7 @@ jasmine.Runner = function(env) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.env = env;
|
self.env = env;
|
||||||
self.queue = new jasmine.Queue(env);
|
self.queue = new jasmine.Queue(env);
|
||||||
|
self.suites = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Runner.prototype.execute = function() {
|
jasmine.Runner.prototype.execute = function() {
|
||||||
|
@ -1495,51 +1502,33 @@ jasmine.Runner.prototype.execute = function() {
|
||||||
if (self.env.reporter.reportRunnerStarting) {
|
if (self.env.reporter.reportRunnerStarting) {
|
||||||
self.env.reporter.reportRunnerStarting(this);
|
self.env.reporter.reportRunnerStarting(this);
|
||||||
}
|
}
|
||||||
self.queue.start(function () { self.finishCallback(); });
|
self.queue.start(function () {
|
||||||
|
self.finishCallback();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Runner.prototype.finishCallback = function() {
|
jasmine.Runner.prototype.finishCallback = function() {
|
||||||
this.env.reporter.reportRunnerResults(this);
|
this.env.reporter.reportRunnerResults(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jasmine.Runner.prototype.addSuite = function(suite) {
|
||||||
|
this.suites.push(suite);
|
||||||
|
};
|
||||||
|
|
||||||
jasmine.Runner.prototype.add = function(block) {
|
jasmine.Runner.prototype.add = function(block) {
|
||||||
|
if (block instanceof jasmine.Suite) {
|
||||||
|
this.addSuite(block);
|
||||||
|
}
|
||||||
this.queue.add(block);
|
this.queue.add(block);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
jasmine.Runner.prototype.getAllSuites = function() {
|
jasmine.Runner.prototype.getAllSuites = function() {
|
||||||
var suitesToReturn = [];
|
return this.suites;
|
||||||
|
|
||||||
function addSuite(suite) {
|
|
||||||
suitesToReturn.push(suite);
|
|
||||||
|
|
||||||
for (var j = 0; j < suite.specs.length; j++) {
|
|
||||||
var spec = suite.specs[j];
|
|
||||||
if (spec instanceof jasmine.Suite) {
|
|
||||||
addSuite(spec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < this.suites.length; i++) {
|
|
||||||
var suite = this.suites[i];
|
|
||||||
addSuite(suite);
|
|
||||||
}
|
|
||||||
|
|
||||||
return suitesToReturn;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Runner.prototype.getResults = function() {
|
jasmine.Runner.prototype.getResults = function() {
|
||||||
var results = new jasmine.NestedResults();
|
return this.queue.getResults();
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Internal representation of a Jasmine specification, or test.
|
* Internal representation of a Jasmine specification, or test.
|
||||||
|
@ -1557,7 +1546,6 @@ jasmine.Spec = function(env, suite, description) {
|
||||||
spec.description = description;
|
spec.description = description;
|
||||||
spec.queue = new jasmine.Queue(env);
|
spec.queue = new jasmine.Queue(env);
|
||||||
|
|
||||||
spec.finished = false;
|
|
||||||
spec.afterCallbacks = [];
|
spec.afterCallbacks = [];
|
||||||
spec.spies_ = [];
|
spec.spies_ = [];
|
||||||
|
|
||||||
|
@ -1660,8 +1648,7 @@ jasmine.Spec.prototype.execute = function(onComplete) {
|
||||||
var spec = this;
|
var spec = this;
|
||||||
if (!spec.env.specFilter(spec)) {
|
if (!spec.env.specFilter(spec)) {
|
||||||
spec.results.skipped = true;
|
spec.results.skipped = true;
|
||||||
spec.finishCallback();
|
spec.finish(onComplete);
|
||||||
spec.finished = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1783,6 +1770,9 @@ jasmine.Suite.prototype.getResults = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Suite.prototype.add = function(block) {
|
jasmine.Suite.prototype.add = function(block) {
|
||||||
|
if (block instanceof jasmine.Suite) {
|
||||||
|
this.env.currentRunner.addSuite(block);
|
||||||
|
}
|
||||||
this.queue.add(block);
|
this.queue.add(block);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue