Skip to content

Commit

Permalink
Build commit 5ee5ae0
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed Jul 13, 2024
1 parent 1db3b70 commit 774ddde
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
19 changes: 16 additions & 3 deletions api/assert/expect/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,18 @@ <h2 id="description" class="screen-reader-text h-api-desc">Description</h2>

<p>This can also be used to explicitly require a certain number of assertions to be recorded in a given test. If afterwards the number of assertions does not match the expected count, the test will fail.</p>

<p>It is recommended to test asynchronous code with <a href="/api/assert/step/"><code class="language-plaintext highlighter-rouge">assert.step()</code></a> or <a href="/api/assert/async/"><code class="language-plaintext highlighter-rouge">assert.async()</code></a> instead.</p>
<p>It is recommended to test asynchronous code with the <a href="/api/assert/verifySteps/"><code class="language-plaintext highlighter-rouge">assert.verifySteps()</code></a> or <a href="/api/assert/async/"><code class="language-plaintext highlighter-rouge">assert.async()</code></a> methods instead. If you’re using these stricter methods already, consider removing the <code class="language-plaintext highlighter-rouge">assert.expect()</code> call. See also the <a href="https://github.com/platinumazure/eslint-plugin-qunit/blob/main/docs/rules/require-expect.md">require-expect “never-except-zero”</a> rule of the <a href="https://www.npmjs.com/package/eslint-plugin-qunit">eslint-plugin-qunit</a> package.</p>

<h2 id="changelog">Changelog</h2>

<table>
<tbody>
<tr>
<td>UNRELEASED</td>
<td><code class="language-plaintext highlighter-rouge">assert.expect()</code> now counts <a href="/api/assert/verifySteps/"><code class="language-plaintext highlighter-rouge">assert.verifySteps()</code></a> as one assertion. Steps no longer count separately.</td>
</tr>
</tbody>
</table>

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

Expand Down Expand Up @@ -137,7 +148,9 @@ <h3 id="example-custom-assert">Example: Custom assert</h3>

<h3 id="example-explicit-count">Example: Explicit count</h3>

<p>Require an explicit assertion count.</p>
<p>Fail the test if the test did not complete an exact assertion count.</p>

<p>It is recommended to test callback code with <a href="/api/assert/verifySteps/"><code class="language-plaintext highlighter-rouge">assert.verifySteps()</code></a> instead, as replacement for relying on <code class="language-plaintext highlighter-rouge">assert.expect()</code>. See also the <a href="https://github.com/platinumazure/eslint-plugin-qunit/blob/main/docs/rules/require-expect.md">require-expect “never-except-zero”</a> rule of the <a href="https://www.npmjs.com/package/eslint-plugin-qunit">eslint-plugin-qunit</a> package.</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="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>
Expand Down Expand Up @@ -228,7 +241,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="#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="#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
15 changes: 13 additions & 2 deletions api/assert/step/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,21 @@ <h2 id="description" class="screen-reader-text h-api-desc">Description</h2>
</tbody>
</table>

<p>This assertion registers a passing assertion with the provided string. This and any other steps should be verified later in the test via <a href="/api/assert/verifySteps/"><code class="language-plaintext highlighter-rouge">assert.verifySteps()</code></a>.</p>
<p>This and any later steps must be verified before the end of the test via <a href="/api/assert/verifySteps/"><code class="language-plaintext highlighter-rouge">assert.verifySteps()</code></a>.</p>

<p>The Step API provides an easy way to verify execution logic to a high degree of accuracy and precision, whether for asynchronous code, event-driven code, or callback-driven code.</p>

<h2 id="changelog">Changelog</h2>

<table>
<tbody>
<tr>
<td>UNRELEASED</td>
<td><a href="/api/assert/expect/">assert.expect()</a> now counts <a href="/api/assert/verifySteps/">assert.verifySteps()</a> as one assertion. Steps no longer count separately.</td>
</tr>
</tbody>
</table>

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

<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="nf">function </span><span class="p">(</span><span class="nx">assert</span><span class="p">)</span> <span class="p">{</span>
Expand Down Expand Up @@ -193,7 +204,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="#examples">Examples</a></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="#examples">Examples</a></li></ol></div>
</aside>

</div>
Expand Down
13 changes: 12 additions & 1 deletion api/assert/verifySteps/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ <h2 id="description" class="screen-reader-text h-api-desc">Description</h2>

<p>Refer to the below examples and learn how to use the Step API in your test suite.</p>

<h2 id="changelog">Changelog</h2>

<table>
<tbody>
<tr>
<td>UNRELEASED</td>
<td><a href="/api/assert/expect/">assert.expect()</a> now counts <code class="language-plaintext highlighter-rouge">assert.verifySteps()</code> as one assertion. Steps no longer count separately.</td>
</tr>
</tbody>
</table>

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

<h3 id="test-event-based-interface">Test event-based interface</h3>
Expand Down Expand Up @@ -295,7 +306,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="#examples">Examples</a><ol><li class="sidebar-item"><a href="#test-event-based-interface">Test event-based interface</a></li><li class="sidebar-item"><a href="#test-publishsubscribe-system">Test publish/subscribe system</a></li><li class="sidebar-item"><a href="#multiple-step-verifications-in-one-test">Multiple step verifications in one test</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="#examples">Examples</a><ol><li class="sidebar-item"><a href="#test-event-based-interface">Test event-based interface</a></li><li class="sidebar-item"><a href="#test-publishsubscribe-system">Test publish/subscribe system</a></li><li class="sidebar-item"><a href="#multiple-step-verifications-in-one-test">Multiple step verifications in one test</a></li></ol></li></ol></div>
</aside>

</div>
Expand Down
2 changes: 1 addition & 1 deletion feed.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://qunitjs.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://qunitjs.com/" rel="alternate" type="text/html" hreflang="en" /><updated>2024-07-13T15:57:15+00:00</updated><id>https://qunitjs.com/feed.xml</id><title type="html">QUnit</title><subtitle>The powerful, easy-to-use JavaScript testing framework.</subtitle></feed>
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://qunitjs.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://qunitjs.com/" rel="alternate" type="text/html" hreflang="en" /><updated>2024-07-13T16:21:30+00:00</updated><id>https://qunitjs.com/feed.xml</id><title type="html">QUnit</title><subtitle>The powerful, easy-to-use JavaScript testing framework.</subtitle></feed>

0 comments on commit 774ddde

Please sign in to comment.