dwf/rva: refactor reporter abstract and jasmine into three distinct report functions for specs, suites, and runners.
This commit is contained in:
parent
665c3e9f33
commit
1450eb5b65
52
jasmine.iws
52
jasmine.iws
|
@ -92,7 +92,7 @@
|
||||||
<file leaf-file-name="json_reporter.js" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="json_reporter.js" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
|
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
<state line="22" column="3" selection-start="581" selection-end="581" vertical-scroll-proportion="0.40425533">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -101,16 +101,16 @@
|
||||||
<file leaf-file-name="bootstrap.js" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="bootstrap.js" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
|
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="690" column="388" selection-start="20624" selection-end="20624" vertical-scroll-proportion="0.018645732">
|
<state line="693" column="63" selection-start="20819" selection-end="20819" vertical-scroll-proportion="0.55937195">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="jasmine.js" pinned="false" current="true" current-in-tab="true">
|
<file leaf-file-name="jasmine.js" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
|
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="333" column="0" selection-start="6862" selection-end="6862" vertical-scroll-proportion="0.76112187">
|
<state line="320" column="0" selection-start="6758" selection-end="6758" vertical-scroll-proportion="0.58531743">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="example.js" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="example.js" pinned="false" current="true" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/example/example.js">
|
<entry file="file://$PROJECT_DIR$/example/example.js">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="6" column="0" selection-start="183" selection-end="183" vertical-scroll-proportion="0.11025145">
|
<state line="6" column="0" selection-start="183" selection-end="183" vertical-scroll-proportion="0.11025145">
|
||||||
|
@ -534,6 +534,27 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="320" column="0" selection-start="6758" selection-end="6758" vertical-scroll-proportion="0.58531743">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="22" column="3" selection-start="581" selection-end="581" vertical-scroll-proportion="0.40425533">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="693" column="63" selection-start="20819" selection-end="20819" vertical-scroll-proportion="0.55937195">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/example/example.js">
|
<entry file="file://$PROJECT_DIR$/example/example.js">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="6" column="0" selection-start="183" selection-end="183" vertical-scroll-proportion="0.11025145">
|
<state line="6" column="0" selection-start="183" selection-end="183" vertical-scroll-proportion="0.11025145">
|
||||||
|
@ -541,27 +562,6 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="690" column="388" selection-start="20624" selection-end="20624" vertical-scroll-proportion="0.018645732">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="333" column="0" selection-start="6862" selection-end="6862" vertical-scroll-proportion="0.76112187">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
|
@ -204,8 +204,7 @@ var it = function (description, func) {
|
||||||
|
|
||||||
finishCallback: function () {
|
finishCallback: function () {
|
||||||
if (Jasmine.reporter) {
|
if (Jasmine.reporter) {
|
||||||
Jasmine.reporter.addSpecResults(that.results);
|
Jasmine.reporter.reportSpecResults(that.results);
|
||||||
Jasmine.reporter.report();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -278,6 +277,12 @@ var describe = function (description, spec_definitions) {
|
||||||
|
|
||||||
that.results.description = description;
|
that.results.description = description;
|
||||||
|
|
||||||
|
that.finishCallback = function () {
|
||||||
|
if (Jasmine.reporter) {
|
||||||
|
Jasmine.reporter.reportSuiteResults(that.results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,8 +294,7 @@ var Runner = function () {
|
||||||
|
|
||||||
that.finishCallback = function () {
|
that.finishCallback = function () {
|
||||||
if (that.reporter) {
|
if (that.reporter) {
|
||||||
that.reporter.addResults(that.results);
|
that.reporter.reportRunnerResults(that.results);
|
||||||
that.reporter.report();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,16 +313,12 @@ JasmineReporters.reporter = function (elementId) {
|
||||||
element: document.getElementById(elementId),
|
element: document.getElementById(elementId),
|
||||||
output: '',
|
output: '',
|
||||||
|
|
||||||
addResults: function (results) { that.output = ''; },
|
reportRunnerResults: function (results) { that.output += ''; },
|
||||||
|
|
||||||
addSpecResults: function (results) { that.output = ''; },
|
reportSuiteResults: function (results) { that.output += ''; },
|
||||||
|
|
||||||
|
reportSpecResults: function (results) { that.output += ''; },
|
||||||
|
|
||||||
report: function () {
|
|
||||||
if (that.element) {
|
|
||||||
that.element.innerHTML += that.output;
|
|
||||||
}
|
|
||||||
return that.output;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: throw if no element?
|
// TODO: throw if no element?
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
JasmineReporters.JSON = function (elementId) {
|
JasmineReporters.JSON = function (elementId) {
|
||||||
var that = JasmineReporters.reporter(elementId);
|
var that = JasmineReporters.reporter(elementId);
|
||||||
|
|
||||||
that.addResults = function (results) {
|
that.reportRunnerResults = function (results) {
|
||||||
that.output = Object.toJSON(results);
|
that.output = Object.toJSON(results);
|
||||||
|
|
||||||
|
if (that.element) {
|
||||||
|
that.element.innerHTML += that.output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
@ -11,9 +15,13 @@ JasmineReporters.JSON = function (elementId) {
|
||||||
JasmineReporters.IncrementalJSON = function (elementId) {
|
JasmineReporters.IncrementalJSON = function (elementId) {
|
||||||
var that = JasmineReporters.reporter(elementId);
|
var that = JasmineReporters.reporter(elementId);
|
||||||
|
|
||||||
that.addSpecResults = function (results) {
|
that.reportSpecResults = function (results) {
|
||||||
that.output = Object.toJSON(results);
|
that.output = Object.toJSON(results);
|
||||||
|
if (that.element) {
|
||||||
|
that.element.innerHTML += that.output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue