Rewrite Spec & allow Jasmine to be namespaced
- THere seems to be a performance regression. Large test suites may throw - Regressions: Mock Clock won't install correctly, async specs are temporarily not supported. - Async spec runs/waits interface is gone. Blocks are gone. - Move most global usage into jasmine.Env constructor. - Remove optional 'Jasmine running' from HtmlReporter -- caused NS_FACTORY_ERROR in firefox when tested
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
jasmine.JsApiReporter = function() {
|
||||
jasmine.JsApiReporter = function(jasmine) {
|
||||
this.jasmine = jasmine || {};
|
||||
this.started = false;
|
||||
this.finished = false;
|
||||
this.suites_ = [];
|
||||
@@ -23,7 +24,7 @@ jasmine.JsApiReporter.prototype.suites = function() {
|
||||
};
|
||||
|
||||
jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
||||
var isSuite = suiteOrSpec instanceof jasmine.Suite;
|
||||
var isSuite = suiteOrSpec instanceof this.jasmine.Suite;
|
||||
var summary = {
|
||||
id: suiteOrSpec.id,
|
||||
name: suiteOrSpec.description,
|
||||
@@ -44,10 +45,6 @@ jasmine.JsApiReporter.prototype.results = function() {
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) {
|
||||
return this.results_[specId];
|
||||
};
|
||||
|
||||
//noinspection JSUnusedLocalSymbols
|
||||
jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
|
||||
this.finished = true;
|
||||
@@ -58,10 +55,11 @@ jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
|
||||
};
|
||||
|
||||
//noinspection JSUnusedLocalSymbols
|
||||
jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
|
||||
this.results_[spec.id] = {
|
||||
messages: spec.results().getItems(),
|
||||
result: spec.results().failedCount > 0 ? "failed" : "passed"
|
||||
jasmine.JsApiReporter.prototype.reportSpecResults = function(result) {
|
||||
this.results_[result.id] = {
|
||||
messages: result.failedExpectations,
|
||||
//result is status
|
||||
result: result.status
|
||||
};
|
||||
};
|
||||
|
||||
@@ -69,6 +67,7 @@ jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
|
||||
jasmine.JsApiReporter.prototype.log = function(str) {
|
||||
};
|
||||
|
||||
//TODO: make work with new presenter.
|
||||
jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
|
||||
var results = {};
|
||||
for (var i = 0; i < specIds.length; i++) {
|
||||
@@ -83,14 +82,16 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
|
||||
var messagesLength = result.messages.length;
|
||||
for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
|
||||
var resultMessage = result.messages[messageIndex];
|
||||
//TODO: use result presenter here, not a bunch of spec crap
|
||||
summaryMessages.push({
|
||||
text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
|
||||
//TODO: remove text.
|
||||
text: resultMessage.type == 'log' ? resultMessage.toString() : this.jasmine.undefined,
|
||||
//TODO: wat? in theory this is saying non-expect results should always be considered passed, but that's weird.
|
||||
passed: resultMessage.passed || true,
|
||||
passed: resultMessage.passed || true, //status === 'passed'
|
||||
type: resultMessage.type,
|
||||
message: resultMessage.message,
|
||||
trace: {
|
||||
stack: !resultMessage.passed ? resultMessage.trace.stack : jasmine.undefined
|
||||
stack: !resultMessage.passed ? resultMessage.trace.stack : this.jasmine.undefined
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user