Skip to content

Commit

Permalink
Build commit 638a666
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed Jul 20, 2024
1 parent 1c5895c commit 66cf1a2
Show file tree
Hide file tree
Showing 28 changed files with 298 additions and 3 deletions.
46 changes: 45 additions & 1 deletion api/assert/expect/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,50 @@ <h2 id="changelog">Changelog</h2>
</tbody>
</table>

<h2 id="migration-guide">Migration guide</h2>

<p>If you use <code class="language-plaintext highlighter-rouge">assert.expect()</code> in combination with <code class="language-plaintext highlighter-rouge">assert.step()</code> and <a href="/api/assert/verifySteps/"><code class="language-plaintext highlighter-rouge">assert.verifySteps()</code></a> in the same test, you previously counted both the steps and the verification of the steps. In QUnit 3.0 this changes to count <code class="language-plaintext highlighter-rouge">assert.verifySteps()</code> as one assertion instead (<a href="https://github.com/qunitjs/qunit/issues/1226">#1226</a>).</p>

<p>Before, on QUnit 2.x without <a href="/api/config/countStepsAsOne/">QUnit.config.countStepsAsOne</a>:</p>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">QUnit</span><span class="p">.</span><span class="nf">test</span><span class="p">(</span><span class="dl">'</span><span class="s1">example</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nf">function </span><span class="p">(</span><span class="nx">assert</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">assert</span><span class="p">.</span><span class="nf">expect</span><span class="p">(</span><span class="mi">6</span><span class="p">);</span>

<span class="nx">MyWordParser</span><span class="p">.</span><span class="nf">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">noun</span><span class="dl">'</span><span class="p">,</span> <span class="nf">function </span><span class="p">(</span><span class="nx">word</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">assert</span><span class="p">.</span><span class="nf">step</span><span class="p">(</span><span class="nx">word</span><span class="p">);</span> <span class="c1">// 1, 2, 3, 4</span>
<span class="p">});</span>
<span class="kd">var</span> <span class="nx">song</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">MyWordParser</span><span class="p">.</span><span class="nf">sing</span><span class="p">(</span><span class="dl">'</span><span class="s1">My Favorite Things</span><span class="dl">'</span><span class="p">,</span> <span class="p">{</span> <span class="na">lines</span><span class="p">:</span> <span class="mi">1</span> <span class="p">});</span>

<span class="nx">assert</span><span class="p">.</span><span class="nf">true</span><span class="p">(</span><span class="nx">song</span><span class="p">.</span><span class="nx">finished</span><span class="p">,</span> <span class="dl">'</span><span class="s1">finished</span><span class="dl">'</span><span class="p">);</span> <span class="c1">// 5</span>
<span class="nx">assert</span><span class="p">.</span><span class="nf">verifySteps</span><span class="p">([</span> <span class="c1">// 6</span>
<span class="dl">'</span><span class="s1">Raindrops</span><span class="dl">'</span><span class="p">,</span>
<span class="dl">'</span><span class="s1">roses</span><span class="dl">'</span><span class="p">,</span>
<span class="dl">'</span><span class="s1">whiskers</span><span class="dl">'</span><span class="p">,</span>
<span class="dl">'</span><span class="s1">kittens</span><span class="dl">'</span>
<span class="p">]);</span>
<span class="p">});</span>
</code></pre></div></div>

<p>After:</p>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">QUnit</span><span class="p">.</span><span class="nf">test</span><span class="p">(</span><span class="dl">'</span><span class="s1">example</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nf">function </span><span class="p">(</span><span class="nx">assert</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">assert</span><span class="p">.</span><span class="nf">expect</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>

<span class="nx">MyWordParser</span><span class="p">.</span><span class="nf">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">noun</span><span class="dl">'</span><span class="p">,</span> <span class="nf">function </span><span class="p">(</span><span class="nx">word</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">assert</span><span class="p">.</span><span class="nf">step</span><span class="p">(</span><span class="nx">word</span><span class="p">);</span>
<span class="p">});</span>
<span class="kd">var</span> <span class="nx">song</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">MyWordParser</span><span class="p">.</span><span class="nf">sing</span><span class="p">(</span><span class="dl">'</span><span class="s1">My Favorite Things</span><span class="dl">'</span><span class="p">,</span> <span class="p">{</span> <span class="na">lines</span><span class="p">:</span> <span class="mi">1</span> <span class="p">});</span>

<span class="nx">assert</span><span class="p">.</span><span class="nf">true</span><span class="p">(</span><span class="nx">song</span><span class="p">.</span><span class="nx">finished</span><span class="p">,</span> <span class="dl">'</span><span class="s1">finished</span><span class="dl">'</span><span class="p">);</span> <span class="c1">// 1</span>
<span class="nx">assert</span><span class="p">.</span><span class="nf">verifySteps</span><span class="p">([</span> <span class="c1">// 2</span>
<span class="dl">'</span><span class="s1">Raindrops</span><span class="dl">'</span><span class="p">,</span>
<span class="dl">'</span><span class="s1">roses</span><span class="dl">'</span><span class="p">,</span>
<span class="dl">'</span><span class="s1">whiskers</span><span class="dl">'</span><span class="p">,</span>
<span class="dl">'</span><span class="s1">kittens</span><span class="dl">'</span>
<span class="p">]);</span>
<span class="p">});</span>
</code></pre></div></div>

<h2 id="examples">Examples</h2>

<h3 id="example-no-assertions">Example: No assertions</h3>
Expand Down Expand Up @@ -241,7 +285,7 @@ <h4><a href="/api/deprecated/">Deprecated methods</a></h4>

<h4><a href="/api/removed/">Removed methods</a></h4>
<hr><div class="toc-wrapper">
<h4>Table of contents</h4><ol class="toc"><li class="sidebar-item"><a href="#description">Description</a></li><li class="sidebar-item"><a href="#changelog">Changelog</a></li><li class="sidebar-item"><a href="#examples">Examples</a><ol><li class="sidebar-item"><a href="#example-no-assertions">Example: No assertions</a></li><li class="sidebar-item"><a href="#example-custom-assert">Example: Custom assert</a></li><li class="sidebar-item"><a href="#example-explicit-count">Example: Explicit count</a></li></ol></li></ol></div>
<h4>Table of contents</h4><ol class="toc"><li class="sidebar-item"><a href="#description">Description</a></li><li class="sidebar-item"><a href="#changelog">Changelog</a></li><li class="sidebar-item"><a href="#migration-guide">Migration guide</a></li><li class="sidebar-item"><a href="#examples">Examples</a><ol><li class="sidebar-item"><a href="#example-no-assertions">Example: No assertions</a></li><li class="sidebar-item"><a href="#example-custom-assert">Example: Custom assert</a></li><li class="sidebar-item"><a href="#example-explicit-count">Example: Explicit count</a></li></ol></li></ol></div>
</aside>

</div>
Expand Down
2 changes: 2 additions & 0 deletions api/config/altertitle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ <h4 class="sidebar-title-open"><a href="/api/config/">Configuration</a></h4>
<a href="/api/config/autostart/">QUnit.config.autostart</a>
</li><li class="sidebar-item">
<a href="/api/config/collapse/">QUnit.config.collapse</a>
</li><li class="sidebar-item">
<a href="/api/config/countStepsAsOne/">QUnit.config.countStepsAsOne</a>
</li><li class="sidebar-item">
<a href="/api/config/current/">QUnit.config.current</a>
</li><li class="sidebar-item">
Expand Down
2 changes: 2 additions & 0 deletions api/config/autostart/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ <h4 class="sidebar-title-open"><a href="/api/config/">Configuration</a></h4>
<a href="/api/config/autostart/">QUnit.config.autostart</a>
</li><li class="sidebar-item">
<a href="/api/config/collapse/">QUnit.config.collapse</a>
</li><li class="sidebar-item">
<a href="/api/config/countStepsAsOne/">QUnit.config.countStepsAsOne</a>
</li><li class="sidebar-item">
<a href="/api/config/current/">QUnit.config.current</a>
</li><li class="sidebar-item">
Expand Down
2 changes: 2 additions & 0 deletions api/config/collapse/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ <h4 class="sidebar-title-open"><a href="/api/config/">Configuration</a></h4>
<a href="/api/config/autostart/">QUnit.config.autostart</a>
</li><li class="sidebar-item sidebar-item-active">
<a href="/api/config/collapse/">QUnit.config.collapse</a>
</li><li class="sidebar-item">
<a href="/api/config/countStepsAsOne/">QUnit.config.countStepsAsOne</a>
</li><li class="sidebar-item">
<a href="/api/config/current/">QUnit.config.current</a>
</li><li class="sidebar-item">
Expand Down
Loading

0 comments on commit 66cf1a2

Please sign in to comment.