Deprecate getResults() (use results()). Add some unit test coverage for jasmine.Spec. Add some unit test coverage for JsApiReporterSpec.
This commit is contained in:
parent
d09cacebc7
commit
2588368231
@ -165,8 +165,8 @@ module Jasmine
|
||||
sleep 0.1
|
||||
end
|
||||
|
||||
puts @driver.get_eval("window.getResults()")
|
||||
failed_count = @driver.get_eval("window.jasmine.getEnv().currentRunner.getResults().failedCount").to_i
|
||||
puts @driver.get_eval("window.results()")
|
||||
failed_count = @driver.get_eval("window.jasmine.getEnv().currentRunner.results().failedCount").to_i
|
||||
failed_count == 0
|
||||
end
|
||||
|
||||
|
@ -57,17 +57,17 @@ module Jasmine
|
||||
sleep 0.1
|
||||
end
|
||||
|
||||
@suites = eval_js('JSON.stringify(jsApiReporter.suites)')
|
||||
@suites = eval_js('JSON.stringify(jsApiReporter.suites())')
|
||||
end
|
||||
|
||||
def results_for(spec_id)
|
||||
spec_id = spec_id.to_s
|
||||
return @spec_results[spec_id] if @spec_results[spec_id]
|
||||
|
||||
@spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.results[#{spec_id}])")
|
||||
@spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.resultsForSpec(#{spec_id}))")
|
||||
while @spec_results[spec_id].nil? do
|
||||
sleep 0.1
|
||||
@spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.results[#{spec_id}])")
|
||||
@spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.resultsForSpec(#{spec_id}))")
|
||||
end
|
||||
|
||||
@spec_results[spec_id]
|
||||
|
@ -258,7 +258,7 @@ ul.inheritsList
|
||||
</div>
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -300,7 +300,7 @@ ul.inheritsList
|
||||
</div>
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -339,7 +339,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -288,6 +288,33 @@ ul.inheritsList
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Env.html#nextSpecId">nextSpecId</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Env.html#nextSuiteId">nextSuiteId</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Env.html#version">version</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -370,6 +397,102 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="nextSpecId"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>nextSpecId</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="detailList">
|
||||
<dt class="heading">Returns:</dt>
|
||||
|
||||
<dd>a sequential integer starting at 0</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="nextSuiteId"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>nextSuiteId</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="detailList">
|
||||
<dt class="heading">Returns:</dt>
|
||||
|
||||
<dd>a sequential integer starting at 0</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="version"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>version</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="detailList">
|
||||
<dt class="heading">Returns:</dt>
|
||||
|
||||
<dd>an object containing jasmine version build info, if set.</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -384,7 +507,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -316,7 +316,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -316,7 +316,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -700,7 +700,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -316,7 +316,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -288,6 +288,15 @@ ul.inheritsList
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Runner.html#getResults">getResults</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -370,6 +379,31 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="getResults"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>getResults</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -384,7 +418,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -267,6 +267,33 @@ ul.inheritsList
|
||||
|
||||
<!-- ============================== methods summary ======================== -->
|
||||
|
||||
|
||||
|
||||
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class jasmine.Spec.">
|
||||
<caption>Method Summary</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Method Attributes</th>
|
||||
<th scope="col">Method Name and Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Spec.html#getResults">getResults</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================== events summary ======================== -->
|
||||
|
||||
|
||||
@ -328,6 +355,36 @@ ul.inheritsList
|
||||
|
||||
<!-- ============================== method details ========================= -->
|
||||
|
||||
<div class="sectionTitle">
|
||||
Method Detail
|
||||
</div>
|
||||
|
||||
<a name="getResults"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>getResults</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================== event details ========================= -->
|
||||
|
||||
@ -339,7 +396,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);</pre>
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -279,6 +279,15 @@ ul.inheritsList
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Suite.html#getResults">getResults</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
@ -365,6 +374,31 @@ ul.inheritsList
|
||||
Method Detail
|
||||
</div>
|
||||
|
||||
<a name="getResults"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>getResults</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="specCount"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
@ -402,7 +436,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -678,7 +678,7 @@ Jasmine environment.
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -316,7 +316,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Mon Sep 28 2009 11:12:11 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -59,7 +59,7 @@
|
||||
<span class='line'> 52</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 53</span>
|
||||
<span class='line'> 54</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportRunnerResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">runner</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">runner.getResults</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">runner.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">className</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"runner failed"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"runner passed"</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerDiv.setAttribute</span><span class="PUNC">(</span><span class="STRN">"class"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" failure"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
@ -68,7 +68,7 @@
|
||||
<span class='line'> 61</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 62</span>
|
||||
<span class='line'> 63</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportSuiteResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">suite</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suite.getResults</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suite.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'passed'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'failed'</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.totalCount</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// todo: change this to check results.skipped</span><span class="WHIT">
|
||||
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'skipped'</span><span class="PUNC">;</span><span class="WHIT">
|
||||
@ -77,7 +77,7 @@
|
||||
<span class='line'> 70</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 71</span>
|
||||
<span class='line'> 72</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportSpecResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">spec</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 73</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spec.getResults</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 73</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spec.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'passed'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'failed'</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.skipped</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'skipped'</span><span class="PUNC">;</span><span class="WHIT">
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
};
|
||||
|
||||
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
||||
var results = runner.getResults();
|
||||
var results = runner.results();
|
||||
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
|
||||
this.runnerDiv.setAttribute("class", className);
|
||||
var message = results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
|
||||
@ -61,7 +61,7 @@ jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
||||
};
|
||||
|
||||
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
||||
var results = suite.getResults();
|
||||
var results = suite.results();
|
||||
var status = results.passed() ? 'passed' : 'failed';
|
||||
if (results.totalCount == 0) { // todo: change this to check results.skipped
|
||||
status = 'skipped';
|
||||
@ -70,7 +70,7 @@ jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
||||
};
|
||||
|
||||
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
||||
var results = spec.getResults();
|
||||
var results = spec.results();
|
||||
var status = results.passed() ? 'passed' : 'failed';
|
||||
if (results.skipped) {
|
||||
status = 'skipped';
|
||||
|
@ -323,7 +323,7 @@ jasmine.createSpyObj = function(baseName, methodNames) {
|
||||
};
|
||||
|
||||
jasmine.log = function(message) {
|
||||
jasmine.getEnv().currentSpec.getResults().log(message);
|
||||
jasmine.getEnv().currentSpec.log(message);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -517,7 +517,7 @@ jasmine.version_= {
|
||||
"major": 0,
|
||||
"minor": 9,
|
||||
"build": 0,
|
||||
"revision": 1252545255
|
||||
"revision": 1254161532
|
||||
};
|
||||
/**
|
||||
* @namespace
|
||||
@ -610,6 +610,9 @@ jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
|
||||
jasmine.Env.prototype.setInterval = jasmine.setInterval;
|
||||
jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
|
||||
|
||||
/**
|
||||
* @returns an object containing jasmine version build info, if set.
|
||||
*/
|
||||
jasmine.Env.prototype.version = function () {
|
||||
if (jasmine.version_) {
|
||||
return jasmine.version_;
|
||||
@ -618,6 +621,20 @@ jasmine.Env.prototype.version = function () {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns a sequential integer starting at 0
|
||||
*/
|
||||
jasmine.Env.prototype.nextSpecId = function () {
|
||||
return this.nextSpecId_++;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns a sequential integer starting at 0
|
||||
*/
|
||||
jasmine.Env.prototype.nextSuiteId = function () {
|
||||
return this.nextSuiteId_++;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a reporter to receive status updates from Jasmine.
|
||||
* @param {jasmine.Reporter} reporter An object which will receive status updates.
|
||||
@ -678,7 +695,7 @@ jasmine.Env.prototype.it = function(description, func) {
|
||||
|
||||
jasmine.Env.prototype.xit = function(desc, func) {
|
||||
return {
|
||||
id: this.nextSpecId_++,
|
||||
id: this.nextSpecId(),
|
||||
runs: function() {
|
||||
}
|
||||
};
|
||||
@ -820,14 +837,10 @@ jasmine.Block.prototype.execute = function(onComplete) {
|
||||
try {
|
||||
this.func.apply(this.spec);
|
||||
} catch (e) {
|
||||
this.fail(e);
|
||||
this.spec.fail(e);
|
||||
}
|
||||
onComplete();
|
||||
};
|
||||
|
||||
jasmine.Block.prototype.fail = function(e) {
|
||||
this.spec.results.addResult(new jasmine.ExpectationResult(false, jasmine.util.formatException(e), null));
|
||||
};
|
||||
/** JavaScript API reporter.
|
||||
*
|
||||
* @constructor
|
||||
@ -835,8 +848,8 @@ jasmine.Block.prototype.fail = function(e) {
|
||||
jasmine.JsApiReporter = function() {
|
||||
this.started = false;
|
||||
this.finished = false;
|
||||
this.suites = [];
|
||||
this.results = {};
|
||||
this.suites_ = [];
|
||||
this.results_ = {};
|
||||
};
|
||||
|
||||
jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
@ -844,10 +857,14 @@ jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
var suites = runner.suites();
|
||||
for (var i = 0; i < suites.length; i++) {
|
||||
var suite = suites[i];
|
||||
this.suites.push(this.summarize_(suite));
|
||||
this.suites_.push(this.summarize_(suite));
|
||||
}
|
||||
};
|
||||
|
||||
jasmine.JsApiReporter.prototype.suites = function() {
|
||||
return this.suites_;
|
||||
};
|
||||
|
||||
jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
||||
var isSuite = suiteOrSpec instanceof jasmine.Suite
|
||||
var summary = {
|
||||
@ -865,6 +882,14 @@ jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
||||
return summary;
|
||||
};
|
||||
|
||||
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;
|
||||
@ -876,9 +901,9 @@ 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"
|
||||
this.results_[spec.id] = {
|
||||
messages: spec.results().getItems(),
|
||||
result: spec.results().failedCount > 0 ? "failed" : "passed"
|
||||
};
|
||||
};
|
||||
|
||||
@ -890,19 +915,24 @@ jasmine.Matchers = function(env, actual, results) {
|
||||
this.env = env;
|
||||
this.actual = actual;
|
||||
this.passing_message = 'Passed.';
|
||||
this.results = results || new jasmine.NestedResults();
|
||||
this.results_ = results || new jasmine.NestedResults();
|
||||
};
|
||||
|
||||
jasmine.Matchers.pp = function(str) {
|
||||
return jasmine.util.htmlEscape(jasmine.pp(str));
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.getResults = function() {
|
||||
return this.results;
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.results = function() {
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
||||
this.results.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details));
|
||||
this.results_.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details));
|
||||
return result;
|
||||
};
|
||||
|
||||
@ -1464,11 +1494,11 @@ jasmine.Queue.prototype.finish = function () {
|
||||
}
|
||||
};
|
||||
|
||||
jasmine.Queue.prototype.getResults = function () {
|
||||
jasmine.Queue.prototype.results = function () {
|
||||
var results = new jasmine.NestedResults();
|
||||
for (var i = 0; i < this.blocks.length; i++) {
|
||||
if (this.blocks[i].getResults) {
|
||||
results.addResult(this.blocks[i].getResults());
|
||||
if (this.blocks[i].results) {
|
||||
results.addResult(this.blocks[i].results());
|
||||
}
|
||||
}
|
||||
return results;
|
||||
@ -1556,8 +1586,13 @@ jasmine.Runner.prototype.suites = function() {
|
||||
return this.suites_;
|
||||
};
|
||||
|
||||
jasmine.Runner.prototype.results = function() {
|
||||
return this.queue.results();
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Runner.prototype.getResults = function() {
|
||||
return this.queue.getResults();
|
||||
return this.queue.results();
|
||||
};
|
||||
/**
|
||||
* Internal representation of a Jasmine specification, or test.
|
||||
@ -1568,8 +1603,14 @@ jasmine.Runner.prototype.getResults = function() {
|
||||
* @param {String} description
|
||||
*/
|
||||
jasmine.Spec = function(env, suite, description) {
|
||||
if (!env) {
|
||||
throw new Error('jasmine.Env() required');
|
||||
};
|
||||
if (!suite) {
|
||||
throw new Error('jasmine.Suite() required');
|
||||
};
|
||||
var spec = this;
|
||||
spec.id = env.nextSpecId_++;
|
||||
spec.id = env.nextSpecId ? env.nextSpecId() : null;
|
||||
spec.env = env;
|
||||
spec.suite = suite;
|
||||
spec.description = description;
|
||||
@ -1578,8 +1619,8 @@ jasmine.Spec = function(env, suite, description) {
|
||||
spec.afterCallbacks = [];
|
||||
spec.spies_ = [];
|
||||
|
||||
spec.results = new jasmine.NestedResults();
|
||||
spec.results.description = description;
|
||||
spec.results_ = new jasmine.NestedResults();
|
||||
spec.results_.description = description;
|
||||
spec.matchersClass = null;
|
||||
};
|
||||
|
||||
@ -1587,8 +1628,18 @@ jasmine.Spec.prototype.getFullName = function() {
|
||||
return this.suite.getFullName() + ' ' + this.description + '.';
|
||||
};
|
||||
|
||||
|
||||
jasmine.Spec.prototype.results = function() {
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.log = function(message) {
|
||||
return this.results_.log(message);
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Spec.prototype.getResults = function() {
|
||||
return this.results;
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.runs = function (func) {
|
||||
@ -1613,11 +1664,8 @@ jasmine.Spec.prototype.expects_that = function(actual) {
|
||||
return this.expect(actual);
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
jasmine.Spec.prototype.expect = function(actual) {
|
||||
return new (this.getMatchersClass_())(this.env, actual, this.results);
|
||||
return new (this.getMatchersClass_())(this.env, actual, this.results_);
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.waits = function(timeout) {
|
||||
@ -1632,8 +1680,8 @@ jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessag
|
||||
return this;
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.failWithException = function (e) {
|
||||
this.results.addResult(new jasmine.ExpectationResult(false, jasmine.util.formatException(e), null));
|
||||
jasmine.Spec.prototype.fail = function (e) {
|
||||
this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null));
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.getMatchersClass_ = function() {
|
||||
@ -1676,7 +1724,7 @@ jasmine.Spec.prototype.after = function(doAfter, test) {
|
||||
jasmine.Spec.prototype.execute = function(onComplete) {
|
||||
var spec = this;
|
||||
if (!spec.env.specFilter(spec)) {
|
||||
spec.results.skipped = true;
|
||||
spec.results_.skipped = true;
|
||||
spec.finish(onComplete);
|
||||
return;
|
||||
}
|
||||
@ -1759,7 +1807,7 @@ jasmine.Spec.prototype.removeAllSpies = function() {
|
||||
*/
|
||||
jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
|
||||
var self = this;
|
||||
self.id = env.nextSuiteId_++;
|
||||
self.id = env.nextSuiteId ? env.nextSuiteId() : null;
|
||||
self.description = description;
|
||||
self.queue = new jasmine.Queue(env);
|
||||
self.parentSuite = parentSuite;
|
||||
@ -1795,8 +1843,13 @@ jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
|
||||
this.afterQueue.push(afterEachFunction);
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Suite.prototype.getResults = function() {
|
||||
return this.queue.getResults();
|
||||
return this.queue.results();
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.results = function() {
|
||||
return this.queue.results();
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.add = function(block) {
|
||||
@ -1855,7 +1908,7 @@ jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
|
||||
try {
|
||||
latchFunctionResult = self.latchFunction.apply(self.spec);
|
||||
} catch (e) {
|
||||
self.fail(e);
|
||||
self.spec.fail(e);
|
||||
onComplete();
|
||||
return;
|
||||
}
|
||||
@ -1864,7 +1917,7 @@ jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
|
||||
onComplete();
|
||||
} else if (self.totalTimeSpentWaitingForLatch >= self.timeout) {
|
||||
var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen');
|
||||
self.fail({
|
||||
self.spec.fail({
|
||||
name: 'timeout',
|
||||
message: message
|
||||
});
|
||||
|
@ -1,4 +1,22 @@
|
||||
describe("jasmine.Env", function() {
|
||||
|
||||
describe('ids', function () {
|
||||
var env;
|
||||
beforeEach(function() {
|
||||
env = new jasmine.Env();
|
||||
});
|
||||
it('nextSpecId should return consecutive integers, starting at 0', function () {
|
||||
expect(env.nextSpecId()).toEqual(0);
|
||||
expect(env.nextSpecId()).toEqual(1);
|
||||
expect(env.nextSpecId()).toEqual(2);
|
||||
});
|
||||
|
||||
it('nextSuiteId should return consecutive integers, starting at 0', function () {
|
||||
expect(env.nextSuiteId()).toEqual(0);
|
||||
expect(env.nextSuiteId()).toEqual(1);
|
||||
expect(env.nextSuiteId()).toEqual(2);
|
||||
});
|
||||
});
|
||||
describe("reporting", function() {
|
||||
var env;
|
||||
var fakeReporter;
|
||||
|
@ -76,7 +76,7 @@ describe('Exceptions:', function() {
|
||||
suite.execute();
|
||||
fakeTimer.tick(2500);
|
||||
|
||||
var suiteResults = suite.getResults();
|
||||
var suiteResults = suite.results();
|
||||
var specResults = suiteResults.getItems();
|
||||
|
||||
expect(suiteResults.passed()).toEqual(false);
|
||||
|
47
spec/suites/JsApiReporterSpec.js
Normal file
47
spec/suites/JsApiReporterSpec.js
Normal file
@ -0,0 +1,47 @@
|
||||
describe('JsApiReporterSpec', function () {
|
||||
|
||||
|
||||
describe('results', function () {
|
||||
var reporter, spec1, spec2, expectedSpec1Results, expectedSpec2Results;
|
||||
|
||||
beforeEach(function() {
|
||||
var env = new jasmine.Env();
|
||||
var suite = new jasmine.Suite(env);
|
||||
spec1 = new jasmine.Spec(env, suite);
|
||||
spec1.runs(function () {
|
||||
this.expect(true).toEqual(true);
|
||||
});
|
||||
expectedSpec1Results = {
|
||||
messages: spec1.results().getItems(),
|
||||
result: "passed"
|
||||
};
|
||||
spec2 = new jasmine.Spec(env, suite);
|
||||
spec2.runs(function () {
|
||||
this.expect(true).toEqual(false);
|
||||
});
|
||||
expectedSpec2Results = {
|
||||
messages: spec2.results().getItems(),
|
||||
result: "failed"
|
||||
};
|
||||
|
||||
spec1.execute();
|
||||
spec2.execute();
|
||||
|
||||
reporter = new jasmine.JsApiReporter();
|
||||
reporter.reportSpecResults(spec1);
|
||||
reporter.reportSpecResults(spec2);
|
||||
});
|
||||
|
||||
it('resultForSpec() should return the result for the given spec', function () {
|
||||
expect(reporter.resultsForSpec(spec1.id)).toEqual(expectedSpec1Results);
|
||||
expect(reporter.resultsForSpec(spec2.id)).toEqual(expectedSpec2Results);
|
||||
|
||||
});
|
||||
|
||||
it('results() should return a hash of all results, indexed by spec id', function () {
|
||||
expect(reporter.results()[spec1.id]).toEqual(expectedSpec1Results);
|
||||
expect(reporter.results()[spec2.id]).toEqual(expectedSpec2Results);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
@ -12,8 +12,8 @@ describe("jasmine.Matchers", function() {
|
||||
function detailsFor(actual, matcherName, matcherArgs) {
|
||||
var matcher = match(actual);
|
||||
matcher[matcherName].apply(matcher, matcherArgs);
|
||||
expect(matcher.getResults().getItems().length).toEqual(1);
|
||||
return matcher.getResults().getItems()[0].details;
|
||||
expect(matcher.results().getItems().length).toEqual(1);
|
||||
return matcher.results().getItems()[0].details;
|
||||
}
|
||||
|
||||
it("toEqual with primitives, objects, dates, html nodes, etc.", function() {
|
||||
@ -222,7 +222,7 @@ describe("jasmine.Matchers", function() {
|
||||
|
||||
expected = match(TestClass.someFunction);
|
||||
expect(expected.wasCalledWith('c', 'b', 'a')).toEqual(false);
|
||||
expect(expected.getResults().getItems()[0].passed()).toEqual(false);
|
||||
expect(expected.results().getItems()[0].passed()).toEqual(false);
|
||||
|
||||
TestClass.someFunction.reset();
|
||||
TestClass.someFunction('a', 'b', 'c');
|
||||
|
@ -31,7 +31,7 @@ describe('RunnerTest', function() {
|
||||
|
||||
env.currentRunner.execute();
|
||||
|
||||
var runnerResults = env.currentRunner.getResults();
|
||||
var runnerResults = env.currentRunner.results();
|
||||
expect(runnerResults.totalCount).toEqual(2);
|
||||
expect(runnerResults.passedCount).toEqual(1);
|
||||
expect(runnerResults.failedCount).toEqual(1);
|
||||
@ -57,7 +57,7 @@ describe('RunnerTest', function() {
|
||||
|
||||
env.currentRunner.execute();
|
||||
|
||||
var runnerResults = env.currentRunner.getResults();
|
||||
var runnerResults = env.currentRunner.results();
|
||||
expect(runnerResults.totalCount).toEqual(1);
|
||||
expect(runnerResults.passedCount).toEqual(0);
|
||||
expect(runnerResults.failedCount).toEqual(1);
|
||||
@ -82,7 +82,7 @@ describe('RunnerTest', function() {
|
||||
|
||||
env.currentRunner.execute();
|
||||
|
||||
var results = env.currentRunner.getResults();
|
||||
var results = env.currentRunner.results();
|
||||
expect(results.totalCount).toEqual(2);
|
||||
expect(results.passedCount).toEqual(1);
|
||||
expect(results.failedCount).toEqual(1);
|
||||
@ -119,7 +119,7 @@ describe('RunnerTest', function() {
|
||||
//This blows up the JSApiReporter.
|
||||
//expect(fakeReporter.reportRunnerResults).wasCalledWith(env.currentRunner);
|
||||
expect(fakeReporter.reportRunnerResults).wasCalled();
|
||||
expect(fakeReporter.reportRunnerResults.mostRecentCall.args[0].getResults()).toEqual(env.currentRunner.getResults());
|
||||
expect(fakeReporter.reportRunnerResults.mostRecentCall.args[0].results()).toEqual(env.currentRunner.results());
|
||||
});
|
||||
|
||||
|
||||
|
@ -67,13 +67,13 @@ describe("jasmine spec running", function () {
|
||||
|
||||
expect(specWithNoBody.description).toEqual('new spec');
|
||||
|
||||
expect(specWithExpectation.results.getItems().length).toEqual(1); // "Results aren't there after a spec was executed"
|
||||
expect(specWithExpectation.results.getItems()[0].passed()).toEqual(true); // "Results has a result, but it's true"
|
||||
expect(specWithExpectation.results.description).toEqual('spec with an expectation'); // "Spec's results did not get the spec's description"
|
||||
expect(specWithExpectation.results().getItems().length).toEqual(1); // "Results aren't there after a spec was executed"
|
||||
expect(specWithExpectation.results().getItems()[0].passed()).toEqual(true); // "Results has a result, but it's true"
|
||||
expect(specWithExpectation.results().description).toEqual('spec with an expectation'); // "Spec's results did not get the spec's description"
|
||||
|
||||
expect(specWithFailingExpectations.results.getItems()[0].passed()).toEqual(false); // "Expectation that failed, passed"
|
||||
expect(specWithFailingExpectations.results().getItems()[0].passed()).toEqual(false); // "Expectation that failed, passed"
|
||||
|
||||
expect(specWithMultipleExpectations.results.getItems().length).toEqual(2); // "Spec doesn't support multiple expectations"
|
||||
expect(specWithMultipleExpectations.results().getItems().length).toEqual(2); // "Spec doesn't support multiple expectations"
|
||||
});
|
||||
|
||||
it("should work without a runs block", function() {
|
||||
@ -89,10 +89,10 @@ describe("jasmine spec running", function () {
|
||||
another_spec.execute();
|
||||
another_spec.done = true;
|
||||
|
||||
expect(another_spec.results.getItems().length).toEqual(2);
|
||||
expect(another_spec.results.getItems()[0].passed()).toEqual(true); // "In a spec without a run block, expected first expectation result to be true but was false"
|
||||
expect(another_spec.results.getItems()[1].passed()).toEqual(false); // "In a spec without a run block, expected second expectation result to be false but was true";
|
||||
expect(another_spec.results.description).toEqual('spec with an expectation'); // "In a spec without a run block, results did not include the spec's description";
|
||||
expect(another_spec.results().getItems().length).toEqual(2);
|
||||
expect(another_spec.results().getItems()[0].passed()).toEqual(true); // "In a spec without a run block, expected first expectation result to be true but was false"
|
||||
expect(another_spec.results().getItems()[1].passed()).toEqual(false); // "In a spec without a run block, expected second expectation result to be false but was true";
|
||||
expect(another_spec.results().description).toEqual('spec with an expectation'); // "In a spec without a run block, results did not include the spec's description";
|
||||
});
|
||||
|
||||
it('should queue waits and runs that it encounters while executing specs', function() {
|
||||
@ -141,8 +141,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
a_spec.execute();
|
||||
|
||||
expect(a_spec.results.getItems().length).toEqual(1); // 'No call to waits(): Spec queue did not run all functions';
|
||||
expect(a_spec.results.getItems()[0].passed()).toEqual(true); // 'No call to waits(): Queued expectation failed';
|
||||
expect(a_spec.results().getItems().length).toEqual(1); // 'No call to waits(): Spec queue did not run all functions';
|
||||
expect(a_spec.results().getItems()[0].passed()).toEqual(true); // 'No call to waits(): Queued expectation failed';
|
||||
|
||||
foo = 0;
|
||||
env.describe('test async spec', function() {
|
||||
@ -161,15 +161,15 @@ describe("jasmine spec running", function () {
|
||||
|
||||
a_spec.execute();
|
||||
|
||||
expect(a_spec.results.getItems().length).toEqual(0);
|
||||
expect(a_spec.results().getItems().length).toEqual(0);
|
||||
|
||||
fakeTimer.tick(500);
|
||||
expect(a_spec.results.getItems().length).toEqual(0);
|
||||
expect(a_spec.results().getItems().length).toEqual(0);
|
||||
|
||||
fakeTimer.tick(500);
|
||||
expect(a_spec.results.getItems().length).toEqual(1); // 'Calling waits(): Spec queue did not run all functions';
|
||||
expect(a_spec.results().getItems().length).toEqual(1); // 'Calling waits(): Spec queue did not run all functions';
|
||||
|
||||
expect(a_spec.results.getItems()[0].passed()).toEqual(true); // 'Calling waits(): Queued expectation failed';
|
||||
expect(a_spec.results().getItems()[0].passed()).toEqual(true); // 'Calling waits(): Queued expectation failed';
|
||||
|
||||
var bar = 0;
|
||||
var another_spec;
|
||||
@ -199,8 +199,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
fakeTimer.tick(1000);
|
||||
|
||||
expect(another_spec.results.getItems().length).toEqual(1);
|
||||
expect(another_spec.results.getItems()[0].passed()).toEqual(true);
|
||||
expect(another_spec.results().getItems().length).toEqual(1);
|
||||
expect(another_spec.results().getItems()[0].passed()).toEqual(true);
|
||||
|
||||
var baz = 0;
|
||||
var yet_another_spec;
|
||||
@ -225,8 +225,8 @@ describe("jasmine spec running", function () {
|
||||
fakeTimer.tick(150);
|
||||
|
||||
|
||||
expect(yet_another_spec.results.getItems().length).toEqual(1);
|
||||
expect(yet_another_spec.results.getItems()[0].passed()).toEqual(false);
|
||||
expect(yet_another_spec.results().getItems().length).toEqual(1);
|
||||
expect(yet_another_spec.results().getItems()[0].passed()).toEqual(false);
|
||||
});
|
||||
|
||||
it("testAsyncSpecsWithMockSuite", function () {
|
||||
@ -254,8 +254,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
another_spec.execute();
|
||||
fakeTimer.tick(2000);
|
||||
expect(another_spec.results.getItems().length).toEqual(1);
|
||||
expect(another_spec.results.getItems()[0].passed()).toEqual(true);
|
||||
expect(another_spec.results().getItems().length).toEqual(1);
|
||||
expect(another_spec.results().getItems()[0].passed()).toEqual(true);
|
||||
});
|
||||
|
||||
it("testWaitsFor", function() {
|
||||
@ -304,7 +304,7 @@ describe("jasmine spec running", function () {
|
||||
|
||||
spec.execute();
|
||||
fakeTimer.tick(1000);
|
||||
var actual = spec.results.getItems()[0].message;
|
||||
var actual = spec.results().getItems()[0].message;
|
||||
var expected = 'timeout: timed out after 500 msec waiting for my awesome condition';
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
@ -334,7 +334,7 @@ describe("jasmine spec running", function () {
|
||||
expect(runsBlockExecuted).toEqual(false);
|
||||
fakeTimer.tick(400);
|
||||
expect(runsBlockExecuted).toEqual(false);
|
||||
var actual = spec.results.getItems()[0].message;
|
||||
var actual = spec.results().getItems()[0].message;
|
||||
var expected = 'timeout: timed out after 500 msec waiting for something to happen';
|
||||
expect(actual).toEqual(expected,
|
||||
'expected "' + expected + '" but found "' + actual + '"');
|
||||
@ -425,8 +425,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
var suite = suiteWithBefore;
|
||||
|
||||
expect(suite.getResults().getItems()[0].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the first spec's foo should have been 2");
|
||||
expect(suite.getResults().getItems()[1].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the second spec's this.foo should have been 2");
|
||||
expect(suite.results().getItems()[0].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the first spec's foo should have been 2");
|
||||
expect(suite.results().getItems()[1].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the second spec's this.foo should have been 2");
|
||||
|
||||
|
||||
var foo = 1;
|
||||
@ -453,8 +453,8 @@ describe("jasmine spec running", function () {
|
||||
|
||||
suite = suiteWithAfter;
|
||||
expect(suite.afterEach.length).toEqual(1);
|
||||
expect(suite.getResults().getItems()[0].passed()).toEqual(true);
|
||||
expect(suite.getResults().getItems()[1].passed()).toEqual(true);
|
||||
expect(suite.results().getItems()[0].passed()).toEqual(true);
|
||||
expect(suite.results().getItems()[1].passed()).toEqual(true);
|
||||
expect(foo).toEqual(0);
|
||||
|
||||
});
|
||||
@ -809,7 +809,7 @@ describe("jasmine spec running", function () {
|
||||
suite.execute();
|
||||
|
||||
expect(report).toEqual("firstsecond");
|
||||
var suiteResults = suite.getResults();
|
||||
var suiteResults = suite.results();
|
||||
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(false);
|
||||
expect(suiteResults.getItems()[1].getItems()[0].passed()).toEqual(true);
|
||||
});
|
||||
@ -848,7 +848,7 @@ describe("jasmine spec running", function () {
|
||||
|
||||
expect(report).toEqual("firstsecondthird"); // "all tests should run");
|
||||
//After each errors should not go in spec results because it confuses the count.
|
||||
var suiteResults = suite.getResults();
|
||||
var suiteResults = suite.results();
|
||||
expect(suiteResults.getItems().length).toEqual(3, 'testAfterExecutesSafely should have results for three specs');
|
||||
|
||||
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(true, "testAfterExecutesSafely 1st spec should pass");
|
||||
@ -973,7 +973,7 @@ describe("jasmine spec running", function () {
|
||||
|
||||
env.execute();
|
||||
|
||||
var runnerResults = env.currentRunner.getResults();
|
||||
var runnerResults = env.currentRunner.results();
|
||||
expect(runnerResults.totalCount).toEqual(3);
|
||||
expect(runnerResults.passedCount).toEqual(3);
|
||||
expect(runnerResults.failedCount).toEqual(0);
|
||||
@ -1011,7 +1011,7 @@ describe("jasmine spec running", function () {
|
||||
suite.execute();
|
||||
fakeTimer.tick(600);
|
||||
expect(spec.foo).toEqual(2);
|
||||
var suiteResults = suite.getResults();
|
||||
var suiteResults = suite.results();
|
||||
expect(suiteResults.getItems()[0].getItems().length).toEqual(2);
|
||||
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(false);
|
||||
expect(suiteResults.getItems()[0].getItems()[1].passed()).toEqual(true);
|
||||
|
109
spec/suites/SpecSpec.js
Normal file
109
spec/suites/SpecSpec.js
Normal file
@ -0,0 +1,109 @@
|
||||
describe('Spec', function () {
|
||||
var env, suite;
|
||||
beforeEach(function() {
|
||||
env = new jasmine.Env();
|
||||
suite = new jasmine.Suite(env, 'suite 1');
|
||||
});
|
||||
|
||||
describe('initialization', function () {
|
||||
|
||||
it('should raise an error if an env is not passed', function () {
|
||||
try {
|
||||
new jasmine.Spec();
|
||||
}
|
||||
catch (e) {
|
||||
expect(e.message).toEqual('jasmine.Env() required');
|
||||
}
|
||||
});
|
||||
|
||||
it('should raise an error if a suite is not passed', function () {
|
||||
try {
|
||||
new jasmine.Spec(env);
|
||||
}
|
||||
catch (e) {
|
||||
expect(e.message).toEqual('jasmine.Suite() required');
|
||||
}
|
||||
});
|
||||
|
||||
it('should assign sequential ids for specs belonging to the same env', function () {
|
||||
var spec1 = new jasmine.Spec(env, suite);
|
||||
var spec2 = new jasmine.Spec(env, suite);
|
||||
var spec3 = new jasmine.Spec(env, suite);
|
||||
expect(spec1.id).toEqual(0);
|
||||
expect(spec2.id).toEqual(1);
|
||||
expect(spec3.id).toEqual(2);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('getFullName returns suite & spec description', function () {
|
||||
var spec = new jasmine.Spec(env, suite, 'spec 1');
|
||||
expect(spec.getFullName()).toEqual('suite 1 spec 1.')
|
||||
});
|
||||
|
||||
describe('results', function () {
|
||||
var spec, results;
|
||||
beforeEach(function () {
|
||||
spec = new jasmine.Spec(env, suite);
|
||||
results = spec.results();
|
||||
expect(results.totalCount).toEqual(0);
|
||||
spec.runs(function () {
|
||||
this.expect(true).toEqual(true);
|
||||
this.expect(true).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('results shows the total number of expectations for each spec after execution', function () {
|
||||
expect(results.totalCount).toEqual(0);
|
||||
spec.execute();
|
||||
expect(results.totalCount).toEqual(2);
|
||||
});
|
||||
|
||||
it('results shows the number of passed expectations for each spec after execution', function () {
|
||||
expect(results.passedCount).toEqual(0);
|
||||
spec.execute();
|
||||
expect(results.passedCount).toEqual(2);
|
||||
});
|
||||
|
||||
it('results shows the number of failed expectations for each spec after execution', function () {
|
||||
spec.runs(function () {
|
||||
this.expect(true).toEqual(false);
|
||||
});
|
||||
expect(results.failedCount).toEqual(0);
|
||||
spec.execute();
|
||||
expect(results.failedCount).toEqual(1);
|
||||
});
|
||||
|
||||
describe('results.passed', function () {
|
||||
it('is true if all spec expectations pass', function () {
|
||||
spec.runs(function () {
|
||||
this.expect(true).toEqual(true);
|
||||
});
|
||||
spec.execute();
|
||||
expect(results.passed()).toEqual(true);
|
||||
});
|
||||
|
||||
it('is false if one spec expectation fails', function () {
|
||||
spec.runs(function () {
|
||||
this.expect(true).toEqual(false);
|
||||
});
|
||||
spec.execute();
|
||||
expect(results.passed()).toEqual(false);
|
||||
});
|
||||
|
||||
it('a spec with no expectations will return true', function () {
|
||||
var specWithoutExpectations = new jasmine.Spec(env, suite);
|
||||
specWithoutExpectations.runs(function() {
|
||||
|
||||
});
|
||||
specWithoutExpectations.execute();
|
||||
expect(results.passed()).toEqual(true);
|
||||
});
|
||||
|
||||
it('an unexecuted spec will return true', function () {
|
||||
expect(results.passed()).toEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@ -31,4 +31,5 @@ describe("TrivialReporter", function() {
|
||||
expect(divs.length).toEqual(2);
|
||||
expect(divs[1].innerHTML).toContain("suite 1");
|
||||
});
|
||||
|
||||
});
|
@ -16,11 +16,7 @@ jasmine.Block.prototype.execute = function(onComplete) {
|
||||
try {
|
||||
this.func.apply(this.spec);
|
||||
} catch (e) {
|
||||
this.fail(e);
|
||||
this.spec.fail(e);
|
||||
}
|
||||
onComplete();
|
||||
};
|
||||
|
||||
jasmine.Block.prototype.fail = function(e) {
|
||||
this.spec.results.addResult(new jasmine.ExpectationResult(false, jasmine.util.formatException(e), null));
|
||||
};
|
19
src/Env.js
19
src/Env.js
@ -30,6 +30,9 @@ jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
|
||||
jasmine.Env.prototype.setInterval = jasmine.setInterval;
|
||||
jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
|
||||
|
||||
/**
|
||||
* @returns an object containing jasmine version build info, if set.
|
||||
*/
|
||||
jasmine.Env.prototype.version = function () {
|
||||
if (jasmine.version_) {
|
||||
return jasmine.version_;
|
||||
@ -38,6 +41,20 @@ jasmine.Env.prototype.version = function () {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns a sequential integer starting at 0
|
||||
*/
|
||||
jasmine.Env.prototype.nextSpecId = function () {
|
||||
return this.nextSpecId_++;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns a sequential integer starting at 0
|
||||
*/
|
||||
jasmine.Env.prototype.nextSuiteId = function () {
|
||||
return this.nextSuiteId_++;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a reporter to receive status updates from Jasmine.
|
||||
* @param {jasmine.Reporter} reporter An object which will receive status updates.
|
||||
@ -98,7 +115,7 @@ jasmine.Env.prototype.it = function(description, func) {
|
||||
|
||||
jasmine.Env.prototype.xit = function(desc, func) {
|
||||
return {
|
||||
id: this.nextSpecId_++,
|
||||
id: this.nextSpecId(),
|
||||
runs: function() {
|
||||
}
|
||||
};
|
||||
|
@ -5,8 +5,8 @@
|
||||
jasmine.JsApiReporter = function() {
|
||||
this.started = false;
|
||||
this.finished = false;
|
||||
this.suites = [];
|
||||
this.results = {};
|
||||
this.suites_ = [];
|
||||
this.results_ = {};
|
||||
};
|
||||
|
||||
jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
@ -14,10 +14,14 @@ jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
var suites = runner.suites();
|
||||
for (var i = 0; i < suites.length; i++) {
|
||||
var suite = suites[i];
|
||||
this.suites.push(this.summarize_(suite));
|
||||
this.suites_.push(this.summarize_(suite));
|
||||
}
|
||||
};
|
||||
|
||||
jasmine.JsApiReporter.prototype.suites = function() {
|
||||
return this.suites_;
|
||||
};
|
||||
|
||||
jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
||||
var isSuite = suiteOrSpec instanceof jasmine.Suite
|
||||
var summary = {
|
||||
@ -35,6 +39,14 @@ jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
||||
return summary;
|
||||
};
|
||||
|
||||
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;
|
||||
@ -46,9 +58,9 @@ 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"
|
||||
this.results_[spec.id] = {
|
||||
messages: spec.results().getItems(),
|
||||
result: spec.results().failedCount > 0 ? "failed" : "passed"
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -2,19 +2,24 @@ jasmine.Matchers = function(env, actual, results) {
|
||||
this.env = env;
|
||||
this.actual = actual;
|
||||
this.passing_message = 'Passed.';
|
||||
this.results = results || new jasmine.NestedResults();
|
||||
this.results_ = results || new jasmine.NestedResults();
|
||||
};
|
||||
|
||||
jasmine.Matchers.pp = function(str) {
|
||||
return jasmine.util.htmlEscape(jasmine.pp(str));
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.getResults = function() {
|
||||
return this.results;
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.results = function() {
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
||||
this.results.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details));
|
||||
this.results_.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details));
|
||||
return result;
|
||||
};
|
||||
|
||||
|
@ -66,11 +66,11 @@ jasmine.Queue.prototype.finish = function () {
|
||||
}
|
||||
};
|
||||
|
||||
jasmine.Queue.prototype.getResults = function () {
|
||||
jasmine.Queue.prototype.results = function () {
|
||||
var results = new jasmine.NestedResults();
|
||||
for (var i = 0; i < this.blocks.length; i++) {
|
||||
if (this.blocks[i].getResults) {
|
||||
results.addResult(this.blocks[i].getResults());
|
||||
if (this.blocks[i].results) {
|
||||
results.addResult(this.blocks[i].results());
|
||||
}
|
||||
}
|
||||
return results;
|
||||
|
@ -46,6 +46,11 @@ jasmine.Runner.prototype.suites = function() {
|
||||
return this.suites_;
|
||||
};
|
||||
|
||||
jasmine.Runner.prototype.getResults = function() {
|
||||
return this.queue.getResults();
|
||||
jasmine.Runner.prototype.results = function() {
|
||||
return this.queue.results();
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Runner.prototype.getResults = function() {
|
||||
return this.queue.results();
|
||||
};
|
35
src/Spec.js
35
src/Spec.js
@ -7,8 +7,14 @@
|
||||
* @param {String} description
|
||||
*/
|
||||
jasmine.Spec = function(env, suite, description) {
|
||||
if (!env) {
|
||||
throw new Error('jasmine.Env() required');
|
||||
};
|
||||
if (!suite) {
|
||||
throw new Error('jasmine.Suite() required');
|
||||
};
|
||||
var spec = this;
|
||||
spec.id = env.nextSpecId_++;
|
||||
spec.id = env.nextSpecId ? env.nextSpecId() : null;
|
||||
spec.env = env;
|
||||
spec.suite = suite;
|
||||
spec.description = description;
|
||||
@ -17,8 +23,8 @@ jasmine.Spec = function(env, suite, description) {
|
||||
spec.afterCallbacks = [];
|
||||
spec.spies_ = [];
|
||||
|
||||
spec.results = new jasmine.NestedResults();
|
||||
spec.results.description = description;
|
||||
spec.results_ = new jasmine.NestedResults();
|
||||
spec.results_.description = description;
|
||||
spec.matchersClass = null;
|
||||
};
|
||||
|
||||
@ -26,8 +32,18 @@ jasmine.Spec.prototype.getFullName = function() {
|
||||
return this.suite.getFullName() + ' ' + this.description + '.';
|
||||
};
|
||||
|
||||
|
||||
jasmine.Spec.prototype.results = function() {
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.log = function(message) {
|
||||
return this.results_.log(message);
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Spec.prototype.getResults = function() {
|
||||
return this.results;
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.runs = function (func) {
|
||||
@ -52,11 +68,8 @@ jasmine.Spec.prototype.expects_that = function(actual) {
|
||||
return this.expect(actual);
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
jasmine.Spec.prototype.expect = function(actual) {
|
||||
return new (this.getMatchersClass_())(this.env, actual, this.results);
|
||||
return new (this.getMatchersClass_())(this.env, actual, this.results_);
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.waits = function(timeout) {
|
||||
@ -71,8 +84,8 @@ jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessag
|
||||
return this;
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.failWithException = function (e) {
|
||||
this.results.addResult(new jasmine.ExpectationResult(false, jasmine.util.formatException(e), null));
|
||||
jasmine.Spec.prototype.fail = function (e) {
|
||||
this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null));
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.getMatchersClass_ = function() {
|
||||
@ -115,7 +128,7 @@ jasmine.Spec.prototype.after = function(doAfter, test) {
|
||||
jasmine.Spec.prototype.execute = function(onComplete) {
|
||||
var spec = this;
|
||||
if (!spec.env.specFilter(spec)) {
|
||||
spec.results.skipped = true;
|
||||
spec.results_.skipped = true;
|
||||
spec.finish(onComplete);
|
||||
return;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
|
||||
var self = this;
|
||||
self.id = env.nextSuiteId_++;
|
||||
self.id = env.nextSuiteId ? env.nextSuiteId() : null;
|
||||
self.description = description;
|
||||
self.queue = new jasmine.Queue(env);
|
||||
self.parentSuite = parentSuite;
|
||||
@ -45,8 +45,13 @@ jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
|
||||
this.afterQueue.push(afterEachFunction);
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Suite.prototype.getResults = function() {
|
||||
return this.queue.getResults();
|
||||
return this.queue.results();
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.results = function() {
|
||||
return this.queue.results();
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.add = function(block) {
|
||||
|
@ -17,7 +17,7 @@ jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
|
||||
try {
|
||||
latchFunctionResult = self.latchFunction.apply(self.spec);
|
||||
} catch (e) {
|
||||
self.fail(e);
|
||||
self.spec.fail(e);
|
||||
onComplete();
|
||||
return;
|
||||
}
|
||||
@ -26,7 +26,7 @@ jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
|
||||
onComplete();
|
||||
} else if (self.totalTimeSpentWaitingForLatch >= self.timeout) {
|
||||
var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen');
|
||||
self.fail({
|
||||
self.spec.fail({
|
||||
name: 'timeout',
|
||||
message: message
|
||||
});
|
||||
|
@ -323,7 +323,7 @@ jasmine.createSpyObj = function(baseName, methodNames) {
|
||||
};
|
||||
|
||||
jasmine.log = function(message) {
|
||||
jasmine.getEnv().currentSpec.getResults().log(message);
|
||||
jasmine.getEnv().currentSpec.log(message);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user