<p dir="auto">Hi! Is there any way to generate tests dynamically? Like in mocha:<br>
<a href="https://mochajs.org/#dynamically-generating-tests" rel="nofollow">https://mochajs.org/#dynamically-generating-tests</a></p>
<p dir="auto">For example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    test.describe.serial('Dynamic tests', () =&gt; {
	    const asyncData = test.preloadData()
    
	    test('Check testData', () =&gt; {
		    ok(asyncData?.length)
	    })
    
	    asyncData.forEach(item =&gt; {
    
		    test(`Test for ${item}`, async () =&gt; {
			    ....
		    })
	    })
    })"><pre class="notranslate"><code class="notranslate">    test.describe.serial('Dynamic tests', () =&gt; {
	    const asyncData = test.preloadData()
    
	    test('Check testData', () =&gt; {
		    ok(asyncData?.length)
	    })
    
	    asyncData.forEach(item =&gt; {
    
		    test(`Test for ${item}`, async () =&gt; {
			    ....
		    })
	    })
    })
</code></pre></div>
<p dir="auto">You can already do each via running test in a loop:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="for (const data in [...]) {
  test('testing ' + data, async () =&gt; {});
}"><pre class="notranslate"><span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-s1">data</span> <span class="pl-k">in</span> <span class="pl-kos">[</span>...<span class="pl-kos">]</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">'testing '</span> <span class="pl-c1">+</span> <span class="pl-s1">data</span><span class="pl-kos">,</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">If the above does not work for you, please tell us why in the comments!</p>