jasmine/lib/json_reporter.js

26 lines
522 B
JavaScript
Raw Normal View History

JasmineReporters.JSON = function (elementId) {
2008-12-04 18:56:58 +00:00
var that = {
elementId: elementId,
2008-12-04 18:56:58 +00:00
results: {},
addResults: function (results) {
that.results = results;
},
report: function () {
var output = Object.toJSON(that.results);
if (that.elementId) {
var element = document.getElementById(that.elementId);
if (element) {
element.innerHTML = output;
}
}
return output;
2008-12-04 18:56:58 +00:00
}
}
return that;
}
Jasmine.reporter = JasmineReporters.JSON();