<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Stryker Mutator Blog</title>
        <link>https://stryker-mutator.io/blog/</link>
        <description>Stryker Mutator Blog</description>
        <lastBuildDate>Wed, 15 Jul 2026 00:00:00 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <item>
            <title><![CDATA[Stryker4s 1.0: Mutation testing across the Scala ecosystem]]></title>
            <link>https://stryker-mutator.io/blog/stryker4s-v1/</link>
            <guid>https://stryker-mutator.io/blog/stryker4s-v1/</guid>
            <pubDate>Wed, 15 Jul 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[We're incredibly proud to announce Stryker4s 1.0: our first v1 release! 🎉]]></description>
            <content:encoded><![CDATA[<p>We're incredibly proud to announce <strong>Stryker4s 1.0</strong>: our first v1 release! 🎉</p>
<p>This is a huge milestone for the project. Stryker4s has evolved into a mature, stable and performant mutation testing framework that works great across the <strong>three major Scala build tools</strong>: sbt, Maven, and now Mill.</p>
<p>In this post, we'll go through all the new features, as well as some you might have missed in other releases that are worth mentioning again.</p>
<!-- -->
<p><strong>New to mutation testing?</strong> It's a unique way to assess the quality of your tests. Have a look at our <a class="" href="https://stryker-mutator.io/docs/General/example/">RoboCoasters 🤖🎢 example</a> to understand why 100% code coverage doesn't tell the whole story. You can also explore our <a href="https://stryker-mutator.io/stryker-playground/" target="_blank" rel="noopener noreferrer" class="">playground to experience mutation testing in action (C#)</a>. Mutation testing is the key to gauging the effectiveness of your tests.</p>
<p>Updating is easy, there are no deprecated or removed features. To update or install Stryker4s, adjust your <code>plugins.sbt</code> file:</p>
<div class="language-scala codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-scala codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">addSbtPlugin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"io.stryker-mutator"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"sbt-stryker4s"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"1.0.3"</span><span class="token punctuation" style="color:#393A34">)</span><br></div></code></pre></div></div>
<p>For Maven users:</p>
<div class="language-xml codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-xml codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">plugin</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">io.stryker-mutator</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">stryker4s-maven-plugin</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">version</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">1.0.3</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">version</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">plugin</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>And for Mill users:</p>
<div class="language-scala codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-scala codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">//| mvnDeps: ['io.stryker-mutator::mill-stryker4s::1.0.3']</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token namespace" style="opacity:0.7">stryker4s</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">.</span><span class="token namespace" style="opacity:0.7">mill</span><span class="token namespace punctuation" style="opacity:0.7;color:#393A34">.</span><span class="token plain">Stryker4sModule</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">object</span><span class="token plain"> foo </span><span class="token keyword" style="color:#00009f">extends</span><span class="token plain"> ScalaModule</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> Stryker4sModule </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="️-three-build-tools-one-implementation">🛠️ Three build tools, one implementation<a href="https://stryker-mutator.io/blog/stryker4s-v1/#%EF%B8%8F-three-build-tools-one-implementation" class="hash-link" aria-label="Direct link to 🛠️ Three build tools, one implementation" title="Direct link to 🛠️ Three build tools, one implementation" translate="no">​</a></h2>
<p>With Stryker4s 1.0, we now run mutation testing across all build tools in the same way, with the same features and performance. The sbt testrunner has been expanded upon and is now used as the base for running tests in all plugins. This means that whether you're using sbt, Maven, or Mill, you can expect a fast and consistent experience.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="-new-mill-plugin">🐘 New: Mill plugin<a href="https://stryker-mutator.io/blog/stryker4s-v1/#-new-mill-plugin" class="hash-link" aria-label="Direct link to 🐘 New: Mill plugin" title="Direct link to 🐘 New: Mill plugin" translate="no">​</a></h3>
<p>We've added a brand-new <a href="https://mill-build.com/" target="_blank" rel="noopener noreferrer" class="">Mill</a> plugin (<a href="https://github.com/stryker-mutator/stryker4s/issues/2042" target="_blank" rel="noopener noreferrer" class="">#2042</a>)! Mill users can now run mutation testing without leaving their build tool of choice.</p>
<p>The plugin uses the same base as the sbt plugin, so it has the same features and performance. It supports <strong>test coverage</strong> and <strong>rollback</strong>, and is fully compatible with Mill's multi-module builds. Configuration is also fully possible inside Mill build settings. No need for a separate <code>stryker4s.conf</code> file.</p>
<p><img decoding="async" loading="lazy" alt="Stryker4s mill usage" src="https://stryker-mutator.io/assets/images/stryker4s-mill-a7888b4824e1c9faf792acd166f5149b.gif" width="790" height="582" class="img_Qldj"></p>
<p>Interested in how test running works under the hood? Check out our <a class="" href="https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/">older blog post on the sbt plugin performance</a>.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="-rewritten-maven-plugin">🪶 Rewritten Maven plugin<a href="https://stryker-mutator.io/blog/stryker4s-v1/#-rewritten-maven-plugin" class="hash-link" aria-label="Direct link to 🪶 Rewritten Maven plugin" title="Direct link to 🪶 Rewritten Maven plugin" translate="no">​</a></h3>
<p>For the longest time, the Maven plugin seemed like the “forgotten sibling” of Stryker4s plugins. It lacked some features of the sbt plugin (like test reporting), and was much, much slower.</p>
<p>The Maven plugin has been <strong>completely rewritten</strong> (<a href="https://github.com/stryker-mutator/stryker4s/issues/2044" target="_blank" rel="noopener noreferrer" class="">#2044</a>) and now uses the same base as the sbt (and Mill) plugin. Bringing it the same performance and features as the other plugins, such as fast test running, coverage support, test reports, and rollback of compile errors. Running Stryker4s on its Maven module, performance improved from <strong>~16 minutes to ~12 seconds</strong>! 🎉</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="-sbt-plugin-minor-but-welcome-improvements">🐈 sbt plugin: minor but welcome improvements<a href="https://stryker-mutator.io/blog/stryker4s-v1/#-sbt-plugin-minor-but-welcome-improvements" class="hash-link" aria-label="Direct link to 🐈 sbt plugin: minor but welcome improvements" title="Direct link to 🐈 sbt plugin: minor but welcome improvements" translate="no">​</a></h3>
<p>The sbt plugin has been cross-published to <strong>sbt 2.x</strong> (<a href="https://github.com/stryker-mutator/stryker4s/issues/1655" target="_blank" rel="noopener noreferrer" class="">#1655</a>). Allowing you to run Stryker4s on the latest sbt versions.</p>
<p>For the longest time, running Stryker4s on a specific module in a multi-module sbt build was a bit of a pain. You had to use the workaround:</p>
<div class="language-scala codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-scala codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">sbt </span><span class="token string" style="color:#e3116c">'project &lt;module-name&gt;; stryker'</span><br></div></code></pre></div></div>
<p>Running Stryker4s on a specific module is now as simple as:</p>
<div class="language-scala codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-scala codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">sbt </span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">module</span><span class="token operator" style="color:#393A34">-</span><span class="token plain">name</span><span class="token operator" style="color:#393A34">&gt;</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">stryker</span><br></div></code></pre></div></div>
<p>Same as any other sbt tasks. Thanks to <a href="https://github.com/rwaldvogel" target="_blank" rel="noopener noreferrer" class="">@rwaldvogel</a> for this contribution!</p>
<p>Since a few releases, you've also been able to configure all options in Stryker4s directly in your <code>build.sbt</code> file, instead of using a separate <code>stryker4s.conf</code> file. Stryker4s will also use these settings to get some defaults (like the Scala dialect or sources to mutate), but you can override them with settings:</p>
<div class="language-scala codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-scala codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">strykerScalaDialect </span><span class="token operator" style="color:#393A34">:</span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> scala</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">meta</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">dialects</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">Scala3</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">strykerExcludedMutations </span><span class="token operator" style="color:#393A34">:</span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> Seq</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"BooleanLiteral"</span><span class="token punctuation" style="color:#393A34">)</span><br></div></code></pre></div></div>
<p>This also works great with CLI arguments:</p>
<div class="language-bash codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-bash codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">sbt stryker --scala-dialect scala3 --excluded-mutations BooleanLiteral --open-report</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-what-else">⚡ What else?<a href="https://stryker-mutator.io/blog/stryker4s-v1/#-what-else" class="hash-link" aria-label="Direct link to ⚡ What else?" title="Direct link to ⚡ What else?" translate="no">​</a></h2>
<p>What do you mean, what else? Is this not enough? Okay, okay. Here are a few more things that landed in 1.0:</p>
<ul>
<li class=""><strong>Scala 3.9 syntax</strong> (<a href="https://github.com/stryker-mutator/stryker4s/pull/2039" target="_blank" rel="noopener noreferrer" class="">#2039</a>): supports parsing the latest Scala 3.9 syntax.</li>
<li class=""><strong>Auto-open the report</strong> when a run finishes (<a href="https://github.com/stryker-mutator/stryker4s/issues/1430" target="_blank" rel="noopener noreferrer" class="">#1430</a>), with <code>--open-report</code>.</li>
<li class=""><strong>Single-file HTML report</strong> (<a href="https://github.com/stryker-mutator/stryker4s/issues/1867" target="_blank" rel="noopener noreferrer" class="">#1867</a>): the report is now a single self-contained file, making it easier to share or archive as a CI artifact.</li>
<li class=""><strong>Clearer logging</strong> (<a href="https://github.com/stryker-mutator/stryker4s/issues/2015" target="_blank" rel="noopener noreferrer" class="">#2015</a>) and richer mutant descriptions for regular expressions from <a href="https://github.com/stryker-mutator/weapon-regex" target="_blank" rel="noopener noreferrer" class="">weapon-regex</a> (<a href="https://github.com/stryker-mutator/stryker4s/issues/1470" target="_blank" rel="noopener noreferrer" class="">#1470</a>).</li>
<li class=""><strong>Pre-testing performance improvements</strong> (<a href="https://github.com/stryker-mutator/stryker4s/issues/2070" target="_blank" rel="noopener noreferrer" class="">#2070</a>, <a href="https://github.com/stryker-mutator/stryker4s/pull/2083" target="_blank" rel="noopener noreferrer" class="">#2083</a>, <a href="https://github.com/stryker-mutator/stryker4s/pull/2084" target="_blank" rel="noopener noreferrer" class="">#2084</a>): a bunch of speed-ups to start running your tests faster. Also includes some fixes to better support large projects and files.</li>
<li class=""><strong>Unix socket communication</strong> with test-runners (<a href="https://github.com/stryker-mutator/stryker4s/issues/1834" target="_blank" rel="noopener noreferrer" class="">#1834</a>): using <a href="https://fs2.io/" target="_blank" rel="noopener noreferrer" class="">FS2</a>'s native Unix socket support where available (falling back to TCP), for improved performance and stability.</li>
<li class="">A long list of robustness fixes: handling large test-runner messages (<a href="https://github.com/stryker-mutator/stryker4s/issues/2068" target="_blank" rel="noopener noreferrer" class="">#2068</a>), better exclude-annotation matching (<a href="https://github.com/stryker-mutator/stryker4s/issues/2063" target="_blank" rel="noopener noreferrer" class="">#2063</a>), improved rollback of compile errors, and more.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-thank-you">🙏 Thank you<a href="https://stryker-mutator.io/blog/stryker4s-v1/#-thank-you" class="hash-link" aria-label="Direct link to 🙏 Thank you" title="Direct link to 🙏 Thank you" translate="no">​</a></h2>
<p>Reaching 1.0 is a big milestone, signifying a certain stability and maturity of the project. But it wouldn't have been possible without the contributions of our amazing community. Thank you to everyone who has contributed to Stryker4s, whether through code, bug reports, or feedback. I'm excited to see where Stryker4s will go next.</p>
<p>As always, we'd love to hear your thoughts on <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">our Slack channel</a>, or open an <a href="https://github.com/stryker-mutator/stryker4s/issues" target="_blank" rel="noopener noreferrer" class="">issue on GitHub</a>.</p>]]></content:encoded>
            <category>stryker4s</category>
        </item>
        <item>
            <title><![CDATA[Introducing the Microsoft Testing Platform runner for Stryker.NET]]></title>
            <link>https://stryker-mutator.io/blog/stryker-net-mtp-runner/</link>
            <guid>https://stryker-mutator.io/blog/stryker-net-mtp-runner/</guid>
            <pubDate>Fri, 13 Mar 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[It has been a while since our last Stryker.NET blog post. The team has been quietly shipping a lot of improvements, and today we want to highlight the biggest one: Microsoft Testing Platform (MTP) support, now available in preview starting from Stryker.NET 4.13.]]></description>
            <content:encoded><![CDATA[<p>It has been a while since our last Stryker.NET blog post. The team has been quietly shipping a lot of improvements, and today we want to highlight the biggest one: <strong>Microsoft Testing Platform (MTP) support</strong>, now available in preview starting from Stryker.NET 4.13.</p>
<p>We also have a roundup of other noteworthy features that have landed since our last update.</p>
<!-- -->
<p>Are you already using Stryker.NET? Update to the latest version:</p>
<p>Global install:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">dotnet tool update dotnet-stryker --global</span><br></div></code></pre></div></div>
<p>Local install:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">dotnet tool update dotnet-stryker --local</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-microsoft-testing-platform-runner-preview">🚀 Microsoft Testing Platform runner (preview)<a href="https://stryker-mutator.io/blog/stryker-net-mtp-runner/#-microsoft-testing-platform-runner-preview" class="hash-link" aria-label="Direct link to 🚀 Microsoft Testing Platform runner (preview)" title="Direct link to 🚀 Microsoft Testing Platform runner (preview)" translate="no">​</a></h2>
<p>Stryker.NET has long relied on <strong>VSTest</strong> as its test runner. VSTest works well, but it has a fundamental limitation: Stryker has to spin up a brand new VSTest process for every mutation test run. On large test suites, that startup overhead adds up quickly.</p>
<p>Microsoft has been building a modern alternative called the <a href="https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-platform-intro" target="_blank" rel="noopener noreferrer" class="">Microsoft Testing Platform (MTP)</a>. MTP is already being adopted by all the major testing frameworks (MSTest, NUnit, and xUnit v3) and it is the <em>only</em> supported runner for newer frameworks such as <a href="https://github.com/thomhurst/TUnit" target="_blank" rel="noopener noreferrer" class="">TUnit</a>. Until now, projects using these frameworks could not use Stryker.NET at all.</p>
<p>We're excited to announce that <strong>MTP support is now available in preview</strong> in Stryker.NET 4.13.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="how-to-enable-it">How to enable it<a href="https://stryker-mutator.io/blog/stryker-net-mtp-runner/#how-to-enable-it" class="hash-link" aria-label="Direct link to How to enable it" title="Direct link to How to enable it" translate="no">​</a></h3>
<p>Enable the MTP runner by passing <code>--test-runner mtp</code> on the command line:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">dotnet stryker --test-runner mtp</span><br></div></code></pre></div></div>
<p>Or add it to your <code>stryker-config.json</code>:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"stryker-config"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token property" style="color:#36acaa">"test-runner"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"mtp"</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>Or in <code>stryker-config.yaml</code>:</p>
<div class="language-yaml codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-yaml codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token key atrule" style="color:#00a4db">stryker-config</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token key atrule" style="color:#00a4db">test-runner</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> mtp</span><br></div></code></pre></div></div>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="performance-benefits">Performance benefits<a href="https://stryker-mutator.io/blog/stryker-net-mtp-runner/#performance-benefits" class="hash-link" aria-label="Direct link to Performance benefits" title="Direct link to Performance benefits" translate="no">​</a></h3>
<p>Because MTP is designed to be embedded and extended rather than being a self-contained external process, Stryker can keep the test runner alive across multiple mutation test runs. This eliminates the per-run startup cost that made VSTest slow on larger projects, and is expected to provide a significant performance improvement.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="preview-status--what-still-needs-work">Preview status — what still needs work<a href="https://stryker-mutator.io/blog/stryker-net-mtp-runner/#preview-status--what-still-needs-work" class="hash-link" aria-label="Direct link to Preview status — what still needs work" title="Direct link to Preview status — what still needs work" translate="no">​</a></h3>
<p>The MTP runner is <strong>still in preview</strong>. Coverage analysis is partially implemented: Stryker can already filter out mutants that are not covered by any test, but it cannot yet filter individual test cases per mutant. Full per-test coverage analysis is still being worked on.</p>
<p>Additionally, the MTP runner does not yet support <strong>.NET Framework</strong> test projects (see <a href="https://github.com/stryker-mutator/stryker-net/issues/3421" target="_blank" rel="noopener noreferrer" class="">#3421</a>).</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="we-need-your-feedback">We need your feedback!<a href="https://stryker-mutator.io/blog/stryker-net-mtp-runner/#we-need-your-feedback" class="hash-link" aria-label="Direct link to We need your feedback!" title="Direct link to We need your feedback!" translate="no">​</a></h3>
<p>Because this is a preview feature, your feedback is essential. If you encounter any issues or unexpected results when using the MTP runner, please <a href="https://github.com/stryker-mutator/stryker-net/issues" target="_blank" rel="noopener noreferrer" class="">open an issue on GitHub</a> or reach out on our <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">Slack channel</a>. We want to make this stable as soon as possible, and every bug report helps!</p>
<hr>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-other-noteworthy-updates">📰 Other noteworthy updates<a href="https://stryker-mutator.io/blog/stryker-net-mtp-runner/#-other-noteworthy-updates" class="hash-link" aria-label="Direct link to 📰 Other noteworthy updates" title="Direct link to 📰 Other noteworthy updates" translate="no">​</a></h2>
<p>A lot has changed since our February 2024 blog post. Here are the highlights.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="new-mutators">New mutators<a href="https://stryker-mutator.io/blog/stryker-net-mtp-runner/#new-mutators" class="hash-link" aria-label="Direct link to New mutators" title="Direct link to New mutators" translate="no">​</a></h3>
<p>Two new mutation categories have been added to Stryker.NET's arsenal.</p>
<p><strong>String method mutations</strong> (<code>stringmethod</code>): Stryker now mutates common string manipulation methods. For example:</p>
<table><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td><code>ToUpper()</code></td><td><code>ToLower()</code></td></tr><tr><td><code>ToLower()</code></td><td><code>ToUpper()</code></td></tr><tr><td><code>Trim()</code></td><td><code>""</code></td></tr><tr><td><code>TrimStart()</code></td><td><code>TrimEnd()</code></td></tr><tr><td><code>TrimEnd()</code></td><td><code>TrimStart()</code></td></tr><tr><td><code>StartsWith()</code></td><td><code>EndsWith()</code></td></tr><tr><td><code>EndsWith()</code></td><td><code>StartsWith()</code></td></tr><tr><td><code>PadLeft()</code></td><td><code>PadRight()</code></td></tr><tr><td><code>IndexOf()</code></td><td><code>LastIndexOf()</code></td></tr><tr><td><code>Substring()</code></td><td><code>""</code></td></tr></tbody></table>
<p>These mutations are particularly good at catching code where the direction or casing of a string operation was never actually tested.</p>
<p><strong>List pattern mutations</strong>: Stryker now mutates C# list pattern syntax. When code uses <code>is [...]</code> patterns to match the structure of a collection, Stryker will test that the pattern is actually meaningful by swapping or removing elements. This brings mutation testing to a modern and increasingly popular C# feature.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="yaml-config-file-support">YAML config file support<a href="https://stryker-mutator.io/blog/stryker-net-mtp-runner/#yaml-config-file-support" class="hash-link" aria-label="Direct link to YAML config file support" title="Direct link to YAML config file support" translate="no">​</a></h3>
<p>Stryker configuration files can now be written in <strong>YAML</strong> in addition to JSON. If you prefer YAML, simply create a <code>stryker-config.yaml</code> (or <code>stryker-config.yml</code>) file alongside your project:</p>
<div class="language-yaml codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-yaml codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token key atrule" style="color:#00a4db">stryker-config</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token key atrule" style="color:#00a4db">project</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'MyProject.csproj'</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token key atrule" style="color:#00a4db">reporters</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">-</span><span class="token plain"> html</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">-</span><span class="token plain"> progress</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token key atrule" style="color:#00a4db">thresholds</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token key atrule" style="color:#00a4db">high</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">80</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token key atrule" style="color:#00a4db">low</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">60</span><br></div></code></pre></div></div>
<p>The file will be picked up automatically without any additional options.</p>
<hr>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-thats-a-wrap">🌯 That's a wrap<a href="https://stryker-mutator.io/blog/stryker-net-mtp-runner/#-thats-a-wrap" class="hash-link" aria-label="Direct link to 🌯 That's a wrap" title="Direct link to 🌯 That's a wrap" translate="no">​</a></h2>
<p>There is a lot to explore here. We are especially excited about the MTP runner and the doors it opens for teams using xUnit v3, NUnit's new MTP mode, or the excellent TUnit framework. Give it a try and let us know how it goes!</p>
<p>As always, we'd love to hear your thoughts on <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">our Slack channel</a>, open an <a href="https://github.com/stryker-mutator/stryker-net/issues" target="_blank" rel="noopener noreferrer" class="">issue on GitHub</a>, or send us a <a href="https://twitter.com/stryker_mutator/" target="_blank" rel="noopener noreferrer" class="">tweet</a>.</p>]]></content:encoded>
            <category>stryker-net</category>
        </item>
        <item>
            <title><![CDATA[Announcing the Stryker VS Code Plugin]]></title>
            <link>https://stryker-mutator.io/blog/vscode-plugin/</link>
            <guid>https://stryker-mutator.io/blog/vscode-plugin/</guid>
            <pubDate>Fri, 07 Nov 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to announce the release of the official Stryker Mutator VS Code plugin! 🎉]]></description>
            <content:encoded><![CDATA[<p>We're excited to announce the release of the official Stryker Mutator VS Code plugin! 🎉</p>
<p>With this plugin, you can easily integrate Stryker into your development workflow, allowing you to run mutation tests directly from the comfort of your code editor.</p>
<!-- -->
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-the-plugin">🧑‍💻 The plugin<a href="https://stryker-mutator.io/blog/vscode-plugin/#-the-plugin" class="hash-link" aria-label="Direct link to 🧑‍💻 The plugin" title="Direct link to 🧑‍💻 The plugin" translate="no">​</a></h2>
<p>To install the Stryker Mutator VS Code plugin, visit the <a href="https://marketplace.visualstudio.com/items?itemName=stryker-mutator.stryker-mutator" target="_blank" rel="noopener noreferrer" class="">Visual Studio Code Marketplace</a> and click on the "Install" button. At the moment of writing, the plugin only supports StrykerJS (v9.3.0 or higher), but support for other Stryker flavors is on the roadmap.</p>
<p>Key features of the Stryker Mutator VS Code plugin include:</p>
<ul>
<li class="">🚀 <strong>Real-time feedback</strong> directly in your code editor. See which mutants survive or are killed without leaving your editor.</li>
<li class="">🧭 <strong>Test Explorer integration</strong>. Browse discover and test mutants per file, folder, or individually.</li>
<li class="">👀 <strong>Inline annotations and diff views</strong>. Instantly see how each mutation changed your code, and whether your tests caught it.</li>
<li class="">🔁 <strong>Streamlined workflow</strong>. No need to jump between CLI, browser reports, and code. Everything happens in your IDE.</li>
</ul>
<p>Some impressions 😎</p>
<p><img decoding="async" loading="lazy" alt="Test explorer" src="https://stryker-mutator.io/assets/images/vscode-plugin-test-explorer-c7046fd28297c3f8bbb3641da8e57f3b.gif" width="1146" height="869" class="img_Qldj"></p>
<p>As you can see, we're using the <a href="https://code.visualstudio.com/docs/debugtest/testing#_automatic-test-discovery-in-testing-view" target="_blank" rel="noopener noreferrer" class="">Test Explorer</a> to provide a familiar interface for running and exploring mutants. They are reported as tests, which comes with a lot of built-in functionality, such as filtering, showing mutants in a diff view, and more.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-mutation-server-protocol">💬 Mutation Server Protocol<a href="https://stryker-mutator.io/blog/vscode-plugin/#-mutation-server-protocol" class="hash-link" aria-label="Direct link to 💬 Mutation Server Protocol" title="Direct link to 💬 Mutation Server Protocol" translate="no">​</a></h2>
<p>Instead of creating a custom plugin for each editor for each Stryker flavor, we created the <a href="https://github.com/stryker-mutator/editor-plugins/tree/main/packages/mutation-server-protocol#mutation-server-protocol-specification" target="_blank" rel="noopener noreferrer" class="">Mutation Server Protocol (MSP)</a>. MSP is a simple JSON-RPC based protocol that allows any editor to communicate with a Stryker Mutator instance, similar to the <a href="https://microsoft.github.io/language-server-protocol/" target="_blank" rel="noopener noreferrer" class="">Language Server Protocol (LSP)</a>. This is effectively a language-agnostic standard for running mutation testing (which could even be used outside of editors).</p>
<p>Any mutation testing framework can implement it. Similarly, any editor can create a plugin that speaks MSP. This opens up mutation testing to a wider audience and makes it easier to integrate mutation testing into various development environments.</p>
<p>At the moment of writing, the MSP is on version 0.4. It provides basic functionality for discovering and testing mutants, as well as reporting results back to the editor. We're actively working on expanding the protocol to include more features and capabilities.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-roadmap">🚧 Roadmap<a href="https://stryker-mutator.io/blog/vscode-plugin/#-roadmap" class="hash-link" aria-label="Direct link to 🚧 Roadmap" title="Direct link to 🚧 Roadmap" translate="no">​</a></h2>
<p>The Stryker Mutator VS Code plugin is just the beginning. Here are some features we're planning to add in the near future:</p>
<ul>
<li class="">🌐 <strong>Support for other Stryker flavors</strong>: Expanding support to include Stryker.NET, Stryker4s, and possibly more.</li>
<li class="">📊 <strong>Enhanced reporting</strong>: More detailed mutation testing reports and visualizations.</li>
<li class="">⚙️ <strong>Configuration management</strong>: Ability to manage Stryker configuration files directly from VS Code.</li>
<li class="">🤝 <strong>Community contributions</strong>: What would you like to see in the Stryker Mutator VS Code plugin? We're open to suggestions and contributions.</li>
</ul>
<p>Come to our <a href="https://github.com/stryker-mutator/editor-plugins/issues" target="_blank" rel="noopener noreferrer" class="">GitHub repository's issue tracker</a> and let us know your thoughts!</p>
<p>We can't wait to see how the Stryker Mutator VS Code plugin enhances your testing experience! Happy coding! 🚀</p>]]></content:encoded>
            <category>vscode-plugin</category>
            <category>strykerjs</category>
        </item>
        <item>
            <title><![CDATA[Stryker.NET 4.0 is here!]]></title>
            <link>https://stryker-mutator.io/blog/stryker-net-4-is-here/</link>
            <guid>https://stryker-mutator.io/blog/stryker-net-4-is-here/</guid>
            <pubDate>Fri, 16 Feb 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Hello there! We're excited to share some fantastic news about the latest version of Stryker.NET. We hit a huge milestone of 2 million downloads! 🥳 The team has been hard at work and has introduced some significant updates that will enhance the user experience and functionality of the platform.]]></description>
            <content:encoded><![CDATA[<p>Hello there! We're excited to share some fantastic news about the latest version of Stryker.NET. We hit a huge milestone of 2 million downloads! 🥳 The team has been hard at work and has introduced some significant updates that will enhance the user experience and functionality of the platform.</p>
<!-- -->
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-breaking-change">💥 Breaking Change<a href="https://stryker-mutator.io/blog/stryker-net-4-is-here/#-breaking-change" class="hash-link" aria-label="Direct link to 💥 Breaking Change" title="Direct link to 💥 Breaking Change" translate="no">​</a></h2>
<p>First and foremost, one of the most notable changes is the upgrade of the .NET runtime from dotnet 6 to dotnet 8. This update brings with it improved performance and LTS, ensuring that Stryker.NET remains at the forefront of development tools.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-new">🚀 What's New<a href="https://stryker-mutator.io/blog/stryker-net-4-is-here/#-whats-new" class="hash-link" aria-label="Direct link to 🚀 What's New" title="Direct link to 🚀 What's New" translate="no">​</a></h2>
<p>In addition to the runtime update, users will be thrilled to learn that the dashboard now supports live reporting. This means that users can now view and analyze real-time data, providing them with valuable insights into the performance of their projects. Even when Stryker is being run in a pipeline.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-in-other-news">📰 In Other News<a href="https://stryker-mutator.io/blog/stryker-net-4-is-here/#-in-other-news" class="hash-link" aria-label="Direct link to 📰 In Other News" title="Direct link to 📰 In Other News" translate="no">​</a></h2>
<p>Since version <code>3.13.0</code> we support initializing a config file straight from the command line.</p>
<div class="language-text codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-text codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">dotnet stryker init --project myproject.csproj</span><br></div></code></pre></div></div>
<p>This command will create a new config file at the commands current location. It will fill the config file with default values for all file based options. Any options passed as CLI options will also be saved in the newly created config file.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's Next?<a href="https://stryker-mutator.io/blog/stryker-net-4-is-here/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's Next?" title="Direct link to 🔮 What's Next?" translate="no">​</a></h2>
<p>As part of the evolution of the platform, the decision has been made to deprecate baseline &amp; since as global options. Instead they will be implemented as distinct subcommands to indicate that they are distinct modes of operation.</p>
<p>The commands will probably look like this:</p>
<div class="language-text codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-text codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">dotnet stryker with-baseline feat-2</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">dotnet stryker baseline recreate feat-2</span><br></div></code></pre></div></div>
<p>While this may require some adjustment for existing users, the team is confident that this change will streamline the user experience and pave the way for future enhancements.</p>
<p>We are also deprecating support for spans in the mutate option. Using file spans in the mutate option is to fragile and should not be used. A replacement for this feature exists in the form of <a class="" href="https://stryker-mutator.io/docs/stryker-net/ignore-mutations/#stryker-comments">stryker comments</a>. This change aligns with the team's focus on optimizing and simplifying the platform, ensuring that users can efficiently navigate and utilize its features without unnecessary complexity.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-research">🔬 Research<a href="https://stryker-mutator.io/blog/stryker-net-4-is-here/#-research" class="hash-link" aria-label="Direct link to 🔬 Research" title="Direct link to 🔬 Research" translate="no">​</a></h2>
<p>Improving the speed of Stryker.NET is our top priority. That's why we will investigate how to utilize VSTest in a better way. Other Stryker frameworks have seen big performance improvement by keeping their testrunners alive between testruns. VSTest sadly doesn't support this, so we need to spin up a new instance of VSTest for each testrun. This has a big negative impact on the performance of Stryker. We hope to gain a massive performance boost 🚀</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-thats-a-wrap">🌯 That's a wrap<a href="https://stryker-mutator.io/blog/stryker-net-4-is-here/#-thats-a-wrap" class="hash-link" aria-label="Direct link to 🌯 That's a wrap" title="Direct link to 🌯 That's a wrap" translate="no">​</a></h2>
<p>With these updates, the latest version of Stryker.NET represents a significant step forward in empowering developers to build and test their code with greater efficiency and accuracy. The team is dedicated to continuously improving the platform, and these changes reflect our commitment to delivering a top-tier development experience.</p>
<p>Stay tuned for more exciting updates and features from Stryker.NET as the platform continues to evolve and adapt to the ever-changing landscape of software development.</p>
<p>In the meantime, we'd love to hear your thoughts. Any feedback is appreciated, on <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">our Slack channel</a>, our baseline project on <a href="https://github.com/orgs/stryker-mutator/projects/7" target="_blank" rel="noopener noreferrer" class="">github</a>, or send us a <a href="https://twitter.com/stryker_mutator/" target="_blank" rel="noopener noreferrer" class="">tweet</a>.</p>]]></content:encoded>
            <category>stryker-net</category>
        </item>
        <item>
            <title><![CDATA[Stryker4s 0.15 is Here with Exciting New Features!]]></title>
            <link>https://stryker-mutator.io/blog/stryker4s-0-15-is-here/</link>
            <guid>https://stryker-mutator.io/blog/stryker4s-0-15-is-here/</guid>
            <pubDate>Wed, 18 Oct 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to announce the arrival of Stryker4s 0.15. This latest release is filled with exciting new features. It's been a while since our last update, but we think you'll find this one worth the wait.]]></description>
            <content:encoded><![CDATA[<p>We're excited to announce the arrival of <strong>Stryker4s 0.15</strong>. This latest release is filled with exciting new features. It's been a while since our last update, but we think you'll find this one worth the wait.</p>
<p>In this article, we'll guide you through the highlights of this release, including <strong>colorized console output</strong>, a <strong>revamped instrumenting algorithm</strong>, and various <strong>new configuration options</strong>.</p>
<!-- -->
<p><strong>New to mutation testing?</strong> It's a unique way to assess the quality of your tests. Check out our <a class="" href="https://stryker-mutator.io/docs/General/example/">RoboCoasters 🤖🎢 example</a> to understand why 100% code coverage doesn't tell the whole story. You can also explore our <a href="https://stryker-mutator.io/stryker-playground/" target="_blank" rel="noopener noreferrer" class="">new playground to experience mutation testing in action (C#)</a>. Mutation testing is the key to gauging the effectiveness of your tests.</p>
<p>To update or install Stryker4s, adjust your <code>plugins.sbt</code> file:</p>
<div class="language-scala codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-scala codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">addSbtPlugin</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"io.stryker-mutator"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"sbt-stryker4s"</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">%</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"0.15.0"</span><span class="token punctuation" style="color:#393A34">)</span><br></div></code></pre></div></div>
<p>For Maven users:</p>
<div class="language-xml codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-xml codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">plugin</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">io.stryker-mutator</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">stryker4s-maven-plugin</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">version</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">0.15.0</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">version</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">plugin</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-colorized-console-output">🌈 Colorized Console Output<a href="https://stryker-mutator.io/blog/stryker4s-0-15-is-here/#-colorized-console-output" class="hash-link" aria-label="Direct link to 🌈 Colorized Console Output" title="Direct link to 🌈 Colorized Console Output" translate="no">​</a></h2>
<p>We've added color to your console output, making it easier to identify essential details. This feature is enabled by default, but you can disable it by setting the <code>NO_COLOR</code> environment variable to <code>true</code>. Stryker4s also strives to automatically adapt to your terminal's capabilities for colorized output. Here's a glimpse of the new output:</p>
<p><img decoding="async" loading="lazy" alt="Colorized console output of Stryker4s" src="https://stryker-mutator.io/assets/images/stryker4s-colors-start-c3e90e56008f6b0d53a1b9b81373b681.webp" width="960" height="154" class="img_Qldj"></p>
<p><img decoding="async" loading="lazy" alt="Colorized Stryker4s report" src="https://stryker-mutator.io/assets/images/stryker4s-colors-report-1ced34ead94486fb86991d921b2f78d2.webp" width="1280" height="1235" class="img_Qldj"></p>
<p>We're eager to hear your thoughts on these new colors. If you have suggestions or prefer different adjustments, feel free to <a href="https://github.com/stryker-mutator/stryker4s/issues/new" target="_blank" rel="noopener noreferrer" class="">create a new issue</a> or leave a comment below 👇.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-revamped-instrumenting-algorithm">🧬 Revamped Instrumenting Algorithm<a href="https://stryker-mutator.io/blog/stryker4s-0-15-is-here/#-revamped-instrumenting-algorithm" class="hash-link" aria-label="Direct link to 🧬 Revamped Instrumenting Algorithm" title="Direct link to 🧬 Revamped Instrumenting Algorithm" translate="no">​</a></h2>
<p>Before Stryker4s begins running your tests, it must parse and instrument your source code with mutants. We've completely overhauled this process, making it more robust and efficient. The new instrumenter, inspired by StrykerJS, streamlines the process. It also takes advantage of <a href="https://fs2.io/" target="_blank" rel="noopener noreferrer" class="">fs2</a> for parallel streaming, significantly boosting performance. This means Stryker4s can start running your tests faster!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-new-dialects">💬 New Dialects<a href="https://stryker-mutator.io/blog/stryker4s-0-15-is-here/#-new-dialects" class="hash-link" aria-label="Direct link to 💬 New Dialects" title="Direct link to 💬 New Dialects" translate="no">​</a></h2>
<p>Scala is a fast-evolving language, and to ensure compatibility, we already had the <a class="" href="https://stryker-mutator.io/docs/stryker4s/configuration/#scala-dialect-string"><code>scala-dialect</code></a> config option. In Stryker4s 0.15, we've introduced the <code>source3</code> option for Scala 2 codebases using the <code>-Xsource3</code> flag and the <code>scala3future</code> option for Scala 3 codebases with the <code>-source:future</code> flag 📡.</p>
<p><a href="https://github.com/fabianhjr" target="_blank" rel="noopener noreferrer" class="">@fabianhjr</a> has also resolved an issue where mutated code wasn't correctly written back to disk using the correct dialect. This mainly affected Scala 3 codebases. Thanks for the fix!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-new-configuration-options">📝 New Configuration Options<a href="https://stryker-mutator.io/blog/stryker4s-0-15-is-here/#-new-configuration-options" class="hash-link" aria-label="Direct link to 📝 New Configuration Options" title="Direct link to 📝 New Configuration Options" translate="no">​</a></h2>
<p>We've added several configuration options to offer more flexibility. The first is the <a class="" href="https://stryker-mutator.io/docs/stryker4s/configuration/#clean-tmp-dir-boolean"><code>clean-tmp-dir</code></a> option, which defaults to <code>true</code>. When disabled, Stryker4s won't clean the temporary directory used for instrumented code, which can be handy for debugging. Combine this with <a class="" href="https://stryker-mutator.io/docs/stryker4s/configuration/#static-tmp-dir-boolean"><code>static-tmp-dir</code></a>, and Stryker4s will use the same temporary directory for each run. Both of these options were contributed by <a href="https://github.com/gergelytraveltime" target="_blank" rel="noopener noreferrer" class="">@gergelytraveltime</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-maven-plugin-update">📦 Maven Plugin Update<a href="https://stryker-mutator.io/blog/stryker4s-0-15-is-here/#-maven-plugin-update" class="hash-link" aria-label="Direct link to 📦 Maven Plugin Update" title="Direct link to 📦 Maven Plugin Update" translate="no">​</a></h2>
<p>Our Maven plugin now builds on Scala 2.13. You can still run Stryker4s with your preferred Scala version, but the plugin itself is now built on 2.13. If you encounter any issues, please don't hesitate to reach out.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's Next?<a href="https://stryker-mutator.io/blog/stryker4s-0-15-is-here/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's Next?" title="Direct link to 🔮 What's Next?" translate="no">​</a></h2>
<p>What's on the horizon? Look forward to the upcoming <a class="" href="https://stryker-mutator.io/blog/announcing-realtime-reporting-for-stryker/">real-time HTML report</a> for Stryker4s, along with test information integrated into the HTML report. This will help you determine which tests successfully battled the mutants and which didn't.</p>
<p>In the long term, we're exploring the possibility of expanding Stryker4s to other JVM languages, starting with Kotlin. It's a significant undertaking, but stay tuned for updates!</p>
<p>In the meantime, we'd love to hear your thoughts. Share your feedback in the comments below 👇, on <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">our Slack channel</a>, or send us a <a href="https://twitter.com/stryker_mutator/" target="_blank" rel="noopener noreferrer" class="">tweet</a>.</p>]]></content:encoded>
            <category>stryker4s</category>
        </item>
        <item>
            <title><![CDATA[Announcing the Stryker Playground]]></title>
            <link>https://stryker-mutator.io/blog/announcing-stryker-playground/</link>
            <guid>https://stryker-mutator.io/blog/announcing-stryker-playground/</guid>
            <pubDate>Fri, 23 Jun 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Explaining the intricacies of mutation testing to a co-worker or friend can be challenging.]]></description>
            <content:encoded><![CDATA[<p>Explaining the intricacies of mutation testing to a co-worker or friend can be challenging.
We believe the best way to grasp a new concept is through hands-on practice.
While we already offer a <a class="" href="https://stryker-mutator.io/docs/General/example/">quickstart guide</a>, installing all the prerequisites can be quite cumbersome.</p>
<p>That is why we are happy to announce the <a href="https://stryker-mutator.io/stryker-playground/" target="_blank" rel="noopener noreferrer" class="">Stryker Playground</a>, bringing the Stryker.NET experience to the web!</p>
<!-- -->
<p><img decoding="async" loading="lazy" alt="Pending mutants" src="https://stryker-mutator.io/assets/images/playground-5a36ecac6ff0f4bb870a003bb8012002.png" width="2257" height="1537" class="img_Qldj"></p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-how-does-this-work">🤔 How does this work?<a href="https://stryker-mutator.io/blog/announcing-stryker-playground/#-how-does-this-work" class="hash-link" aria-label="Direct link to 🤔 How does this work?" title="Direct link to 🤔 How does this work?" translate="no">​</a></h2>
<p>You may have noticed the playground takes a while to load initially.
That is because it's entirely client-side, powered by Blazor WebAssembly.
Compiling the submitted code into an in-memory assembly is made possible by Roslyn, the .NET Compiler Platform.
And, of course, the playground also depends on Stryker.NET for the instrumentation.</p>
<p>Thanks to the <a href="https://docs.nunit.org/articles/nunit/running-tests/NUnitLite-Runner.html" target="_blank" rel="noopener noreferrer" class="">NUnit Lite Runner</a> we're able to discover and execute tests contained inside in-memory assemblies.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-on-the-horizon">🔮 What's on the horizon?<a href="https://stryker-mutator.io/blog/announcing-stryker-playground/#-whats-on-the-horizon" class="hash-link" aria-label="Direct link to 🔮 What's on the horizon?" title="Direct link to 🔮 What's on the horizon?" translate="no">​</a></h2>
<p>We're looking for ways to improve intellisense, which should make it easier to freely write code and discover available methods and variables.
We would also like to introduce a diverse collection of templates, offering users challenges of varying difficulties.</p>
<p>And last but not least, supporting StrykerJs &amp; Stryker4s is also on the roadmap!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-share-your-feedback">📣 Share your feedback<a href="https://stryker-mutator.io/blog/announcing-stryker-playground/#-share-your-feedback" class="hash-link" aria-label="Direct link to 📣 Share your feedback" title="Direct link to 📣 Share your feedback" translate="no">​</a></h2>
<p>We value your input! Try out <a href="https://stryker-mutator.io/stryker-playground/" target="_blank" rel="noopener noreferrer" class="">the playground</a> and let us know what you think.</p>
<p>If you happen to have any issues or have suggestions for improvement, please feel free to <a href="https://github.com/stryker-mutator/stryker-playground/issues" target="_blank" rel="noopener noreferrer" class="">open an issue on Github</a>.</p>]]></content:encoded>
            <category>stryker-net</category>
        </item>
        <item>
            <title><![CDATA[Announcing StrykerJS 7.0: Vitest and Tap test runner support]]></title>
            <link>https://stryker-mutator.io/blog/announcing-stryker-js-7/</link>
            <guid>https://stryker-mutator.io/blog/announcing-stryker-js-7/</guid>
            <pubDate>Mon, 05 Jun 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Welcome to the latest major release of StrykerJS, version 7.0!]]></description>
            <content:encoded><![CDATA[<p>Welcome to the latest major release of StrykerJS, version 7.0!</p>
<p>We are excited to introduce you to 2 new friends: ⚡ <em><a href="https://vitest.dev/" target="_blank" rel="noopener noreferrer" class="">Vitest</a></em> and 📼 <a href="https://node-tap.org/" target="_blank" rel="noopener noreferrer" class=""><em>Node Tap</em></a>. There are also some quality-of-life improvements and some (minor) breaking changes.</p>
<!-- -->
<p>To update to the latest version of StrykerJS, install <code>@latest</code> as follows:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/core@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/core@latest</span><br></div></code></pre></div></div>
<p>Remember to update Stryker plugins. For example, when using the mocha runner:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/mocha-runner@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/mocha-runner@latest</span><br></div></code></pre></div></div>
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. Please take a look at our RoboCoasters 🤖🎢 example and see how even 100% code coverage doesn't tell the whole story. Mutation testing is the only way to know if your tests are any good.
In this blog article, we will walk you through the highlights of this release, including new test runners, enhanced options, and important breaking changes.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-new-friends">👩‍👦 New friends<a href="https://stryker-mutator.io/blog/announcing-stryker-js-7/#-new-friends" class="hash-link" aria-label="Direct link to 👩‍👦 New friends" title="Direct link to 👩‍👦 New friends" translate="no">​</a></h2>
<p>So why did we choose to add support for ⚡ Vitest and 📼 Node Tap? Well, it is simple, they are both popular.</p>
<p>⚡ Vitest is <a href="https://npm-stat.com/charts.html?package=vitest&amp;from=2022-01-01" target="_blank" rel="noopener noreferrer" class="">rapidly growing</a> and is considered the de facto standard for projects using <a href="https://vitejs.dev/" target="_blank" rel="noopener noreferrer" class="">Vite</a>, which in turn, is also <a href="https://npm-stat.com/charts.html?package=vite&amp;from=2021-01-01" target="_blank" rel="noopener noreferrer" class="">rapidly increasing in popularity</a>. As such, it is the new standard for running tests in Vue-based projects and many others. And even though Vitest is rapidly changing (they don't have a <code>v1</code> release yet), we thought it would be best not to wait any longer, as it was <a href="https://github.com/stryker-mutator/stryker-js/issues/3465" target="_blank" rel="noopener noreferrer" class="">our most upvoted feature request</a> with 40 votes!</p>
<p>The story for 📼 Node Tap is quite different. Node Tap has been a steady and stable test runner <a href="https://npm-stat.com/charts.html?package=tap&amp;from=2020-01-01" target="_blank" rel="noopener noreferrer" class="">for years now</a>. Indeed, we've had <a href="https://github.com/stryker-mutator/stryker-js/issues/325" target="_blank" rel="noopener noreferrer" class="">an open issue about it since 2017!</a>. Node Tap has some <a href="https://node-tap.org/#why-tap" target="_blank" rel="noopener noreferrer" class="">clear design goals</a>, like <em>Test files should be "normal" programs that can be run directly</em>, making it popular with the NodeJS tooling world. You might have heard of some of the tools that are using it: <a href="https://github.com/isaacs/rimraf" target="_blank" rel="noopener noreferrer" class="">rimraf</a>, <a href="https://www.npmjs.com/package/json5" target="_blank" rel="noopener noreferrer" class="">json5</a>, <a href="https://www.npmjs.com/package/tar" target="_blank" rel="noopener noreferrer" class="">tar</a> and even <a href="https://github.com/npm/cli" target="_blank" rel="noopener noreferrer" class="">npm itself</a>. Since Node v16, Node ships with a <a href="https://nodejs.org/api/test.html" target="_blank" rel="noopener noreferrer" class="">TAP based test runner</a> of its own, which the new plugin also supports!</p>
<p>Without further ado, let's dive in 🏊‍♂️.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-vitest-support">⚡ Vitest support<a href="https://stryker-mutator.io/blog/announcing-stryker-js-7/#-vitest-support" class="hash-link" aria-label="Direct link to ⚡ Vitest support" title="Direct link to ⚡ Vitest support" translate="no">​</a></h2>
<p>Vitest is a test runner explicitly designed for the popular Vite build tool. With Stryker 7.0, you can finally use mutation testing for your Vitest projects.</p>
<p>Install it using your favorite package manager:</p>
<div class="language-bash codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-bash codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">$ npm i -D @stryker-mutator/vitest-runner</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">$ yarn add -D @stryker-mutator/vitest-runner</span><br></div></code></pre></div></div>
<p>And configure it with:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"testRunner"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"vitest"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"vitest"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token property" style="color:#36acaa">"configFile"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"vitest.config.js"</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>As you can see, Stryker allows you to configure an alternative config file. Not specifying a config file will honor the <a href="https://vitest.dev/config/" target="_blank" rel="noopener noreferrer" class="">vitest defaults</a>, allowing for seamless integration with Vite-powered projects.</p>
<p>This plugin comes with all the StrykerJS features you love, including coverage analysis support and fine-grained test filtering for mutants, which increases performance.</p>
<p>See the <a class="" href="https://stryker-mutator.io/docs/stryker-js/vitest-runner/">vitest runner</a> documentation for more details.</p>
<p>💐 Special thanks go to <a href="https://github.com/odinvanderlinden" target="_blank" rel="noopener noreferrer" class="">@odinvanderlinden</a> for implementing the plugin, and <a href="https://twitter.com/sheremet_va" target="_blank" rel="noopener noreferrer" class="">sheremet_va</a> for adding programmatic support on the Vitest side ❤.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-tap-support">📼 TAP support<a href="https://stryker-mutator.io/blog/announcing-stryker-js-7/#-tap-support" class="hash-link" aria-label="Direct link to 📼 TAP support" title="Direct link to 📼 TAP support" translate="no">​</a></h2>
<p><a href="https://node-tap.org/" target="_blank" rel="noopener noreferrer" class="">Node Tap</a> is a test runner specializing in running test files in Node.js and producing <a href="https://en.wikipedia.org/wiki/Test_Anything_Protocol" target="_blank" rel="noopener noreferrer" class="">TAP (<strong>T</strong>est <strong>A</strong>nything <strong>P</strong>rotocol) output</a>.</p>
<p>However, instead of integrating with this test runner, this plugin enables <em>running any test files that produce TAP output</em>. One of these test runners is the <a href="https://nodejs.org/api/test.html" target="_blank" rel="noopener noreferrer" class="">new Node Test runner</a> that was added in Node v16.17.0 (experimental) and has been stable since Node v20. Using this concept, Stryker stays close to the <a href="https://node-tap.org/#why-tap" target="_blank" rel="noopener noreferrer" class="">TAP design goals</a>: <em>Test files should be "normal" programs that can be run directly</em></p>
<p>Install the tap runner using your favorite package manager:</p>
<div class="language-bash codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-bash codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">$ npm i -D @stryker-mutator/tap-runner</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">$ yarn add -D @stryker-mutator/tap-runner</span><br></div></code></pre></div></div>
<p>And configure it with:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"testRunner"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"tap"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"tap"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token property" style="color:#36acaa">"testFiles"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"test/**/*.spec.js"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>See the <a class="" href="https://stryker-mutator.io/docs/stryker-js/tap-runner/">tap runner documentation</a> for more details.</p>
<p>💐 Special thanks go to <a href="https://github.com/danny12321" target="_blank" rel="noopener noreferrer" class="">@danny12321</a> for implementing this plugin, and <a href="https://github.com/isaacs" target="_blank" rel="noopener noreferrer" class="">isaacs</a> for help in the design ❤</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-allow-empty">📭 Allow empty<a href="https://stryker-mutator.io/blog/announcing-stryker-js-7/#-allow-empty" class="hash-link" aria-label="Direct link to 📭 Allow empty" title="Direct link to 📭 Allow empty" translate="no">​</a></h2>
<p>By default, Stryker will exit with an error when it cannot find any tests. This behavior is excellent for when you've misconfigured Stryker, reminding you to fix the configuration and try again.</p>
<p>In more complex setups, you might extract from the pull request which lines of code were exactly affected and pass only those files to Stryker. In this case, you may intend no tests to run.</p>
<p>To support this scenario, you can now provide <a class="" href="https://stryker-mutator.io/docs/stryker-js/configuration/#allowempty-boolean"><code>--allowEmpty</code></a> (or equivalent in config file). With this flag enabled, Stryker will exit with a successful exit code (0) when no tests were executed.</p>
<p>💐 Special thanks go to <a href="https://github.com/emir7" target="_blank" rel="noopener noreferrer" class="">@emir7</a> for implementing this feature.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-always-clean-the-temp-dir">🧹 Always clean the temp dir<a href="https://stryker-mutator.io/blog/announcing-stryker-js-7/#-always-clean-the-temp-dir" class="hash-link" aria-label="Direct link to 🧹 Always clean the temp dir" title="Direct link to 🧹 Always clean the temp dir" translate="no">​</a></h2>
<p>StrykerJS works inside a <a class="" href="https://stryker-mutator.io/docs/stryker-js/configuration/#tempdirname-string">temp directory</a>. What happens to this temp dir depends on the <a class="" href="https://stryker-mutator.io/docs/stryker-js/configuration/#cleantempdir-boolean--always">--cleanTempDir</a> setting. This setting now gets a new option: <code>'always'</code>.</p>
<p>When <code>cleanTempDir</code> is set to <code>'always'</code>, the temp dir is... well... always deleted. This contradicts <code>true</code> (default), where the temp dir is only deleted when StrykerJS runs successfully.</p>
<p>💐 Special thanks go to <a href="https://github.com/adeelpm" target="_blank" rel="noopener noreferrer" class="">@adeelpm</a> for implementing this feature.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-breaking-changes">💥 Breaking Changes<a href="https://stryker-mutator.io/blog/announcing-stryker-js-7/#-breaking-changes" class="hash-link" aria-label="Direct link to 💥 Breaking Changes" title="Direct link to 💥 Breaking Changes" translate="no">​</a></h2>
<p>V7 comes with some more minor but technically-breaking changes. This is the list:</p>
<ul>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/issues/4246" target="_blank" rel="noopener noreferrer" class="">#4246</a> <strong>type-checking:</strong> <code>disableTypeChecks</code> is now <code>true</code> by default. You can use this configuration to opt out:<!-- -->
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"disableTypeChecks"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"{test,src,lib}/**/*.{js,ts,jsx,tsx,html,vue,cts,mts}"</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/issues/4234" target="_blank" rel="noopener noreferrer" class="">#4234</a> <strong>reporter-api:</strong> The event <code>onAllMutantsTested</code> has been removed. Plugin creators should use <code>onMutationTestReportReady</code> instead.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/issues/4171" target="_blank" rel="noopener noreferrer" class="">#4171</a> <strong>esm:</strong> Deep (and undocumented) imports from <code>@stryker-mutator/core</code> or one of the plugins will no longer work. If you want to import something that's not available, please let us know by <a href="https://github.com/stryker-mutator/stryker-js/issues/new/choose" target="_blank" rel="noopener noreferrer" class="">opening an issue</a></li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/issues/4105" target="_blank" rel="noopener noreferrer" class="">#4105</a> <strong>node:</strong> Node 14 is no longer supported. Please install an <a href="https://nodejs.org/" target="_blank" rel="noopener noreferrer" class="">LTS version of node</a></li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's next<a href="https://stryker-mutator.io/blog/announcing-stryker-js-7/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's next" title="Direct link to 🔮 What's next" translate="no">​</a></h2>
<p>With v7 out the door, we will closely monitor any issues that might pop up with these new plugins. So if you have an issue, please don't hesitate to <a href="https://github.com/stryker-mutator/stryker-js/issues/new?assignees=&amp;labels=%F0%9F%90%9B+Bug&amp;projects=&amp;template=bug_report.md&amp;title=" target="_blank" rel="noopener noreferrer" class="">let us know by reporting it</a>.</p>
<p>Next, we will be focussing on getting the <a class="" href="https://stryker-mutator.io/blog/announcing-realtime-reporting-for-stryker/">real-time HTML report</a> working for StrykerJS and progress support for mutating <a href="https://github.com/stryker-mutator/stryker-js/pull/3929" target="_blank" rel="noopener noreferrer" class=""><code>.svelte</code> files</a>.</p>
<p>In the medium term, we will focus on improving the mutating environment in general. The long-awaited <a href="https://github.com/stryker-mutator/stryker-js/issues/3229" target="_blank" rel="noopener noreferrer" class="">ignore plugin</a> comes to mind. We also would love for some mutators to be less noisy by only inserting mutants if no other mutants are inserted.</p>
<p>In the meantime, we would love to hear from you! So please voice your feedback in the comment section below 👇, on <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">our slack channel</a> or by sending a <a href="https://twitter.com/stryker_mutator/" target="_blank" rel="noopener noreferrer" class="">tweet</a>.</p>]]></content:encoded>
            <category>stryker-js</category>
        </item>
        <item>
            <title><![CDATA[Announcing Real-time Reporting for Stryker.NET]]></title>
            <link>https://stryker-mutator.io/blog/announcing-realtime-reporting-for-stryker/</link>
            <guid>https://stryker-mutator.io/blog/announcing-realtime-reporting-for-stryker/</guid>
            <pubDate>Thu, 04 May 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Wait no longer to see the results of your mutation testing! With this new addition to Stryker.NET, you can receive real-time feedback, enabling you to identify and address survived mutants as soon as they are identified!]]></description>
            <content:encoded><![CDATA[<p>Wait no longer to see the results of your mutation testing! With this new addition to Stryker.NET, you can receive real-time feedback, enabling you to identify and address survived mutants as soon as they are identified!</p>
<!-- -->
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="getting-started">Getting started<a href="https://stryker-mutator.io/blog/announcing-realtime-reporting-for-stryker/#getting-started" class="hash-link" aria-label="Direct link to Getting started" title="Direct link to Getting started" translate="no">​</a></h2>
<p>Install Stryker.NET version 3.8.0 or higher using the <a class="" href="https://stryker-mutator.io/docs/stryker-net/getting-started/">getting started</a>, or update the dotnet-stryker tool version to at least 3.8.0 in your <code>.config/dotnet-tools.json</code> file and run <code>dotnet tool restore</code>:</p>
<div class="language-diff codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-diff codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">"tools": {</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token unchanged prefix unchanged"> </span><span class="token unchanged line">   "dotnet-stryker": {</span><br></div><div class="token-line" style="color:#393A34"><span class="token unchanged line"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">     "version": "3.8.0",</span><br></div><div class="token-line" style="color:#393A34"><span class="token inserted-sign inserted line" style="color:#36acaa"></span><span class="token unchanged prefix unchanged"> </span><span class="token unchanged line">     "commands": ["dotnet-stryker"]</span><br></div><div class="token-line" style="color:#393A34"><span class="token unchanged line"></span><span class="token unchanged prefix unchanged"> </span><span class="token unchanged line">   }</span><br></div><div class="token-line" style="color:#393A34"><span class="token unchanged line"></span><span class="token unchanged prefix unchanged"> </span><span class="token unchanged line"> }</span><br></div></code></pre></div></div>
<p>Enable real-time reporting with <code>dotnet stryker --open-report</code> (or <code>-o</code> for short) in Stryker.NET!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="the-problem">The problem<a href="https://stryker-mutator.io/blog/announcing-realtime-reporting-for-stryker/#the-problem" class="hash-link" aria-label="Direct link to The problem" title="Direct link to The problem" translate="no">​</a></h2>
<p>Mutation testing is a slow process, and developers must wait until the end of the mutation test to see results. This delay in feedback can result in a long inner dev loop, as developers may need to spend additional time debugging and fixing issues that could have been identified earlier in the process.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="the-solution">The solution<a href="https://stryker-mutator.io/blog/announcing-realtime-reporting-for-stryker/#the-solution" class="hash-link" aria-label="Direct link to The solution" title="Direct link to The solution" translate="no">​</a></h2>
<p>With real-time reporting, the HTML report updates whenever a new mutant result is available, providing developers with <em>immediate feedback</em>. As a result, developers can identify and address issues in their code earlier because they don't have to wait until mutation testing finishes to see results.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="demo">Demo<a href="https://stryker-mutator.io/blog/announcing-realtime-reporting-for-stryker/#demo" class="hash-link" aria-label="Direct link to Demo" title="Direct link to Demo" translate="no">​</a></h2>
<p>See how the report gets updates in real-time:</p>
<video autoplay="" controls="" src="/videos/realtime-reporting.mp4" width="100%" height="100%"></video>
<p>It is also possible to view a file with mutants that have not run yet (these mutants are marked as <code>Pending</code>):</p>
<p><img decoding="async" loading="lazy" alt="Pending mutants" src="https://stryker-mutator.io/assets/images/pending-mutants-d2986d3e921034c845d4d220410d39bd.png" width="1295" height="870" class="img_Qldj"></p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="whats-next">What's next?<a href="https://stryker-mutator.io/blog/announcing-realtime-reporting-for-stryker/#whats-next" class="hash-link" aria-label="Direct link to What's next?" title="Direct link to What's next?" translate="no">​</a></h2>
<p>Now that this feature is implemented for Stryker.NET, we will be focussing of getting it into all other flavors as well. So look forward to real-time reporting coming to StrykerJS and Stryker4s in the near future.</p>
<p>Furthermore, since <a class="" href="https://stryker-mutator.io/blog/one-mutation-testing-html-report/">we're sharing the HTML report as a separate open source project</a>, we encourage other mutation testing frameworks to start implementing this feature as well. We'll add documentation to <a href="https://github.com/stryker-mutator/mutation-testing-elements/" target="_blank" rel="noopener noreferrer" class="">mutation-testing-elements</a> to help implementers soon.</p>]]></content:encoded>
            <category>stryker-net</category>
            <category>mutation testing elements</category>
        </item>
        <item>
            <title><![CDATA[Announcing Emoji mutations for Stryker]]></title>
            <link>https://stryker-mutator.io/blog/announcing-emoji-mutator/</link>
            <guid>https://stryker-mutator.io/blog/announcing-emoji-mutator/</guid>
            <pubDate>Sat, 01 Apr 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Breaking News: Stryker introduces Emoji Mutations!]]></description>
            <content:encoded><![CDATA[<p><strong>Breaking News</strong>: Stryker introduces <em>Emoji Mutations</em>!</p>
<p>In a world where even our code needs a little bit of fun, Stryker is proud to announce the introduction of Emoji Mutations. From now on, our state-of-the-art mutation testing algorithms will automatically detect all emojis in your code and replace them with their mutated counterparts!</p>
<p>Any code that contains an emoji will have that emoji mutated to its counterpart. For example, a happy face (😊) will be mutated to a sad face (😔), and a laughing face (😂), to a crying face (😭), or a smiling halo face (😇) will be mutated to a grumpy face (😡).</p>
<p>Update to the latest version of Stryker.JS, Stryker.NET or Stryker4s to enjoy this newest feature ✨</p>
<!-- -->
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-the-problem">🧐 The problem<a href="https://stryker-mutator.io/blog/announcing-emoji-mutator/#-the-problem" class="hash-link" aria-label="Direct link to 🧐 The problem" title="Direct link to 🧐 The problem" translate="no">​</a></h2>
<p><a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" target="_blank" rel="noopener noreferrer" class="">Studies</a> have shown that the emotional tone of code can affect how developers interact with it. If a codebase is full of negative emotions (like sadness), developers may be less likely to want to work on it. On the other hand, if a codebase is full of positive emotions (like happiness), developers may be more likely to engage with it.</p>
<p>If you've used Stryker before you will have noticed it mutates all your code except for Emojis. Even though Emojis are becoming a more and more important part of programming languages. Nowadays there exist <a href="https://www.emojicode.org/docs/reference/welcome.html" target="_blank" rel="noopener noreferrer" class="">complete code languages revolving around Emojis</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-introducing-the-emoji-mutator">⏩ Introducing the Emoji mutator<a href="https://stryker-mutator.io/blog/announcing-emoji-mutator/#-introducing-the-emoji-mutator" class="hash-link" aria-label="Direct link to ⏩ Introducing the Emoji mutator" title="Direct link to ⏩ Introducing the Emoji mutator" translate="no">​</a></h2>
<p>By introducing emoji mutations, we can help ensure that codebases are emotionally balanced and inviting for developers to work on. Plus, it's just plain fun to see sad faces turn into happy faces!</p>
<p>😂 becomes 😭 - because sometimes you need to cry from laughing too hard!</p>
<p>🥦 becomes 🍕 - eating healthy is good, make sure the lay off the pizza every once in a while.</p>
<p>🤔 becomes 🤯 - because coding can be mind-boggling!</p>
<p>💻 becomes 🧚‍ - for when coding feels like magic.</p>
<p>😇 becomes 😡 - to promote positivity and forgiveness when dealing with frustrating code.</p>
<p>🦋 becomes 🐛 - those pesky bugs must be squashed!</p>
<p>🔥 becomes ❄️ - because sometimes you need to cool down a heated discussion about code.</p>
<p>💩 becomes 💎 - because even the ugliest code can turn into a gem with some polishing.</p>
<p>🧨 becomes 🎉 - for those who like to live dangerously while celebrating a successful deployment.</p>
<p>🐒 becomes 🤖 - to remind ourselves that even the most advanced technologies still have roots in the natural world.</p>
<p>✅ becomes 👽 - marking those killed mutants as survived...</p>
<p><strong>Note:</strong> We can't guarantee that the mutation will impact your actual emotion.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's next<a href="https://stryker-mutator.io/blog/announcing-emoji-mutator/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's next" title="Direct link to 🔮 What's next" translate="no">​</a></h2>
<p>We believe this will not only improve the quality of your code, but also make your work more fun and enjoyable! Try it out today and let us know what you think. Happy coding (or should we say, 😂👨‍💻🎉)!</p>]]></content:encoded>
            <category>april fools</category>
        </item>
        <item>
            <title><![CDATA[Announcing faster TypeScript checking for StrykerJS]]></title>
            <link>https://stryker-mutator.io/blog/announcing-faster-typescript-checking/</link>
            <guid>https://stryker-mutator.io/blog/announcing-faster-typescript-checking/</guid>
            <pubDate>Fri, 17 Feb 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to announce StrykerJS 6.4. This release comes with some bug fixes, but in this article, we will focus on upgraded TypeScript Checker.]]></description>
            <content:encoded><![CDATA[<p>We're excited to announce StrykerJS 6.4. This release comes with <a href="https://github.com/stryker-mutator/stryker-js/releases/tag/v6.4.0" target="_blank" rel="noopener noreferrer" class="">some bug fixes</a>, but in this article, we will focus on upgraded TypeScript Checker.</p>
<p>As a reminder, the TypeScript checker is an optional StrykerJS plugin. When configured, each mutant will first be validated to not result in compile errors when run through the TypeScript compiler.</p>
<p>The performance of this process has been an issue for quite some time now. In the past, enabling this plugin might have resulted in up to a 10x performance degradation. But there is excellent news, version 6.4 of the Typescript checker improves the performance by up to 50%</p>
<!-- -->
<p>To update to the latest version of StrykerJS, install <code>@latest</code> as follows:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/core@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/core@latest</span><br></div></code></pre></div></div>
<p>Remember also to update your Stryker plugins. For example, when using the TypeScript checker:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/typescript-checker@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/typescript-checker@latest</span><br></div></code></pre></div></div>
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. Please take a look at <a class="" href="https://stryker-mutator.io/docs/General/example/">our RoboCoasters 🤖🎢 example</a> and see how even 100% code coverage doesn't tell the whole story. Mutation testing is the only way to know if your tests are any good.</p>
<p>Now, let's dive into the upgraded TypeScript checker! 🏊‍♂️</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-the-problem">😲 The problem<a href="https://stryker-mutator.io/blog/announcing-faster-typescript-checking/#-the-problem" class="hash-link" aria-label="Direct link to 😲 The problem" title="Direct link to 😲 The problem" translate="no">​</a></h2>
<p>If you've used TypeScript before, you probably have noticed that running the TypeScript can be pretty slow. However, you generally accept this because of the incredible value type checking provides in your day-to-day life.</p>
<p>TypeScript is very smart about what constructs are valid and which aren't. So when you also use StrykerJS, you want to avoid being bothered by mutants that result in invalid TypeScript. This is where the TypeScript checkers come in. Configuring this checker plugin will make sure mutants are always valid. Invalid mutants get reported as <code>CompileError</code>.</p>
<p>The way the checker plugin did this was to validate your mutants was somewhat pessimistic, namely, by letting TypeScript validate each mutant one by one. Even when you do this in memory and with TypeScript's <code>--watch</code> mode enabled, this results in dramatic performance! Running StrykerJS on itself took 10x longer with this plugin than without it!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-new-and-improved">⏩ New and improved<a href="https://stryker-mutator.io/blog/announcing-faster-typescript-checking/#-new-and-improved" class="hash-link" aria-label="Direct link to ⏩ New and improved" title="Direct link to ⏩ New and improved" translate="no">​</a></h2>
<p>Luckily there is a solution here. By grouping mutants together, we can type-check a bunch of them at once. Creating these groups is somewhat tricky, <a href="https://stryker-mutator.io/blog/announcing-faster-typescript-checking/#-in-depth" class="">see in depth</a>.</p>
<p>You can enable the <a class="" href="https://stryker-mutator.io/docs/stryker-js/typescript-checker/">TypeScript checker</a> using this configuration:</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// stryker.conf.json</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token string-property property" style="color:#36acaa">"checkers"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"typescript"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p><strong>Note:</strong> This grouping strategy is the new default. However, there are some minor <a href="https://stryker-mutator.io/blog/announcing-faster-typescript-checking/#-drawbacks" class="">drawbacks</a>.</p>
<p>In our tests on the <code>core</code> package of StrykerJS we found that the performance increased by 43% while still being 99.1% accurate! Of course, the larger a project is, the more performance gain this new version might provide.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-in-depth">🔎 In depth<a href="https://stryker-mutator.io/blog/announcing-faster-typescript-checking/#-in-depth" class="hash-link" aria-label="Direct link to 🔎 In depth" title="Direct link to 🔎 In depth" translate="no">​</a></h2>
<p>To improve the performance of the TypeScript checker, we needed to find a way to check multiple mutants at once. However, simply inserting all mutants into the project and compiling it wouldn't work! Indeed, how would you relate compile errors to the mutants that created them?</p>
<p>To solve this problem, we decided to group mutants based on their relation to each other. Groups of mutants are created based on file references. To keep it simple: mutants are <em>only</em> grouped together when they <em>don't relate to each other</em>. We might even want to experiment with larger group sizes in the future.</p>
<p>Internally, a dependency graph is created from the project files using the TypeScript Compiler. Starting with an empty group, we pick a mutant from the list and check if its related file is not already in the group and if the files of the mutants already in the group have no dependencies on them. If it passes these checks, the mutant is added to the group. We then repeat this process with the next mutant until the group is "full", at which point we start a new group. This continues until all mutants have been grouped.</p>
<p>Once groups are created, we check them for compile errors. All mutants in one group are checked in the same TypeScript Compiler run. Any compile errors are captured and referenced back to the mutant that caused it using the dependency graph created in the group method.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-drawbacks">⚠ Drawbacks<a href="https://stryker-mutator.io/blog/announcing-faster-typescript-checking/#-drawbacks" class="hash-link" aria-label="Direct link to ⚠ Drawbacks" title="Direct link to ⚠ Drawbacks" translate="no">​</a></h2>
<p>It's worth noting that the mutation results may not always be 100% accurate with the new TypeScript checker. The issue stems from how TypeScript resolves its compile errors. For more information on this topic, check out <a href="https://github.com/microsoft/TypeScript/issues/46272" target="_blank" rel="noopener noreferrer" class="">issue 46272</a> that we created at the TypeScript repository.</p>
<p>If your project requires the highest possible level of accuracy, it's still possible to disable grouping entirely. However, you'll be forfeiting the performance gains offered by grouping.</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"typescriptChecker"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">   </span><span class="token string-property property" style="color:#36acaa">"prioritizePerformanceOverAccuracy"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// set to false (default true)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's next<a href="https://stryker-mutator.io/blog/announcing-faster-typescript-checking/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's next" title="Direct link to 🔮 What's next" translate="no">​</a></h2>
<p>Please try out the new TypeScript Checker and let us know what you think. We would love to hear from you! Also, look at the <a href="https://github.com/stryker-mutator/stryker-js/releases/tag/v6.4.0" target="_blank" rel="noopener noreferrer" class="">6.4 release notes</a> to see the complete list of changes in 6.4.</p>
<p>In the medium term, we will be working on supporting <code>vitest</code> and <code>node-tap</code>. We maintain a <a href="https://github.com/stryker-mutator/stryker-js/wiki/Roadmap" target="_blank" rel="noopener noreferrer" class="">🛣 roadmap on github</a>, so you can always see what we're actively working on.</p>]]></content:encoded>
            <category>stryker-js</category>
            <category>typescript</category>
        </item>
        <item>
            <title><![CDATA[Exciting new features for Stryker.NET]]></title>
            <link>https://stryker-mutator.io/blog/stryker-net-3-4/</link>
            <guid>https://stryker-mutator.io/blog/stryker-net-3-4/</guid>
            <pubDate>Fri, 23 Dec 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[The new Stryker.NET is packed with a lot of new awesome features 🚀 For the past few months we've been working hard and introduced a lot of new mutators. This can have an effect on your mutation score. So don't be surprised if your score comes out a bit higher or lower after updating. Here is a short summary of everything new.]]></description>
            <content:encoded><![CDATA[<p>The new Stryker.NET is packed with a lot of new awesome features 🚀 For the past few months we've been working hard and introduced a lot of new mutators. This can have an effect on your mutation score. So don't be surprised if your score comes out a bit higher or lower after updating. Here is a short summary of everything new.</p>
<!-- -->
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="test-all-projects-in-a-solution">Test all projects in a solution<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#test-all-projects-in-a-solution" class="hash-link" aria-label="Direct link to Test all projects in a solution" title="Direct link to Test all projects in a solution" translate="no">​</a></h2>
<p>Since 3.1 a long awaited feature is finally here!</p>
<p>When running from your project root (where your solution file is located) and passing the solution file, Stryker will analyze your solution and mutate all projects it can find.</p>
<div class="language-text codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-text codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">cd C:\myprojectroot\</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">dotnet stryker --solution "C:\myprojectroot\mysolution.sln"</span><br></div></code></pre></div></div>
<p>Since 3.2 if a single solution file is present in the directory, stryker will use that solution file and start in solution context. In that case the <code>--solution</code> option is not required.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="math-mutations">Math mutations<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#math-mutations" class="hash-link" aria-label="Direct link to Math mutations" title="Direct link to Math mutations" translate="no">​</a></h2>
<p>Stryker will now mutate math methods when it encounters them. All available mutations are:</p>
<table><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td><code>Math.Acos()</code></td><td><code>Math.Acosh()</code></td></tr><tr><td><code>Math.Acos()</code></td><td><code>Math.Asin()</code></td></tr><tr><td><code>Math.Acos()</code></td><td><code>Math.Atan()</code></td></tr><tr><td><code>Math.Acosh()</code></td><td><code>Math.Acos()</code></td></tr><tr><td><code>Math.Acosh()</code></td><td><code>Math.Asinh()</code></td></tr><tr><td><code>Math.Acosh()</code></td><td><code>Math.Atanh()</code></td></tr><tr><td><code>Math.Asin()</code></td><td><code>Math.Asinh()</code></td></tr><tr><td><code>Math.Asin()</code></td><td><code>Math.Acos()</code></td></tr><tr><td><code>Math.Asin()</code></td><td><code>Math.Atan()</code></td></tr><tr><td><code>Math.Asinh()</code></td><td><code>Math.Asin()</code></td></tr><tr><td><code>Math.Asinh()</code></td><td><code>Math.Acosh()</code></td></tr><tr><td><code>Math.Asinh()</code></td><td><code>Math.Atanh()</code></td></tr><tr><td><code>Math.Atan()</code></td><td><code>Math.Atanh()</code></td></tr><tr><td><code>Math.Atan()</code></td><td><code>Math.Acos()</code></td></tr><tr><td><code>Math.Atan()</code></td><td><code>Math.Asin()</code></td></tr><tr><td><code>Math.Atanh()</code></td><td><code>Math.Atan()</code></td></tr><tr><td><code>Math.Atanh()</code></td><td><code>Math.Acosh()</code></td></tr><tr><td><code>Math.Atanh()</code></td><td><code>Math.Asinh()</code></td></tr><tr><td><code>Math.BitDecrement()</code></td><td><code>Math.BitIncrement()</code></td></tr><tr><td><code>Math.BitIncrement()</code></td><td><code>Math.BitDecrement()</code></td></tr><tr><td><code>Math.Ceiling()</code></td><td><code>Math.Floor()</code></td></tr><tr><td><code>Math.Cos()</code></td><td><code>Math.Cosh()</code></td></tr><tr><td><code>Math.Cos()</code></td><td><code>Math.Sin()</code></td></tr><tr><td><code>Math.Cos()</code></td><td><code>Math.Tan()</code></td></tr><tr><td><code>Math.Cosh()</code></td><td><code>Math.Cos()</code></td></tr><tr><td><code>Math.Cosh()</code></td><td><code>Math.Sinh()</code></td></tr><tr><td><code>Math.Cosh()</code></td><td><code>Math.Tanh()</code></td></tr><tr><td><code>Math.Exp()</code></td><td><code>Math.Log()</code></td></tr><tr><td><code>Math.Floor()</code></td><td><code>Math.Ceiling()</code></td></tr><tr><td><code>Math.Log()</code></td><td><code>Math.Exp()</code></td></tr><tr><td><code>Math.Log()</code></td><td><code>Math.Pow()</code></td></tr><tr><td><code>Math.MaxMagnitude()</code></td><td><code>Math.MinMagnitude()</code></td></tr><tr><td><code>Math.MinMagnitude()</code></td><td><code>Math.MaxMagnitude()</code></td></tr><tr><td><code>Math.Pow()</code></td><td><code>Math.Log()</code></td></tr><tr><td><code>Math.ReciprocalEstimate()</code></td><td><code>Math.ReciprocalSqrtEstimate()</code></td></tr><tr><td><code>Math.ReciprocalSqrtEstimate()</code></td><td><code>Math.ReciprocalEstimate()</code></td></tr><tr><td><code>Math.ReciprocalSqrtEstimate()</code></td><td><code>Math.Sqrt()</code></td></tr><tr><td><code>Math.Sin()</code></td><td><code>Math.Sinh()</code></td></tr><tr><td><code>Math.Sin()</code></td><td><code>Math.Cos()</code></td></tr><tr><td><code>Math.Sin()</code></td><td><code>Math.Tan()</code></td></tr><tr><td><code>Math.Sinh()</code></td><td><code>Math.Sin()</code></td></tr><tr><td><code>Math.Sinh()</code></td><td><code>Math.Cosh()</code></td></tr><tr><td><code>Math.Sinh()</code></td><td><code>Math.Tanh()</code></td></tr><tr><td><code>Math.Tan()</code></td><td><code>Math.Tanh()</code></td></tr><tr><td><code>Math.Tan()</code></td><td><code>Math.Cos()</code></td></tr><tr><td><code>Math.Tan()</code></td><td><code>Math.Sin()</code></td></tr><tr><td><code>Math.Tanh()</code></td><td><code>Math.Tan()</code></td></tr><tr><td><code>Math.Tanh()</code></td><td><code>Math.Cosh()</code></td></tr><tr><td><code>Math.Tanh()</code></td><td><code>Math.Sinh()</code></td></tr></tbody></table>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="object-initializer-mutation">Object initializer mutation<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#object-initializer-mutation" class="hash-link" aria-label="Direct link to Object initializer mutation" title="Direct link to Object initializer mutation" translate="no">​</a></h2>
<p>We already had mutations for emptying lists and arrays. Now object initializers had their turn.</p>
<div class="language-cs codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-cs codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token class-name keyword" style="color:#00009f">var</span><span class="token plain"> myObject </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token constructor-invocation class-name">MyClass</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    property1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">""</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    property2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> Int</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">MaxValue</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>Will be mutated into an empty object initializer:</p>
<div class="language-cs codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-cs codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token class-name keyword" style="color:#00009f">var</span><span class="token plain"> myObject </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token constructor-invocation class-name">MyClass</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="null-coalesing">Null-coalesing<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#null-coalesing" class="hash-link" aria-label="Direct link to Null-coalesing" title="Direct link to Null-coalesing" translate="no">​</a></h2>
<p>Null checking is an important part of our code nowadays. Syntethic sugar has made life easier. But it's also easy to overlook during testing. That's why we now mutate Null-coalesing operators and assignments.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="null-coalescing-assignment-mutation">Null-coalescing assignment mutation<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#null-coalescing-assignment-mutation" class="hash-link" aria-label="Direct link to Null-coalescing assignment mutation" title="Direct link to Null-coalescing assignment mutation" translate="no">​</a></h3>
<div class="language-cs codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-cs codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> object1 </span><span class="token operator" style="color:#393A34">??=</span><span class="token plain"> object2</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>Will be mutated into:</p>
<div class="language-cs codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-cs codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token class-name keyword" style="color:#00009f">var</span><span class="token plain"> object1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> object2</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="null-coalescing-operator-mutations">Null-coalescing operator mutations<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#null-coalescing-operator-mutations" class="hash-link" aria-label="Direct link to Null-coalescing operator mutations" title="Direct link to Null-coalescing operator mutations" translate="no">​</a></h3>
<table><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td><code>a ?? b</code></td><td><code>b ?? a</code></td></tr><tr><td><code>a ?? b</code></td><td><code>a</code></td></tr><tr><td><code>a ?? b</code></td><td><code>b</code></td></tr></tbody></table>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="extra-linq-mutations">Extra linq mutations<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#extra-linq-mutations" class="hash-link" aria-label="Direct link to Extra linq mutations" title="Direct link to Extra linq mutations" translate="no">​</a></h2>
<p>It seems we missed some Linq methods when initially creating the Linq mutator. The following mutations have been added to the Linq mutator.</p>
<table><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td><code>MinBy()</code></td><td><code>MaxBy()</code></td></tr><tr><td><code>MaxBy()</code></td><td><code>MinBy()</code></td></tr><tr><td><code>SkipLast()</code></td><td><code>TakeLast()</code></td></tr><tr><td><code>TakeLast()</code></td><td><code>SkipLast()</code></td></tr><tr><td><code>Order()</code></td><td><code>OrderDescending()</code></td></tr><tr><td><code>OrderDescending()</code></td><td><code>Order()</code></td></tr><tr><td><code>UnionBy()</code></td><td><code>IntersectBy()</code></td></tr><tr><td><code>IntersectBy()</code></td><td><code>UnionBy()</code></td></tr></tbody></table>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="conditional-operator-mutations">Conditional operator mutations<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#conditional-operator-mutations" class="hash-link" aria-label="Direct link to Conditional operator mutations" title="Direct link to Conditional operator mutations" translate="no">​</a></h2>
<p>We already mutated conditional operators like <code>&amp;&amp;</code> and <code>||</code>. But using pattern matching a different type of <code>and</code> and <code>or</code> exist. They are now also mutated.</p>
<table><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td><code>and</code></td><td><code>or</code></td></tr><tr><td><code>or</code></td><td><code>and</code></td></tr></tbody></table>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="equality-operator-mutations">Equality operator mutations<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#equality-operator-mutations" class="hash-link" aria-label="Direct link to Equality operator mutations" title="Direct link to Equality operator mutations" translate="no">​</a></h2>
<p>The same thing for equality operators. In pattern matching instead of <code>==</code> and <code>!=</code> you can use <code>is</code> and <code>is not</code>. Those are now mutated as well.</p>
<table><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td><code>is</code></td><td><code>is not</code></td></tr><tr><td><code>is not</code></td><td><code>is</code></td></tr></tbody></table>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="nuget-restore">Nuget restore<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#nuget-restore" class="hash-link" aria-label="Direct link to Nuget restore" title="Direct link to Nuget restore" translate="no">​</a></h2>
<p>For .NET Framework projects an extra Nuget Restore is needed. When the MsBuildPath was provided to Stryker this was not used by the Nuget Restore. This could result in exceptions.</p>
<p>From now on the Nuget Restore will also use the provided MsBuildPath in the options.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="whats-next-">What's next? 🔮<a href="https://stryker-mutator.io/blog/stryker-net-3-4/#whats-next-" class="hash-link" aria-label="Direct link to What's next? 🔮" title="Direct link to What's next? 🔮" translate="no">​</a></h2>
<p>We have some exciting features on our backlog that you can expect in the coming releases.</p>
<p>We are working on getting test information into the html reporting. You'll be able to see what test have been executed. What mutations they cover, and even what tests didn't kill any mutations.</p>
<p>Furthermore, now that multiple source projects can be mutated, configuring stryker can become difficult. What if you want to exclude a mutation only in 1 project? That's why we want to support multiple config files. One per source project.</p>
<p>In the long term we also want to focus more on performance. All these new mutations make running Stryker.NET painfully slow. We have some ideas on how to do this. But new ideas are always welcome. Join the discussion on <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">our slack channel</a> or by sending a <a href="https://twitter.com/stryker_mutator/" target="_blank" rel="noopener noreferrer" class="">tweet</a>.</p>]]></content:encoded>
            <category>stryker-mutator</category>
            <category>stryker-net</category>
        </item>
        <item>
            <title><![CDATA[Announcing StrykerJS incremental mode]]></title>
            <link>https://stryker-mutator.io/blog/announcing-incremental-mode/</link>
            <guid>https://stryker-mutator.io/blog/announcing-incremental-mode/</guid>
            <pubDate>Tue, 06 Sep 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to announce StrykerJS 6.2. Of course, this release comes with some bug fixes, but in this article, we want to focus on a popular new feature: incremental mutation testing.]]></description>
            <content:encoded><![CDATA[<p>We're excited to announce StrykerJS 6.2. Of course, this release comes with <a href="https://github.com/stryker-mutator/stryker-js/releases/tag/v6.2.0" target="_blank" rel="noopener noreferrer" class="">some bug fixes</a>, but in this article, we want to focus on a popular new feature: incremental mutation testing.</p>
<p>Incremental mutation testing is ideal for Continuous Integration (CI) scenarios or if you want a faster feedback cycle locally. Indeed, many users seem to be interested in this since <a href="https://github.com/stryker-mutator/stryker-js/issues/2753" target="_blank" rel="noopener noreferrer" class="">it was our most upvoted issue ever</a>.</p>
<p>While in 'incremental mode', StrykerJS will track the changes you make to your code and tests and only runs mutation testing on the changed code; while still providing a full mutation testing report at the end!</p>
<!-- -->
<p>To update to the latest version of StrykerJS, install <code>@latest</code> as follows:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/core@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/core@latest</span><br></div></code></pre></div></div>
<p>Don't forget to update Stryker plugins. For example, when using the mocha runner:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/mocha-runner@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/mocha-runner@latest</span><br></div></code></pre></div></div>
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. Please take a look at <a class="" href="https://stryker-mutator.io/docs/General/example/">our RoboCoasters 🤖🎢 example</a> and see how even 100% code coverage doesn't tell the whole story. Mutation testing is the only way to know if your tests are any good.</p>
<p>Now, let's dive into incremental mode! 🏊‍♂️</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-incremental-mode">⏩ Incremental mode<a href="https://stryker-mutator.io/blog/announcing-incremental-mode/#-incremental-mode" class="hash-link" aria-label="Direct link to ⏩ Incremental mode" title="Direct link to ⏩ Incremental mode" translate="no">​</a></h2>
<p>You enable incremental mode with the <code>--incremental</code> flag:</p>
<div class="language-text codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-text codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npx stryker run --incremental</span><br></div></code></pre></div></div>
<p><em><strong>Note:</strong> Setting <code>"incremental": true</code> in your stryker.conf.json file is also supported</em></p>
<p>The first time you do an incremental run, StrykerJS will do an entire run as usual, except it will write the JSON result to a <code>reports/stryker-incremental.json</code> file at the end. The next time you run StrykerJS incrementally, it will read this JSON file and try to reuse as much of it as possible.</p>
<p><em><strong>Note:</strong> You can change the file's location with the <code>--incrementalFile</code> option.</em></p>
<p>Reuse of a mutant result is possible when:</p>
<ul>
<li class="">That mutant was "Killed"; the culprit test still exists and didn't change</li>
<li class="">Or, that mutant was not "Killed"; no new test covers it, and no covering tests changed.</li>
</ul>
<p>Stryker uses a file diff algorithm to determine which mutants or tests changed. It does this using google's <a href="https://github.com/google/diff-match-patch" target="_blank" rel="noopener noreferrer" class="">diff match patch</a> library, a small dependency with excellent diffing performance!</p>
<p>You can see the statistics of the incremental analysis in your console. It appears just after the dry run and looks like this:</p>
<div class="language-text codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-text codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">        Mutants:        1 files changed (+2 -2)</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        Tests:          2 files changed (+22 -21)</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        Result:         3731 of 3965 mutant result(s).</span><br></div></code></pre></div></div>
<p>Here you can see that:</p>
<ul>
<li class="">One file with mutants changed (2 mutants added, 2 mutants removed)</li>
<li class="">Two test files changed (22 tests added and 21 tests removed)</li>
<li class="">In total, Stryker reuses 3731 mutant results, meaning only 234 mutants need to run this time.</li>
</ul>
<p><em><strong>Note:</strong> Stryker.NET has a similar feature called: "baseline". See <a href="https://github.com/stryker-mutator/stryker-js/pull/3609#issuecomment-1170009387" target="_blank" rel="noopener noreferrer" class="">the PR for a detailed comparison</a>.</em></p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-limitations">🥢 Limitations<a href="https://stryker-mutator.io/blog/announcing-incremental-mode/#-limitations" class="hash-link" aria-label="Direct link to 🥢 Limitations" title="Direct link to 🥢 Limitations" translate="no">​</a></h2>
<p>When in incremental mode, Stryker will do its best to produce an accurate mutation testing report. But, due to the complex nature of mutation testing, there are inherent limitations:</p>
<ul>
<li class="">Stryker will not detect any changes you've made in files other than mutated files and test files.</li>
<li class="">Detecting test changes is only supported when the test runner plugin reports the necessary test details.</li>
<li class="">Other changes to your environment are not detected, such as updates to other files, updated (dev) dependencies, changes to environment variables, changes to <code>.snap</code> files, readme files, etc.</li>
<li class=""><a class="" href="https://stryker-mutator.io/docs/mutation-testing-elements/static-mutants/">Static mutants</a> don't have test coverage; thus, Stryker won't detect test changes for them.</li>
</ul>
<p>See <a class="" href="https://stryker-mutator.io/docs/stryker-js/incremental/#limitations">incremental limitations</a> for more details.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-forcing-reruns">🔨 Forcing reruns<a href="https://stryker-mutator.io/blog/announcing-incremental-mode/#-forcing-reruns" class="hash-link" aria-label="Direct link to 🔨 Forcing reruns" title="Direct link to 🔨 Forcing reruns" translate="no">​</a></h2>
<p>With these inherent limitations in mind, you can probably imagine a scenario where you want to force specific mutants to run while using incremental mode. You can do this with <code>--force</code>. With it, you tell StrykerJS to rerun all mutants in scope, regardless of the previous result found in the incremental file.</p>
<p>Using <code>--force</code> is especially beneficial when combined with a custom <code>--mutate</code> pattern. I.e., if you only want to rerun the mutants in <code>src/app.js</code>, you use:</p>
<div class="language-text codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-text codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npx stryker run --incremental --force --mutate src/app.js</span><br></div></code></pre></div></div>
<p>You can even specify individual lines to mutate:</p>
<div class="language-text codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-text codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npx stryker run --incremental --force --mutate src/app.js:5-7</span><br></div></code></pre></div></div>
<p>In this example, you tell Stryker to only run mutation testing for lines 5 through 7 in the <code>src/app.js</code> file and update the incremental report.</p>
<p>Using the combination of <code>--incremental</code> with a custom <code>--mutate</code> pattern, StrykerJS will not remove mutants that are not in scope and still report them as part of the full mutation report!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-continuous-integration-ci">🔁 Continuous Integration (CI)<a href="https://stryker-mutator.io/blog/announcing-incremental-mode/#-continuous-integration-ci" class="hash-link" aria-label="Direct link to 🔁 Continuous Integration (CI)" title="Direct link to 🔁 Continuous Integration (CI)" translate="no">​</a></h2>
<p>Incremental mutation testing is ideal for CI scenarios! For example, when you open a Pull/Merge Request against your main branch, you probably don't need an entire mutation testing run; you are just interested in <em>changes since the last run on the main branch</em>.</p>
<p>For this to work, you need the <code>stryker-incremental.json</code> file. You could 'check in' this file into source control, but it changes a lot, and you should not treat it as source code anyway. Instead, it is better to treat it as an artifact.</p>
<p>The CI process for mutation testing looks as follows.</p>
<!-- -->
<p>Your preferred implementation of steps 1 and 3 will depend on your CI provider. Besides artifact storage provided by your CI provider, you can also opt for cloud storage. If you are using AWS, it might make sense to use an S3 bucket here. You probably want to opt for Azure blob storage when using Azure DevOps.</p>
<p>Is your project open-source? Then you're in luck with the <a href="https://dashboard.stryker-mutator.io/" target="_blank" rel="noopener noreferrer" class="">Stryker Dashboard</a>, free to use for open-source projects. The JSON file format StrykerJS uses for its incremental mode is the same as the Stryker Dashboard's report file. So downloading this JSON report (step 1) is as easy as using a cURL request. Furthermore, since it already updates the report, you get 'step 3' for free when using the <a class="" href="https://stryker-mutator.io/docs/General/dashboard/">dashboard reporter</a>.</p>
<p>For example, to download the report for the <code>main</code> branch for a project called <code>my-org/my-repo</code>, you can use this cURL request:</p>
<div class="language-bash codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-bash codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">curl --silent --create-dirs --output reports/stryker-incremental.json https://dashboard.stryker-mutator.io/api/reports/github.com/my-org/my-repo/main</span><br></div></code></pre></div></div>
<p>In an actual CI scenario, where you might push multiple changes to a particular PR, you might want to download the report for the current branch first and fall back to the main branch if it didn't exist. If so, you can use this script (assuming the <code>$BRANCH_NAME</code> environment variable contains the current branch name).</p>
<div class="language-bash codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-bash codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">curl --dump-header .header.out --silent --create-dirs --output reports/stryker-incremental.json https://dashboard.stryker-mutator.io/api/reports/github.com/my-org/my-repo/$BRANCH_NAME</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">if cat .header.out | grep HTTP | grep 404</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">then</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    echo "- falling back to main branch.."</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    curl -s --create-dirs -o reports/stryker-incremental.json https://dashboard.stryker-mutator.io/api/reports/github.com/my-org/my-repo/main</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">fi</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">rm .header.out</span><br></div></code></pre></div></div>
<p>If you only ever run Stryker with incremental mode, you might fear that the mutation report slowly 'drifts' from reality because of <a href="https://stryker-mutator.io/blog/announcing-incremental-mode/#-limitations" class="">said limitations</a>. We recommend doing a full mutation testing run now and then to prevent this, either with <a href="https://stryker-mutator.io/blog/announcing-incremental-mode/#-forcing-reruns" class=""><code>--force</code></a> or using the dashboard reporter. We do this in CI to develop StrykerJS itself. Our complete CI process looks like this:</p>
<!-- -->
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's next<a href="https://stryker-mutator.io/blog/announcing-incremental-mode/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's next" title="Direct link to 🔮 What's next" translate="no">​</a></h2>
<p>Please try out incremental mode and let us know what you think. We would love to hear from you! You can take a look at the <a class="" href="https://stryker-mutator.io/docs/stryker-js/incremental/">incremental documentation page</a>. Also, look at the <a href="https://github.com/stryker-mutator/stryker-js/releases/tag/v6.2.0" target="_blank" rel="noopener noreferrer" class="">6.2 release notes</a> to see the complete list of changes in 6.2.</p>
<p>In the medium term, we'll be working on supporting more test runners and implementing performance improvements in the typescript checker. We maintain a <a href="https://github.com/stryker-mutator/stryker-js/wiki/Roadmap" target="_blank" rel="noopener noreferrer" class="">🛣 roadmap on github</a>, so you can always see what we're actively working on.</p>
<p>In the meantime, we would love to hear from you! So please voice your feedback in the comment section below 👇, on <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">our slack channel</a> or by sending a <a href="https://twitter.com/stryker_mutator/" target="_blank" rel="noopener noreferrer" class="">tweet</a>.</p>]]></content:encoded>
            <category>stryker-js</category>
        </item>
        <item>
            <title><![CDATA[Connect PIT to Stryker Dashboard]]></title>
            <link>https://stryker-mutator.io/blog/connect-pit-to-stryker-dashboard/</link>
            <guid>https://stryker-mutator.io/blog/connect-pit-to-stryker-dashboard/</guid>
            <pubDate>Tue, 16 Aug 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[<link]]></description>
            <content:encoded><![CDATA[
<p>Until recently, it would be quite cumbersome to integrate PIT with the Stryker Mutator Dashboard.
It involved (mis-) using a different PIT reporter, a fragile Bash script to fiddle around in one of the generated JavaScript files...
Not pretty at all.</p>
<p>A first-class tool like PIT deserves a better integration with a first-class dashboard like the Stryker Mutator Dashboard!</p>
<!-- -->
<p>That's why today, I am introducing a much cleaner and simpler approach: the <a href="https://github.com/mthmulders/pit-stryker-dashboard-reporter" target="_blank" rel="noopener noreferrer" class="">Stryker Mutator Dashboard reporter for PIT</a>.</p>
<p>Here's how it works:</p>
<ol>
<li class="">It collects mutation testing results from <a href="https://pitest.org/" target="_blank" rel="noopener noreferrer" class="">PIT</a>.</li>
<li class="">It converts the collected mutation testing results into the format that the <a href="https://dashboard.stryker-mutator.io/" target="_blank" rel="noopener noreferrer" class="">Stryker Mutator Dashboard</a> expects.</li>
<li class="">It uploads the converted report to the <a href="https://dashboard.stryker-mutator.io/" target="_blank" rel="noopener noreferrer" class="">Stryker Mutator Dashboard</a>.</li>
</ol>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="how-to-use-it">How to use it?<a href="https://stryker-mutator.io/blog/connect-pit-to-stryker-dashboard/#how-to-use-it" class="hash-link" aria-label="Direct link to How to use it?" title="Direct link to How to use it?" translate="no">​</a></h2>
<p>I've tried to make it as simple as possible to use the reporter.</p>
<p>As a prerequisite, make sure there is an environment variable <code>STRYKER_DASHBOARD_API_KEY</code> with the API key that you got when you set up your project.</p>
<p>Now, follow these four steps:</p>
<ol>
<li class="">
<p>Find the place in your <strong>pom.xml</strong> where you define the <em>pitest-maven</em> plugin.</p>
</li>
<li class="">
<p>Add a dependency to this plugin declaration:</p>
<div class="language-xml codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-xml codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">dependency</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">   </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">it.mulders.stryker</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">   </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">pit-dashboard-reporter</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">   </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">version</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">0.1.2</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">version</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">dependency</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
</li>
<li class="">
<p>Configure PIT to use the new output format:</p>
<div class="language-xml codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-xml codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">configuration</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">outputFormats</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">format</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">stryker-dashboard</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">format</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">outputFormats</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">configuration</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<ol>
<li class="">Alternatively, if <code>&lt;configuration&gt;</code> is already there, add the <code>&lt;outputFormats&gt;</code>.</li>
<li class="">Similarly, if <code>&lt;outputFormats&gt;</code> is already there, add (or replace) with <code>&lt;format&gt;stryker-dashboard&lt;/format&gt;</code>.</li>
</ol>
</li>
<li class="">
<p><strong>Important</strong> If you are working on a multi-module Maven project, add the following to the <code>&lt;configuration&gt;</code> block:</p>
<div class="language-xml codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-xml codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">pluginConfiguration</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">stryker.moduleName</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">${project.artifactId}</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">stryker.moduleName</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">pluginConfiguration</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>This will ensure the mutation testing results of the various Maven modules will not mix up in the report.
You <strong>should not</strong> do this if you have a single-module Maven project!</p>
</li>
<li class="">
<p>For all the other things, the reporter will autoconfigure itself, given your build runs on any of the following environments:</p>
<ul>
<li class="">GitHub Actions</li>
</ul>
<p>If your builds run in another environment, please feel free to <a href="https://github.com/mthmulders/pit-stryker-dashboard-reporter/issues/new" target="_blank" rel="noopener noreferrer" class="">open an issue</a>.</p>
</li>
</ol>
<p><strong>That's all - you're done!</strong>
Kick off a fresh build, wait a few minutes and enjoy the online report!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="credits">Credits<a href="https://stryker-mutator.io/blog/connect-pit-to-stryker-dashboard/#credits" class="hash-link" aria-label="Direct link to Credits" title="Direct link to Credits" translate="no">​</a></h2>
<p>Credit where credit is due: this reporter would not exist without this <a href="https://github.com/wmaarts/pitest-mutation-testing-elements-plugin" target="_blank" rel="noopener noreferrer" class="">tremendous work</a> by Wouter Aarts.
His reporter contains all the complex mapping from PIT results to <a href="https://github.com/stryker-mutator/mutation-testing-elements/tree/master/packages/report-schema" target="_blank" rel="noopener noreferrer" class="">mutation-testing-elements' JSON format</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="post-scriptum">Post Scriptum<a href="https://stryker-mutator.io/blog/connect-pit-to-stryker-dashboard/#post-scriptum" class="hash-link" aria-label="Direct link to Post Scriptum" title="Direct link to Post Scriptum" translate="no">​</a></h2>
<p>I have a slightly longer version of this blog (including some historical background) on <a href="https://maarten.mulders.it/2022/07/mutation-testing-badge-with-pit-and-stryker-dashboard/" target="_blank" rel="noopener noreferrer" class="">my personal blog</a>.</p>]]></content:encoded>
            <category>pit</category>
            <category>java</category>
            <category>maven</category>
            <category>dashboard</category>
        </item>
        <item>
            <title><![CDATA[StrykerJS v6.0: Expeditious Superior Mutations]]></title>
            <link>https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/</link>
            <guid>https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/</guid>
            <pubDate>Wed, 04 May 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to announce the next major release of the StrykerJS: StrykerJS 6.0.]]></description>
            <content:encoded><![CDATA[<p>We're excited to announce the next major release of the StrykerJS: StrykerJS 6.0.</p>
<p>StrykerJS now supports <em>native ECMAScript modules</em>, or ESM for short. To make this work, we changed some parts of StrykerJS, which includes small (yet technically breaking) changes. As a bonus, we've improved performance considerably in some use cases! We're curious to know what you think. Why not try it today?</p>
<!-- -->
<p>To update to the latest version of StrykerJS, install <code>@latest</code> as follows:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/core@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/core@latest</span><br></div></code></pre></div></div>
<p>Don't forget to update Stryker plugins. For example, when using the mocha runner:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/mocha-runner@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/mocha-runner@latest</span><br></div></code></pre></div></div>
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. Please take a look at our RoboCoasters 🤖🎢 example and see how even 100% code coverage doesn't tell the whole story. Mutation testing is the only way to know if your tests are any good.</p>
<p>Since the 6.0.0 beta release, we've implemented a new warning message to inform users about <code>--ignoreStatic</code> and improved the performance and progress reporting; you can read about that in the <a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-static-mutant-improvements" class="">🗿 Static mutant improvements</a> paragraph.</p>
<p>Now, let's dive into the changes! 🏊‍♂️</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-esm-support">📦 ESM support<a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-esm-support" class="hash-link" aria-label="Direct link to 📦 ESM support" title="Direct link to 📦 ESM support" translate="no">​</a></h2>
<p>As stated in the introduction, StrykerJS v6 brings official support for ESM projects.</p>
<p>With ESM, you can use <code>import</code> and <code>export</code> statements. NodeJS has supported ESM since version 12. Browsers have gradually been adding support since 2017, and all major browsers support it by now. I recommend watching <a href="https://www.youtube.com/watch?v=Zyoztl_7l7g" target="_blank" rel="noopener noreferrer" class="">Gil Tayar's introduction to ESM</a> when you want to brush up on the ESM basics.</p>
<p>The <code>@stryker-mutator/karma-runner</code> and <code>@stryker-mutator/jest-runner</code> already worked with ESM (for Jest, you will need to configure the <a class="" href="https://stryker-mutator.io/docs/stryker-js/jest-runner/#ecmascript-modules"><code>--experimental-vm-modules</code></a> flag), but our node-based runners did not. This changes with version 6.</p>
<p>You configure it like this:</p>
<pre tabindex="0" class="codeBlockStandalone_m2sz thin-scrollbar language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_RuQK"></code></pre>
<p>As you can see <em>no configuration change</em> is needed. Updating StrykerJS is enough 😁.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-hot-reload">⏩ Hot reload<a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-hot-reload" class="hash-link" aria-label="Direct link to ⏩ Hot reload" title="Direct link to ⏩ Hot reload" translate="no">​</a></h2>
<p>StrykerJS will run your tests many, many times. Consider that each mutant is tested in isolation, so it runs your tests as many times as there are (covered) mutants. A way to save time is only to load your tests once (using <code>import</code>/<code>require</code>) and then run them multiple times in quick succession while activating a different mutant each time. We call this feature "hot reload", and it is generally the fastest way to implement mutation testing.</p>
<p>Hot reloading is only possible because Stryker uses mutant schemata. With mutant schemata (or mutation switching), Stryker inserts all mutants into your source code yet only activates them one at a time.</p>
<p>It looks something like this:</p>
<div class="language-ts codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-ts codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">add</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">activeMutant </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token comment" style="color:#999988;font-style:italic">// 👾 BlockStatement mutator</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">activeMutant </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token operator" style="color:#393A34">?</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">-</span><span class="token plain"> b </span><span class="token comment" style="color:#999988;font-style:italic">// 👽 ArithmeticExpression mutator</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>When older versions of Stryker are testing mutants inside a worker process, it looks like this:</p>
<p>(old process)</p>
<ol>
<li class="">Activate the mutant</li>
<li class=""><em>Load all files</em>, using <code>require</code></li>
<li class="">Run the tests with the test runner of choice.</li>
<li class=""><em>Unload all files</em>, using <a href="https://nodejs.org/api/modules.html#requirecache" target="_blank" rel="noopener noreferrer" class=""><code>delete require.cache['path/to/cjs/module']</code></a> to prepare for the next run.</li>
<li class="">Report the result</li>
</ol>
<p>As you can see, <em>all files are loaded and unloaded</em> for each mutant run. This way of reloading <a href="https://github.com/nodejs/tooling/issues/51" target="_blank" rel="noopener noreferrer" class="">won't ever work with native ESM</a>, as there is simply no <code>cache</code> we can <code>delete</code> the loaded files from 🤷‍♀️.</p>
<p>The reloading is also expensive. Think about it: if your project contains 1k files, with a total of 10k mutants, it could mean a total of <em>ten million file IO actions</em>. That's why mutation testing with StrykerJS would slow down considerably when the size of your project grows.</p>
<p>As of v6, Node-based test runners use hot reload. The process is now:</p>
<p>(new process using hot reload)</p>
<ol>
<li class="">(once) Load the code using <code>import</code></li>
<li class="">Activate the mutant</li>
<li class="">Run the tests with the test runner of choice.</li>
<li class="">Report the result</li>
</ol>
<p>The result is a significant performance improvement 🐇. You can clearly see the difference when running StrykerJS on Stryker's core itself:</p>
<table><thead><tr><th>Old</th></tr></thead><tbody><tr><td><img decoding="async" loading="lazy" alt="stryker-v5" src="https://stryker-mutator.io/assets/images/stryker-v5-fab7d65f05820d63820b7cae1bce5292.gif" width="1257" height="368" class="img_Qldj"></td></tr></tbody></table>
<table><thead><tr><th>New *</th></tr></thead><tbody><tr><td><img decoding="async" loading="lazy" alt="stryker-v6" src="https://stryker-mutator.io/assets/images/stryker-v6-a1b18c6c1cfd9f7866104465815134c4.gif" width="1257" height="368" class="img_Qldj"></td></tr></tbody></table>
<p>* using <code>--ignoreStatic</code></p>
<p>That's a whopping 70% performance improvement 🤯.</p>
<p>Hot reload is supported in <code>@stryker-mutator/mocha-runner</code> and <code>@stryker-mutator/jasmine-runner</code>. Please note that this feature is always on from version 6 onward, even for plain old CommonJS style projects! It does require a higher version of mocha or jasmine, respectively, see <a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-breaking-changes" class="">breaking changes</a>. Support for <code>@stryker-mutator/cucumber-runner</code> is planned for version 8 of <code>@cucumber/cucumber</code> release.</p>
<p>Unfortunately, we're not supporting hot reload for the <code>@stryker-mutator/jest-runner</code> or <code>@stryker-mutator/karma-runner</code> yet; please up-vote <a href="https://github.com/stryker-mutator/stryker-js/issues/3455" target="_blank" rel="noopener noreferrer" class="">#3455</a> or <a href="https://github.com/stryker-mutator/stryker-js/issues/3454" target="_blank" rel="noopener noreferrer" class="">#3454</a> respectively if you want to see it happen 💙.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-static-mutant-improvements">🗿 Static mutant improvements<a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-static-mutant-improvements" class="hash-link" aria-label="Direct link to 🗿 Static mutant improvements" title="Direct link to 🗿 Static mutant improvements" translate="no">​</a></h2>
<p>Yes, indeed, hot reload sounds incredible! But what about <em>static mutants</em>?</p>
<p>A static mutant is a mutant that is executed once on <em>file load</em> rather than during <em>test run-time</em>.</p>
<p>Take this small example:</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// greet.js</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> hi </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'👋'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">export</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">hi</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">name</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// greet.spec.js</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> greet </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'./greet.js'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">it</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'should greet me'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#d73a49">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'me'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">toBe</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'👋 me'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>When you run StrykerJS on this code, it will create a mutant for the <code>hi</code> constant:</p>
<div class="language-diff codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-diff codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">const hi = '👋';</span><br></div><div class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">const hi = '';</span><br></div></code></pre></div></div>
<p>When you consider mutant schemata, the actual code produced by StrykerJS looks more like this:</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> hi </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">activeMutant</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'1'</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">?</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">''</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'👋'</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>This mutant is called a <em>static mutant</em>. It is executed on file-load rather than during test run-time. For more details on static mutants, see <a class="" href="https://stryker-mutator.io/docs/mutation-testing-elements/static-mutants/">the new documentation on them</a>.</p>
<p>Now, let's factor in <a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-hot-reload" class="">hot reload</a>, where worker processes load the files once and reuse them across multiple mutant runs. This would mean that the mutant <em>survives no matter how good your tests are</em>. We can't have that 😪!</p>
<p>That's why StrykerJS will detect static mutants and <em>still follow the old process</em> to test them. However, instead of reloading the files (remember, this won't work for ESM files), it will create a shiny new worker process for every static mutant run (for NodeJS-based test runners).</p>
<p>Stryker will also sort mutants, testing static mutants after non-static mutants. This saves some time since this means fewer worker process restarts.</p>
<p>For example, imagine mutants A, B, and C, where B is a static mutant. To keep it simple, we will be running with concurrency 1, meaning only one worker exists at any one time.</p>
<ol>
<li class="">Mutant A: we start a worker process and test it.</li>
<li class="">Mutant B: we need to recreate the worker to test the static mutant</li>
<li class="">Mutant C: we need to recreate the worker <em>again</em>, because the previous mutant was static, which polluted the worker with a non-erasable mutant.</li>
</ol>
<p>Basic math tells us a worker is started three times in this example. Now imagine this example again, but with the mutants sorted: A, C, and B.</p>
<ol>
<li class="">Mutant A: we start a worker process and test it.</li>
<li class="">Mutant C: we reuse the worker and test it.</li>
<li class="">Mutant B: we need to recreate the worker to test the static mutant</li>
</ol>
<p>As you can see, sorting the mutants just saved us from having to restart the worker once. This performance gain might sound insignificant, but with 1000s of mutants, it can save 100s of restarts, well worth the (small) effort.</p>
<p>One final note about static mutants: the progress-reporter will now accurately report their progress. It does this by assigning a <em>weight</em> to each mutant to be tested, which it calculates using the performance measurements of the dry run. This means more smooth progress and a more realistic ETC estimate.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-ignore-static-mutants">🖐 Ignore static mutants<a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-ignore-static-mutants" class="hash-link" aria-label="Direct link to 🖐 Ignore static mutants" title="Direct link to 🖐 Ignore static mutants" translate="no">​</a></h2>
<p>Testing static mutants can be very expensive. As explained in the previous paragraph, they need a fresh worker process for each run (for Node-based test runners). On top of that, Stryker cannot determine test coverage for them. So the only thing it can do is run all tests 🐌.</p>
<p>Also, they are generally less interesting for you to spend your time on since they include constant strings, numbers, etc.</p>
<p>You might even want to ignore them entirely! This is where <code>--ignoreStatic</code> comes in. With <code>--ignoreStatic</code> static mutants are ... well ignored. Of course, you can still see them in your HTML report, but they won't count towards your mutation score.</p>
<figure><img src="https://stryker-mutator.io/images/blogs/ignored-static-mutant.png" alt="Ignored static mutant"><figcaption>An ignored static mutant</figcaption></figure>
<p>Ignoring static mutants improves performance, but your mileage may vary. It depends on the number of static mutants and the size of your project. For running StrykerJS on Stryker's core itself, we <a href="https://github.com/stryker-mutator/stryker-js/issues/3282#issuecomment-980110861" target="_blank" rel="noopener noreferrer" class="">saw a whopping 50% performance improvement by ignoring 6% of our mutants (the static mutants) 🤯</a>.</p>
<p>Even though it is a performance improvement, the default value for<code>"ignoreStatic"</code> is <code>false</code>, meaning Stryker won't ignore them. Our reasoning here is: "better be safe than sorry". But how would you know about this new feature when running Stryker on your project? Well, Stryker will tell you about it with a new warning message.</p>
<p>You will see the message when 2 conditions are met:</p>
<ol>
<li class="">Stryker estimates static mutants to take &gt;= 40% of the total execution time; and</li>
<li class="">Your project's estimated average execution time of a static mutant is twice that of a non-static mutant in your project.</li>
</ol>
<p>Stryker logs this message <em>right before testing mutants</em>, so you can quickly kill Stryker and run again with <code>--ignoreStatic</code> if you want.</p>
<p>Here is an example you will see when running StrykerJS on Stryker's core without <code>ignoreStatic</code>:</p>
<div class="language-text codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-text codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">WARN MutantTestPlanner Detected 255 static mutants (8% of total) that are estimated to take 83% of the time running the tests!</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  You might want to enable "ignoreStatic" to ignore these static mutants for your next run.</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  For more information about static mutants, visit https://stryker-mutator.io/docs/mutation-testing-elements/static-mutants.</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  (disable "warnings.slow" to ignore this warning)</span><br></div></code></pre></div></div>
<p>If you're happy with the performance tradeoff and want Stryker to stop annoying you, you can disable this warning by disabling <code>"warnings.slow"</code> in your stryker.conf.json file.</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"ignoreStatic"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"warnings"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token property" style="color:#36acaa">"slow"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-esm-based-config">📃 ESM-based config<a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-esm-based-config" class="hash-link" aria-label="Direct link to 📃 ESM-based config" title="Direct link to 📃 ESM-based config" translate="no">​</a></h2>
<p>From v6 onward, StrykerJS also supports <em>your config</em> as ESM. Either by adding <code>{ "type": "module" }</code> to your package.json file, or by renaming <code>stryker.conf.js</code> to <code>stryker.conf.mjs</code>.</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// stryker.conf.mjs</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token doc-comment comment" style="color:#999988;font-style:italic">/** </span><span class="token doc-comment comment keyword" style="color:#00009f;font-style:italic">@type</span><span class="token doc-comment comment" style="color:#999988;font-style:italic"> </span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">{</span><span class="token doc-comment comment class-name keyword" style="color:#00009f;font-style:italic">import</span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">(</span><span class="token doc-comment comment class-name string" style="color:#e3116c;font-style:italic">'@stryker-mutator/api/core'</span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">)</span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">.</span><span class="token doc-comment comment class-name" style="color:#999988;font-style:italic">PartialStrykerOptions</span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">}</span><span class="token doc-comment comment" style="color:#999988;font-style:italic"> */</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> config </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token literal-property property" style="color:#36acaa">reporters</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'html'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'clear-text'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'progress'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token literal-property property" style="color:#36acaa">testRunner</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'mocha'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token literal-property property" style="color:#36acaa">coverageAnalysis</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'perTest'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">export</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">default</span><span class="token plain"> config</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>We've updated the <code>stryker init</code> command to emit this new config file format when choosing for "JavaScript" config format.</p>
<p><em>Note</em>: for completeness sake, <code>stryker.conf.cjs</code> is also supported.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-breaking-changes">💥 Breaking changes<a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-breaking-changes" class="hash-link" aria-label="Direct link to 💥 Breaking changes" title="Direct link to 💥 Breaking changes" translate="no">​</a></h2>
<p>This is the list of breaking changes.</p>
<ul>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/commit/10d874e4c46335d9ea457634d3061af35fa8f854" target="_blank" rel="noopener noreferrer" class="">10d874</a> <strong>node</strong>: Drop support for Node 12. Minimal version is now Node 14.18.0.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3450" target="_blank" rel="noopener noreferrer" class="">#3450</a> <strong>checker-api:</strong> The <code>check</code> method of checker plugins now receives a <em>group of mutants</em> and should provide a <code>CheckResult</code> per mutant id.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3438" target="_blank" rel="noopener noreferrer" class="">#3438</a> <strong>html reporter:</strong> Configuration option <code>htmlReporter.baseDir</code> is deprecated and will be removed in a later version. Please use <code>htmlReporter.fileName</code> instead.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3432" target="_blank" rel="noopener noreferrer" class="">#3432</a> <strong>esm config:</strong> Exporting a function (using <code>module.exports = function(config) {}</code>) from your <code>stryker.conf.js</code> file is no longer supported. This was already deprecated but now will give an error.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3409" target="_blank" rel="noopener noreferrer" class="">#3409</a> <strong>esm:</strong> StrykerJS is now a pure ESM. Please <a href="https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c" target="_blank" rel="noopener noreferrer" class="">read this</a>.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3409" target="_blank" rel="noopener noreferrer" class="">#3409</a> <strong>esm:</strong> Karma v6.3 is now the min supported karma version for <code>@stryker-mutator/karma-runner</code>, since <a href="https://github.com/karma-runner/karma/blob/master/CHANGELOG.md#630-2021-03-23" target="_blank" rel="noopener noreferrer" class="">that version added support for async config loading</a></li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3396" target="_blank" rel="noopener noreferrer" class="">#3396</a> <strong>esm:</strong> The <code>@stryker-mutator/jasmine-runner</code> now requires jasmine@3.10 or higher.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3393" target="_blank" rel="noopener noreferrer" class="">#3393</a> <strong>esm:</strong> The <code>@stryker-mutator/mocha-runner</code> now requires <code>mocha@7.2</code> or higher.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3369" target="_blank" rel="noopener noreferrer" class="">#3369</a> <strong>reload test environment:</strong> Test runner plugins must provide <code>TestRunnerCapabilities</code> by implementing the <code>capabilities</code> method.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3489" target="_blank" rel="noopener noreferrer" class="">#3489</a> <strong>file</strong>: The File class is no longer part of the public api and is thus no longer exported from @stryker-mutator/api. Plugin creators shouldn't rely on it anymore.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3469" target="_blank" rel="noopener noreferrer" class="">3469</a> <strong>progress</strong>: Reporter API method onAllMutantsMatchedWithTests has been replaced by onMutationTestingPlanReady. Please use that for your reporter plugin instead.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3469" target="_blank" rel="noopener noreferrer" class="">3469</a> <strong>progress</strong>: Reporter API method onAllSourceFilesRead has been removed, please use onMutationTestReportReady to retrieve the source files.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3469" target="_blank" rel="noopener noreferrer" class="">3469</a> <strong>progress</strong>: Reporter API method onSourceFileRead has been removed, please use onMutationTestReportReady to retrieve the source files.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's next<a href="https://stryker-mutator.io/blog/stryker-js-v6-expeditious-superior-mutations/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's next" title="Direct link to 🔮 What's next" translate="no">​</a></h2>
<p>With v6 out, we will be implementing a performance boost for our <a href="https://github.com/stryker-mutator/stryker-js/pull/3450" target="_blank" rel="noopener noreferrer" class=""><code>typescript-checker</code></a>. In the medium term we'll be looking to implement <a href="https://github.com/stryker-mutator/stryker-js/issues/2753" target="_blank" rel="noopener noreferrer" class="">incremental mode</a>.</p>
<p>In the mean-time, we would love to hear from you! Please voice your feedback in the comment section below 👇, on <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">our slack channel</a> or by sending a <a href="https://twitter.com/stryker_mutator/" target="_blank" rel="noopener noreferrer" class="">tweet</a>.</p>]]></content:encoded>
            <category>stryker-js</category>
        </item>
        <item>
            <title><![CDATA[Announcing StrykerJS v6.0 Beta]]></title>
            <link>https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/</link>
            <guid>https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/</guid>
            <pubDate>Thu, 03 Mar 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to announce the beta of the next major release of the StrykerJS: StrykerJS 6.0.]]></description>
            <content:encoded><![CDATA[<p>We're excited to announce the beta of the next major release of the StrykerJS: StrykerJS 6.0.</p>
<p>From the 6th version onward, StrykerJS supports <em>native ECMAScript modules</em>, or ESM for short. To make this work, we changed some parts of StrykerJS, which includes small (yet technically breaking) changes. As a bonus, we've improved performance considerably in some use cases! We're curious to know what you think. Why not try the beta today?</p>
<!-- -->
<p>Update your Stryker dependencies to get started using the beta.</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/core@next</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/core@next</span><br></div></code></pre></div></div>
<p>Don't forget to update Stryker plugins. For example, when using the mocha runner:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/mocha-runner@next</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/mocha-runner@next</span><br></div></code></pre></div></div>
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. Please take a look at our RoboCoasters 🤖🎢 example and see how even 100% code coverage doesn't tell the whole story. Mutation testing is the only way to know if your tests are any good.</p>
<p>Now, let's dive into the changes! 🏊‍♂️</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-esm-support-for-nodejs-based-test-runners">📦 ESM support for NodeJS-based test runners<a href="https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/#-esm-support-for-nodejs-based-test-runners" class="hash-link" aria-label="Direct link to 📦 ESM support for NodeJS-based test runners" title="Direct link to 📦 ESM support for NodeJS-based test runners" translate="no">​</a></h2>
<p>As stated in the introduction, StrykerJS v6 brings official support for ESM projects.</p>
<p>With ESM, you can use <code>import</code> and <code>export</code> statements. NodeJS has supported ESM since version 12. Browsers have gradually been adding support since 2017, and all major browsers support it by now. I recommend watching <a href="https://www.youtube.com/watch?v=Zyoztl_7l7g" target="_blank" rel="noopener noreferrer" class="">Gil Tayar's introduction to ESM</a> when you want to brush up on the ESM basics.</p>
<p>The <code>@stryker-mutator/karma-runner</code> and <code>@stryker-mutator/jest-runner</code> already worked with ESM (for Jest, you will need to configure the <a class="" href="https://stryker-mutator.io/docs/stryker-js/jest-runner/#ecmascript-modules"><code>--experimental-vm-modules</code></a> flag), but our node-based runners did not. This changes with version 6.</p>
<p>You configure it like this:</p>
<pre tabindex="0" class="codeBlockStandalone_m2sz thin-scrollbar language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><code class="codeBlockLines_RuQK"></code></pre>
<p>As you can see <em>no configuration change</em> is needed. Updating StrykerJS is enough 😁.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-hot-reload">⏩ Hot reload<a href="https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/#-hot-reload" class="hash-link" aria-label="Direct link to ⏩ Hot reload" title="Direct link to ⏩ Hot reload" translate="no">​</a></h2>
<p>As you might know, StrykerJS uses mutation switching (sometimes called mutant schemata), meaning Stryker inserts all mutants into your source code yet only activates them one at a time.</p>
<p>It looks something like this:</p>
<div class="language-ts codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-ts codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">add</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">a</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">activeMutant </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token comment" style="color:#999988;font-style:italic">// 👾 BlockStatement mutator</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">activeMutant </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token operator" style="color:#393A34">?</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">-</span><span class="token plain"> b </span><span class="token comment" style="color:#999988;font-style:italic">// 👽 ArithmeticExpression mutator</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>Next, Stryker creates <em>worker</em> processes. A worker process is responsible for activating a mutant, running tests, and reporting the result to the main process. To do that, it uses the test runner of your choice, for example, <a href="https://mochajs.org/" target="_blank" rel="noopener noreferrer" class="">mocha</a>. For NodeJS-based test runners, it would look something like this:</p>
<p>(old process)</p>
<ol>
<li class="">Activate the mutant</li>
<li class=""><em>Load all files</em>, using <code>require</code></li>
<li class="">Run the tests with the test runner of choice.</li>
<li class=""><em>Unload all files</em>, using <a href="https://nodejs.org/api/modules.html#requirecache" target="_blank" rel="noopener noreferrer" class=""><code>delete require.cache['path/to/cjs/module']</code></a> to prepare for the next run.</li>
<li class="">Report the result</li>
</ol>
<p>As you can see, <em>all files are loaded and unloaded</em> for each mutant run. This way of reloading <a href="https://github.com/nodejs/tooling/issues/51" target="_blank" rel="noopener noreferrer" class="">won't ever work with native ESM</a>, as there is simply no <code>cache</code> we can <code>delete</code> the loaded files from 🤷‍♀️.</p>
<p>The reloading is also expensive. Think about it: if your project contains 1k files, with a total of 10k mutants, it could mean a total of <em>ten million file IO actions</em>. That's why mutation testing with StrykerJS would slow down considerably when the size of your project grows.</p>
<p>When you think about it, it is also <strong>unnecessary</strong>; why not simply keep all files loaded? Since they contain all the mutants anyway. This new process looks something like this:</p>
<p>(new process)</p>
<ol>
<li class="">(once) Load the code using <code>import</code></li>
<li class="">Activate the mutant</li>
<li class="">Run the tests with the test runner of choice.</li>
<li class="">Report the result</li>
</ol>
<p>The result is a significant performance improvement 🐇. You can clearly see the difference when running StrykerJS on Stryker's core itself:</p>
<table><thead><tr><th>Old</th></tr></thead><tbody><tr><td><img decoding="async" loading="lazy" alt="stryker-v5" src="https://stryker-mutator.io/assets/images/stryker-v5-fab7d65f05820d63820b7cae1bce5292.gif" width="1257" height="368" class="img_Qldj"></td></tr></tbody></table>
<table><thead><tr><th>New *</th></tr></thead><tbody><tr><td><img decoding="async" loading="lazy" alt="stryker-v6" src="https://stryker-mutator.io/assets/images/stryker-v6-a1b18c6c1cfd9f7866104465815134c4.gif" width="1257" height="368" class="img_Qldj"></td></tr></tbody></table>
<p>* using <code>--ignoreStatic</code></p>
<p>That's a whopping 70% performance improvement 🤯.</p>
<p>We call this feature "hot reload," and StrykerJS supports it in <code>@stryker-mutator/mocha-runner</code> and <code>@stryker-mutator/jasmine-runner</code>. Please note that this feature is always on from version 6 onward, even for plain old CommonJS style projects! It does require a higher version of mocha or jasmine, respectively, see <a href="https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/#-breaking-changes" class="">breaking changes</a>. Support for <code>@stryker-mutator/cucumber-runner</code> for the release of version 8 of <code>@cucumber/cucumber</code>.</p>
<p>Unfortunately, we're not supporting hot reload for the <code>@stryker-mutator/jest-runner</code> or <code>@stryker-mutator/karma-runner</code> yet; please up-vote <a href="https://github.com/stryker-mutator/stryker-js/issues/3455" target="_blank" rel="noopener noreferrer" class="">#3455</a> or <a href="https://github.com/stryker-mutator/stryker-js/issues/3454" target="_blank" rel="noopener noreferrer" class="">#3454</a> respectively if you want to see it happen 💙.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-ignore-static">🗿 Ignore static<a href="https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/#-ignore-static" class="hash-link" aria-label="Direct link to 🗿 Ignore static" title="Direct link to 🗿 Ignore static" translate="no">​</a></h2>
<p>Yes, indeed, hot reload sounds incredible! But what about <em>static mutants</em>?</p>
<p>A static mutant is a mutant that is executed once on <em>file load</em> rather than during <em>test runtime</em>.</p>
<p>Take this small example:</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// greet.js</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> hi </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'👋'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">export</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">name</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">hi</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">name</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// greet.spec.js</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> greet </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'./greet.js'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">it</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'should greet me'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#d73a49">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token function" style="color:#d73a49">greet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'me'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">toBe</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'👋 me'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>When you run StrykerJS on this code, it will create a mutant for the <code>hi</code> constant:</p>
<div class="language-diff codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-diff codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">const hi = '👋';</span><br></div><div class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">const hi = '';</span><br></div></code></pre></div></div>
<p>When you consider mutant schemata, the actual code produced by StrykerJS looks more like this:</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> hi </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">activeMutant</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'1'</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">?</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">''</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'👋'</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>When you now factor in <a href="https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/#-hot-reload" class="">hot reload</a>, you see that the mutant is only active during the runtime of the tests instead of at load time. This would mean that the mutant <em>survives no matter how good your tests are</em>. We can't have that 😪!</p>
<p>That's why StrykerJS will detect static mutants and <em>still follow the old process</em> to test them. However, instead of reloading the files (remember, this won't work for ESM files), it will create a shiny, new worker process for every static mutant run (for NodeJS-based test runners).</p>
<p>Creating new worker processes to test static mutants makes them much more expensive in StrykerJS v6. Also, they are generally less interesting for you to spend your time on since they include constant strings, numbers, etc. You might even want to ignore them entirely! This is where <code>--ignoreStatic</code> comes in.</p>
<p>With <code>--ignoreStatic</code> static mutants are ... well ignored. You can still see them in your HTML report, but they won't count towards your mutation score.</p>
<figure><img src="https://stryker-mutator.io/images/blogs/ignored-static-mutant.png" alt="Ignored static mutant"><figcaption>An ignored static mutant</figcaption></figure>
<p>Your mileage may vary, but for running StrykerJS on Stryker's core itself, we <a href="https://github.com/stryker-mutator/stryker-js/issues/3282#issuecomment-980110861" target="_blank" rel="noopener noreferrer" class="">saw a whopping 50% performance improvement by ignoring 6% of our mutants (the static mutants) 🤯</a>. For more details on static mutants, see <a class="" href="https://stryker-mutator.io/docs/mutation-testing-elements/static-mutants/">the new documentation on on them</a>.</p>
<p>Please try this feature out and provide feedback. We're also thinking of ways to point this feature out to users of Stryker, or even enable it by default. Feel free to voice your opinion in <a href="https://github.com/stryker-mutator/stryker-js/issues/3435" target="_blank" rel="noopener noreferrer" class="">the GitHub issue about it</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-esm-based-config">📃 ESM-based config<a href="https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/#-esm-based-config" class="hash-link" aria-label="Direct link to 📃 ESM-based config" title="Direct link to 📃 ESM-based config" translate="no">​</a></h2>
<p>From v6 onward, StrykerJS also supports <em>your config</em> as ESM. Either by adding <code>{ "type": "module" }</code> to your package.json file, or by renaming <code>stryker.conf.js</code> to <code>stryker.conf.mjs</code>.</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// stryker.conf.mjs</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token doc-comment comment" style="color:#999988;font-style:italic">/** </span><span class="token doc-comment comment keyword" style="color:#00009f;font-style:italic">@type</span><span class="token doc-comment comment" style="color:#999988;font-style:italic"> </span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">{</span><span class="token doc-comment comment class-name keyword" style="color:#00009f;font-style:italic">import</span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">(</span><span class="token doc-comment comment class-name string" style="color:#e3116c;font-style:italic">'@stryker-mutator/api/core'</span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">)</span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">.</span><span class="token doc-comment comment class-name" style="color:#999988;font-style:italic">PartialStrykerOptions</span><span class="token doc-comment comment class-name punctuation" style="color:#393A34;font-style:italic">}</span><span class="token doc-comment comment" style="color:#999988;font-style:italic"> */</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> config </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token literal-property property" style="color:#36acaa">reporters</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'html'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'clear-text'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'progress'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token literal-property property" style="color:#36acaa">testRunner</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'mocha'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token literal-property property" style="color:#36acaa">coverageAnalysis</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'perTest'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">export</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">default</span><span class="token plain"> config</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>We've updated the <code>stryker init</code> command to emit this new config file format when choosing for "JavaScript" config format.</p>
<p><em>Note</em>: for completeness sake, <code>stryker.conf.cjs</code> is also supported.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-breaking-changes">💥 Breaking changes<a href="https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/#-breaking-changes" class="hash-link" aria-label="Direct link to 💥 Breaking changes" title="Direct link to 💥 Breaking changes" translate="no">​</a></h2>
<p>This is the list of breaking changes.</p>
<ul>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3450" target="_blank" rel="noopener noreferrer" class="">#3450</a> <strong>checker-api:</strong> The <code>check</code> method of checker plugins now receives a <em>group of mutants</em> and should provide a <code>CheckResult</code> per mutant id.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3438" target="_blank" rel="noopener noreferrer" class="">#3438</a> <strong>html reporter:</strong> Configuration option <code>htmlReporter.baseDir</code> is deprecated and will be removed in a later version. Please use <code>htmlReporter.fileName</code> instead.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3432" target="_blank" rel="noopener noreferrer" class="">#3432</a> <strong>esm config:</strong> Exporting a function (using <code>module.exports = function(config) {}</code>) from your <code>stryker.conf.js</code> file is no longer supported. This was already deprecated but now will give an error.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3409" target="_blank" rel="noopener noreferrer" class="">#3409</a> <strong>esm:</strong> StrykerJS is now a pure ESM. Please <a href="https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c" target="_blank" rel="noopener noreferrer" class="">read this</a>.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3409" target="_blank" rel="noopener noreferrer" class="">#3409</a> <strong>esm:</strong> Node 12.20 is now the min version.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3409" target="_blank" rel="noopener noreferrer" class="">#3409</a> <strong>esm:</strong> Karma v6.3 is now the min supported karma version for <code>@stryker-mutator/karma-runner</code>, since <a href="https://github.com/karma-runner/karma/blob/master/CHANGELOG.md#630-2021-03-23" target="_blank" rel="noopener noreferrer" class="">that version added support for async config loading</a></li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3396" target="_blank" rel="noopener noreferrer" class="">#3396</a> <strong>esm:</strong> The <code>@stryker-mutator/jasmine-runner</code> now requires jasmine@3.10 or higher.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3393" target="_blank" rel="noopener noreferrer" class="">#3393</a> <strong>esm:</strong> The <code>@stryker-mutator/mocha-runner</code> now requires <code>mocha@7.2</code> or higher.</li>
<li class=""><a href="https://github.com/stryker-mutator/stryker-js/pull/3369" target="_blank" rel="noopener noreferrer" class="">#3369</a> <strong>reload test environment:</strong> Test runner plugins must provide <code>TestRunnerCapabilities</code> by implementing the <code>capabilities</code> method.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's next<a href="https://stryker-mutator.io/blog/announcing-stryker-js-v6-beta/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's next" title="Direct link to 🔮 What's next" translate="no">​</a></h2>
<p>We'll be focussing on getting StrykerJS 6.0 released in about a month or so. We would appreciate your feedback. Feel free to report any <a href="https://github.com/stryker-mutator/stryker-js/issues" target="_blank" rel="noopener noreferrer" class="">issues</a> you find or voice your opinion in the comment section below 👇 or on <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">our slack channel</a>.</p>]]></content:encoded>
            <category>stryker-js</category>
        </item>
        <item>
            <title><![CDATA[Announcing Stryker.NET 1.0]]></title>
            <link>https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/</link>
            <guid>https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/</guid>
            <pubDate>Sat, 30 Oct 2021 00:00:00 GMT</pubDate>
            <description><![CDATA[We're proud to announce the first major release of Stryker.NET: 1.0. It comes with exciting new features and an overhaul of how you interact with the Stryker CLI. With the release of Stryker 1.0, we wanted to create a cohesive and intuitive user experience.]]></description>
            <content:encoded><![CDATA[<p>We're proud to announce the first major release of Stryker.NET: 1.0. It comes with exciting new features and an overhaul of how you interact with the Stryker CLI. With the release of Stryker 1.0, we wanted to create a cohesive and intuitive user experience.</p>
<!-- -->
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. A mutation testing framework will make small changes, called <em>mutants</em>, one by one in your source code. Then it will run your tests to see if one of them fails. If so, you just "killed" that mutant; if not, it "survived". If too many mutants survive, you probably want to improve your tests. The mutation testing report will give you insides into the test cases you may have missed. If this all sounds complicated, please take a look at <a class="" href="https://stryker-mutator.io/docs/General/example/">our RoboCoasters 🤖🎢 example</a>.</p>
<p>If you're new to Stryker.NET, please follow our <a class="" href="https://stryker-mutator.io/docs/stryker-net/getting-started/">Getting started guide</a>. Are you already using Stryker.NET? Update to the latest version with the following command:</p>
<p>Global install:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">dotnet tool update dotnet-stryker --global</span><br></div></code></pre></div></div>
<p>Project install:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">dotnet tool update dotnet-stryker --local</span><br></div></code></pre></div></div>
<p>With that out of the way, let's dive into the new stuff!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-breaking-changes">💥 Breaking changes<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#-breaking-changes" class="hash-link" aria-label="Direct link to 💥 Breaking changes" title="Direct link to 💥 Breaking changes" translate="no">​</a></h2>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="-updated-runtime">⏭ Updated runtime<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#-updated-runtime" class="hash-link" aria-label="Direct link to ⏭ Updated runtime" title="Direct link to ⏭ Updated runtime" translate="no">​</a></h3>
<p>The .NET runtime for Stryker.NET has been updated from 3.1 to 5.0.</p>
<p>This update should have some performance benefits, and it will help with developing Stryker.NET in the future.</p>
<p>Please <a href="https://dotnet.microsoft.com/download/dotnet/5.0" target="_blank" rel="noopener noreferrer" class="">download and install .NET 5.0</a> or update your pipeline to support .NET 5.</p>
<p><em>Note that you do not have to update your application to use dotnet 5. Dotnet 5 is only a runtime requirement for Stryker to be able to run on your system.</em></p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="-options-rework">⏭ Options rework<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#-options-rework" class="hash-link" aria-label="Direct link to ⏭ Options rework" title="Direct link to ⏭ Options rework" translate="no">​</a></h3>
<p>Most options have been renamed or work differently.</p>
<p>A fundamental difference is how you pass multi-value options from the command line.</p>
<h4 class="anchor anchorTargetStickyNavbar_NcIB" id="multi-value-options">Multi value options<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#multi-value-options" class="hash-link" aria-label="Direct link to Multi value options" title="Direct link to Multi value options" translate="no">​</a></h4>
<p>The old annotation for passing multi-value options was confusing and not based on any standards. For example, this is how you provided multiple reporters pre 1.0 👎</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">dotnet stryker --reporters "['html', 'progress']"</span><br></div></code></pre></div></div>
<p>From 1.0 onward, this now looks like 👍</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">dotnet stryker --reporter "html" --reporter "progress"</span><br></div></code></pre></div></div>
<h4 class="anchor anchorTargetStickyNavbar_NcIB" id="options-migration-guide">Options migration guide<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#options-migration-guide" class="hash-link" aria-label="Direct link to Options migration guide" title="Direct link to Options migration guide" translate="no">​</a></h4>
<p>Most options have a new name. We have also decided that some options either don't belong on the commandline or don't belong in the configuration file. For example, an API key should not be stored in the configuration file so that possibility has been removed.</p>
<p>Options migration overview:</p>
<table><thead><tr><th>Old cli</th><th>New cli</th><th>Old json</th><th>New json</th></tr></thead><tbody><tr><td>config-file-path</td><td>f | config-file</td><td>❌</td><td>❌</td></tr><tr><td>max-concurrent-testrunners</td><td>c | concurrency</td><td>max-concurrent-testrunners</td><td>concurrency</td></tr><tr><td>dev-mode</td><td>dev-mode</td><td>dev-mode</td><td>❌</td></tr><tr><td>solution-path</td><td>s | solution</td><td>solution-path</td><td>solution</td></tr><tr><td>log-file</td><td>L | log-to-file</td><td>log-file</td><td>❌</td></tr><tr><td>log-level</td><td>V | verbosity</td><td>log-level</td><td>verbosity</td></tr><tr><td>mutation-level</td><td>l | mutation-level</td><td>mutation-level</td><td>mutation-level</td></tr><tr><td>threshold-high</td><td>❌</td><td>thresholds.high</td><td>thresholds.high</td></tr><tr><td>threshold-low</td><td>❌</td><td>thresholds.low</td><td>thresholds.low</td></tr><tr><td>threshold-break</td><td>b | break-at</td><td>thresholds.break</td><td>thresholds.break</td></tr><tr><td>reporters</td><td>r | reporter (flag allowed multiple times)</td><td>reporters</td><td>reporters</td></tr><tr><td>project-file</td><td>p | project</td><td>project-file</td><td>project</td></tr><tr><td>diff</td><td>since</td><td>diff</td><td>since</td></tr><tr><td>timeout-ms</td><td>❌</td><td>timeout-ms</td><td>additional-timeout</td></tr><tr><td>excluded-mutations</td><td>❌</td><td>excluded-mutations</td><td>ignore-mutations</td></tr><tr><td>ignore-methods</td><td>❌</td><td>ignore-methods</td><td>ignore-methods</td></tr><tr><td>mutate</td><td>m | mutate</td><td>mutate</td><td>mutate</td></tr><tr><td>language-version</td><td>❌</td><td>language-version</td><td>language-version</td></tr><tr><td>coverage-analysis</td><td>❌</td><td>coverage-analysis</td><td>coverage-analysis</td></tr><tr><td>abort-test-on-fail</td><td>❌</td><td>abort-test-on-fail</td><td>disable-bail</td></tr><tr><td>disable-testing-mix-mutations</td><td>❌</td><td>disable-testing-mix-mutations</td><td>disable-mix-mutants</td></tr><tr><td>test-projects</td><td>❌</td><td>test-projects</td><td>test-projects</td></tr><tr><td>dashboard-url</td><td>❌</td><td>dashboard-url</td><td>dashboard-url</td></tr><tr><td>dashboard-api-key</td><td>dashboard-api-key</td><td>dashboard-api-key</td><td>❌</td></tr><tr><td>project-name</td><td>❌</td><td>dashboard-project</td><td>project-info.name</td></tr><tr><td>module-name</td><td>❌</td><td>dashboard-module</td><td>project-info.module</td></tr><tr><td>dashboard-version</td><td>v | version</td><td>dashboard-version</td><td>project-info.version</td></tr><tr><td>diff-ignore-files</td><td>❌</td><td>diff-ignore-files</td><td>since.ignore-changes-in</td></tr><tr><td>azure-storage-url</td><td>❌</td><td>azure-storage-url</td><td>baseline.azure-fileshare-url</td></tr><tr><td>dashboard-fallback-version</td><td>❌</td><td>dashboard-fallback-version</td><td>baseline.fallback-version</td></tr><tr><td>baseline-storage-location</td><td>❌</td><td>baseline-storage-location</td><td>baseline.provider</td></tr><tr><td>dashboard-compare</td><td>with-baseline</td><td>dashboard-compare</td><td>baseline</td></tr><tr><td>git-diff-target</td><td>--since ...</td><td>git-diff-target</td><td>since.target</td></tr><tr><td>azure-storage-sas</td><td>azure-fileshare-sas</td><td>azure-storage-sas</td><td>❌</td></tr><tr><td>files-to-exclude</td><td>❌</td><td>❌</td><td>❌</td></tr><tr><td>test-runner</td><td>❌</td><td>❌</td><td>❌</td></tr></tbody></table>
<p>❌ means the option has been removed.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-new">🚀 What's new?<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#-whats-new" class="hash-link" aria-label="Direct link to 🚀 What's new?" title="Direct link to 🚀 What's new?" translate="no">​</a></h2>
<p>This release comes packed with new features! Let's walk through them all:</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="statement-removal-mutator">Statement removal mutator<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#statement-removal-mutator" class="hash-link" aria-label="Direct link to Statement removal mutator" title="Direct link to Statement removal mutator" translate="no">​</a></h3>
<p>We introduced a new mutator that removes statements that otherwise would have been untouched by other mutators.</p>
<p><img decoding="async" loading="lazy" src="https://stryker-mutator.io/assets/images/statement-mutation-01ed612b8bd8d4c674020acfb751584e.png" width="880" height="465" class="img_Qldj"></p>
<p>The mutator will remove the following statements:</p>
<ul>
<li class=""><code>return</code></li>
<li class=""><code>break</code></li>
<li class=""><code>continue</code></li>
<li class=""><code>goto</code></li>
<li class=""><code>throw</code></li>
<li class=""><code>yield return</code></li>
<li class=""><code>yield break</code></li>
<li class=""><code>expression</code></li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="allow-failing-tests">Allow failing tests<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#allow-failing-tests" class="hash-link" aria-label="Direct link to Allow failing tests" title="Direct link to Allow failing tests" translate="no">​</a></h3>
<p>It's now allowed to start a mutation test run even with failing tests. Stryker will try to make the best of the situation by marking mutants covered by <code>initially failing tests</code> as <code>survived</code>.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="mutant-filtering">Mutant filtering<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#mutant-filtering" class="hash-link" aria-label="Direct link to Mutant filtering" title="Direct link to Mutant filtering" translate="no">​</a></h3>
<p>It's now possible to filter mutants at the source code level using special comments. This filtering gives the most fine-grained level of control.</p>
<p>The syntax for the comments is: <code>Stryker [disable|restore][once][all| mutator list][: reason for disabling]</code></p>
<p><code>// Stryker disable all</code> Disables all mutants from that line on.</p>
<p><code>// Stryker restore all</code> re-enables all mutants from that line on.</p>
<p><code>// Stryker disable once all</code> will only disable mutants on the next line.</p>
<p><code>// Stryker disable once Arithmetic,Update</code> will only disable Arithmetic and Update mutants on the next line</p>
<p>Example:</p>
<div class="language-csharp codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-csharp codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token class-name keyword" style="color:#00009f">var</span><span class="token plain"> i </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token class-name keyword" style="color:#00009f">var</span><span class="token plain"> y </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Stryker disable all : for explanatory reasons</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">i</span><span class="token operator" style="color:#393A34">++</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// won't be mutated</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">y</span><span class="token operator" style="color:#393A34">++</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// won't be mutated</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Stryker restore all</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">i</span><span class="token operator" style="color:#393A34">--</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// will be mutated</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Stryker disable once all</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">y</span><span class="token operator" style="color:#393A34">--</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// won't be mutated</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">i</span><span class="token operator" style="color:#393A34">++</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// will be mutated</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Stryker disable once Arithmetic</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">y</span><span class="token operator" style="color:#393A34">++</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// will be mutated</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Stryker disable once Arithmetic,Update</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">i</span><span class="token operator" style="color:#393A34">--</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// won't be mutated</span><br></div></code></pre></div></div>
<p><em>Note that this feature is scope aware. If you disable mutators inside a method, the scope will not leak outside the method, even if there is more code below.</em></p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="ignore-mutations">Ignore mutations<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#ignore-mutations" class="hash-link" aria-label="Direct link to Ignore mutations" title="Direct link to Ignore mutations" translate="no">​</a></h3>
<p>The <code>ignore-mutations</code> option now offers more fine-grained control. Before v1.0 it was possible to ignore complete mutators. Now it's possible to ignore specific mutants inside these mutators as well.</p>
<p>Example:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token property" style="color:#36acaa">"stryker-config"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token property" style="color:#36acaa">"ignore-mutations"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token string" style="color:#e3116c">"linq.First"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token string" style="color:#e3116c">"linq.Sum"</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<blockquote>
<p>Note: this only works for Linq mutations for now, but we plan to bring this functionality to all mutations.</p>
</blockquote>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="msbuild-path-option">MsBuild path option<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#msbuild-path-option" class="hash-link" aria-label="Direct link to MsBuild path option" title="Direct link to MsBuild path option" translate="no">​</a></h3>
<p>By default Stryker tries to auto-discover MSBuild on your system. However, if Stryker fails to discover the correct MSBuild, you may manually supply the path with this option.</p>
<p>Example:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">--msbuild-path "c://MsBuild/MsBuild.exe"</span><br></div></code></pre></div></div>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="target-framework">Target framework<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#target-framework" class="hash-link" aria-label="Direct link to Target framework" title="Direct link to Target framework" translate="no">​</a></h3>
<p>If the project targets multiple frameworks, it is now possible to specify the particular framework to build against. If you set a non-existent target, Stryker will build the project against a random one (or the only one if so).</p>
<p>Example:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"stryker-config"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token property" style="color:#36acaa">"target-framework"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"netcoreapp3.1"</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="filter-test-cases">Filter test cases<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#filter-test-cases" class="hash-link" aria-label="Direct link to Filter test cases" title="Direct link to Filter test cases" translate="no">​</a></h3>
<p>A long-awaited feature has finally found its way into Stryker! It is now possible to exclude some test cases. So, for example, if you have long-running integration tests in your unit test project, they can be disabled for Stryker, improving the performance.</p>
<p>Example:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"stryker-config"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token property" style="color:#36acaa">"test-case-filter"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"(FullyQualifiedName~UnitTest1&amp;TestCategory=CategoryA)|Priority=1"</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>Uses <code>dotnet test --filter</code> option syntax, <a href="https://docs.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests" target="_blank" rel="noopener noreferrer" class="">detailed here</a>.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="use-source-link-for-dashboard-reporter">Use Source Link for dashboard reporter<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#use-source-link-for-dashboard-reporter" class="hash-link" aria-label="Direct link to Use Source Link for dashboard reporter" title="Direct link to Use Source Link for dashboard reporter" translate="no">​</a></h3>
<p>Filling all settings to use the dashboard reporter could be a bit of a hassle. However, thanks to <a href="https://github.com/dotnet/sourcelink#readme" target="_blank" rel="noopener noreferrer" class="">Source Link</a>, the repository URL and the full version (including the git SHA1) of a project can be included in the produced assembly.</p>
<p>Stryker now uses the information computed by SourceLink to automatically retrieve the project name (github.com/organization/project) and project version, both of which are requirements for the dashboard reporter.</p>
<p>Enable this by adding the following to your <code>.csproj</code>:</p>
<div class="language-xml codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-xml codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">ItemGroup</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">PackageReference</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">Include</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">DotNet.ReproducibleBuilds</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">Version</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">0.1.66</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">PrivateAssets</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">All</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">/&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">ItemGroup</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>For more information on SourceLink and ReproducibleBuilds see <a href="https://github.com/dotnet/sourcelink" target="_blank" rel="noopener noreferrer" class="">SourceLink</a> and <a href="https://github.com/dotnet/reproducible-builds" target="_blank" rel="noopener noreferrer" class="">Dotnet.ReproducibleBuilds</a></p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="block-removal-mutations">Block removal mutations<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#block-removal-mutations" class="hash-link" aria-label="Direct link to Block removal mutations" title="Direct link to Block removal mutations" translate="no">​</a></h3>
<p>Finally the last missing "common" mutation is added to Stryker.NET! Block removal mutations empty every block statement in your code. This means method bodies or statement bodies (if, while, for). With this mutation Stryker will have improved coverage on your complete codebase. Every method will have at least one mutation and thus should have at least one test.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-bug-fixes">🐛 Bug fixes<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#-bug-fixes" class="hash-link" aria-label="Direct link to 🐛 Bug fixes" title="Direct link to 🐛 Bug fixes" translate="no">​</a></h2>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="no-more-mutated-assembly-on-disk-after-stryker-run">No more mutated assembly on disk after Stryker run<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#no-more-mutated-assembly-on-disk-after-stryker-run" class="hash-link" aria-label="Direct link to No more mutated assembly on disk after Stryker run" title="Direct link to No more mutated assembly on disk after Stryker run" translate="no">​</a></h3>
<p>During mutation testing, Stryker replaces your system under test assembly on disk. Up till now, the mutated assembly stayed in place after mutation testing was done. This had some unintended side effects. For example, code coverage results could be incorrect until you rebuild your project, and there was the risk of accidentally releasing/publishing the mutated assembly instead of the original if you did not rebuild your project after mutation testing in your pipelines. We now copy your original assembly before we modify it and place it back after mutation testing. No more rebuild required!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-team-expansion">👪 Team expansion<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#-team-expansion" class="hash-link" aria-label="Direct link to 👪 Team expansion" title="Direct link to 👪 Team expansion" translate="no">​</a></h2>
<p>We welcome <a href="https://github.com/dupdob" target="_blank" rel="noopener noreferrer" class="">Cyrille DUPUYDAUBY</a> to the team! They have supported us with feedback, testing, and development since 2018. It was long past due that we officially recognized their contributions to the project!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-thank-you">🎉 Thank you<a href="https://stryker-mutator.io/blog/2021-30-10-announcing-stryker-net-1/#-thank-you" class="hash-link" aria-label="Direct link to 🎉 Thank you" title="Direct link to 🎉 Thank you" translate="no">​</a></h2>
<p>Special thanks to <a href="https://github.com/dupdob" target="_blank" rel="noopener noreferrer" class="">Cyrille DUPUYDAUBY</a>, <a href="https://github.com/psfinaki" target="_blank" rel="noopener noreferrer" class="">Peter Semkin</a>, <a href="https://github.com/philrowan-mtb" target="_blank" rel="noopener noreferrer" class="">Philip Rowan</a>, <a href="https://github.com/corentinaltepe" target="_blank" rel="noopener noreferrer" class="">Corentin Altepe</a>, <a href="https://github.com/0xced" target="_blank" rel="noopener noreferrer" class="">Cédric Luthi</a>, <a href="https://github.com/grbell-ms" target="_blank" rel="noopener noreferrer" class="">Gregory Bell</a>, <a href="https://github.com/JohnMcGlynnMSFT" target="_blank" rel="noopener noreferrer" class="">John McGlynn</a>, <a href="https://github.com/Bforslund" target="_blank" rel="noopener noreferrer" class="">Beatrice Forslund</a>, <a href="https://github.com/dukedagmor" target="_blank" rel="noopener noreferrer" class="">dukedagmor</a> and anyone else we may have missed for their efforts to make this release happen 👏 We truly appreciate all the help and feedback we receive!</p>]]></content:encoded>
            <category>stryker.net</category>
            <category>release</category>
            <category>mutation testing</category>
            <category>stryker mutator</category>
            <category>stryker-js</category>
        </item>
        <item>
            <title><![CDATA[Stryker4s: from 40 minutes to 40 seconds]]></title>
            <link>https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/</link>
            <guid>https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/</guid>
            <pubDate>Wed, 16 Jun 2021 00:00:00 GMT</pubDate>
            <description><![CDATA[Stryker4s is your friendly mutation testing framework for Scala. Compared to earlier versions, Stryker4s 0.12 achieves a 60x speed increase in some scenarios 🤯. Are you curious to know how? Keep on reading.]]></description>
            <content:encoded><![CDATA[<p>Stryker4s is your friendly mutation testing framework for Scala. Compared to earlier versions, Stryker4s <code>0.12</code> achieves a 60x speed increase in some scenarios 🤯. Are you curious to know how? Keep on reading.</p>
<!-- -->
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. A mutation testing framework will make small changes, called <em>mutants</em>, one by one in your source code. Then it will run your tests to see if one of them fails. If so, you just "killed" that mutant; if not, it "survived". If too many mutants survive, you probably want to improve your tests. The mutation testing report will give you insides into the test cases you may have missed. If this all sounds complicated, please take a look at the recent talk <a href="https://www.youtube.com/watch?v=Vq9eqZzblfg" target="_blank" rel="noopener noreferrer" class="">"Who is testing your tests?"</a> from <em>Scala Love in the City</em> or check out the rest of the <a class="" href="https://stryker-mutator.io/">website</a>.</p>
<p>In this blog we'll talk about the performance improvements made in the last couple Stryker4s versions and dive into how they are made possible.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-in-short">📃 In short<a href="https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/#-in-short" class="hash-link" aria-label="Direct link to 📃 In short" title="Direct link to 📃 In short" translate="no">​</a></h2>
<p>Imagine you're on your way to a sunny holiday destination. You've checked in your luggage, gone through customs, and boarded the plane. Then, the plane moves forward a couple of meters, and you're thrown out and sent back to customs before going through the whole thing again. It'll take years before you get to sip on your umbrella cocktail 🍹! This is exactly how Stryker4s has been running your code… until now.</p>
<p>A lot has changed in recent versions of Stryker4s. Stryker4s now runs your tests in an entirely different way, bringing big performance improvements. As an example, running Stryker4s on the Stryker4s codebase used to take about 40 minutes on <code>0.9.1</code>. On<code>0.12.1</code>, this has been reduced to a fast 40 seconds. A short list of some new features:</p>
<ul>
<li class="">✨ New testrunner boasting improved performance</li>
<li class="">🔀 Concurrency to improve speed by using all available cores</li>
<li class="">🕵️‍♀️ Coverage analysis to skip mutants without coverage</li>
<li class="">⏱️ Timeout detection in tests</li>
<li class="">👽 New mutator: regular expressions. Thanks to <a href="https://github.com/stryker-mutator/weapon-regex/" target="_blank" rel="noopener noreferrer" class="">Weapon regeX</a>!</li>
</ul>
<p>In the rest of this blog post, we'll do a deep-dive into the increased performance. Let's start by taking a look at the older version of Stryker4s.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-the-old">🐢 The old<a href="https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/#-the-old" class="hash-link" aria-label="Direct link to 🐢 The old" title="Direct link to 🐢 The old" translate="no">​</a></h2>
<p>In the older sbt plugin, there was a lot of overhead in running your tests. As a quick reminder, Stryker4s uses <a class="" href="https://stryker-mutator.io/blog/mutation-switching/">mutation switching</a>, so it only has to compile your code once, instead of for each mutant. After mutating your source code, Stryker4s would essentially just call <code>sbt test</code> with the mutated code for every mutant. This means sbt would:</p>
<ol>
<li class="">Look for code changes (which there never are).</li>
<li class="">Make sure all compiled code is up-to-date (which it always is).</li>
<li class="">Start a new Java process with your class files, dependencies, and a small sbt entry point library.</li>
<li class="">Run your tests and report the results back to the main sbt process.</li>
<li class="">Repeat for the next mutant.</li>
</ol>
<!-- -->
<p>Doing those checks and starting a new process makes a lot of sense for a development workflow, but not for mutation testing. This implementation of the test runner hasn't changed much in the two years that the plugin has existed. Time for some improvements!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-the-new">🐇 The new<a href="https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/#-the-new" class="hash-link" aria-label="Direct link to 🐇 The new" title="Direct link to 🐇 The new" translate="no">​</a></h2>
<p>It's clear the process can be optimized. Once Stryker4s is set up and all mutations have been compiled, the only thing we really want to do is run some tests and get a result. Sbt doesn't give plugins full control over the entire test process, but it does have all the information about <em>what</em> your project looks like. This is something we can work with!</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="️-meet-build-info">🏗️ Meet: build info<a href="https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/#%EF%B8%8F-meet-build-info" class="hash-link" aria-label="Direct link to 🏗️ Meet: build info" title="Direct link to 🏗️ Meet: build info" translate="no">​</a></h3>
<p>The first thing Stryker4s needs to do is figure out what tests our project contains. One of the great things about sbt is its standardization and extensibility as a build tool. Because sbt knows exactly what your project looks like, plugins can retrieve all this information. To find out what tests you have, Stryker4s uses three pieces of information from sbt:</p>
<ol>
<li class=""><code>fullClasspath</code> location of all dependency JARs (including test-dependencies) and <code>.class</code> files of your compiled code.</li>
<li class=""><code>loadedTestFrameworks</code> the configured test framework. Sbt detects a couple of frameworks by default, but if you use MUnit you might remember having to add <code>testFrameworks += new TestFramework("munit.Framework")</code> to your build.sbt before MUnit can run.</li>
<li class=""><code>testGrouping</code> contains every test suite sbt discovers in your project.</li>
</ol>
<p>You can try running these yourself in a sbt console to see how Stryker4s looks at your project:</p>
<div class="language-text codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-text codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">sbt:stryker4s-core&gt; show fullClasspath</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">[info] * Attributed(~/stryker4s/core/target/jvm-2.13/classes)</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">[info] * Attributed(~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">library/2.13.4/scala-library-2.13.4.jar)</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">[info] * Attributed(~/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/pathikrit/</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">better-files_2.13/3.9.1/better-files_2.13-3.9.1.jar)</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">...</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">sbt:stryker4s-core&gt; show loadedTestFrameworks</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">[info] Map(TestFramework(org.scalatest.tools.Framework, org.scalatest.tools.ScalaTestFramework) -&gt; org</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">.scalatest.tools.Framework@2b9d52d5)</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">...</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">sbt:stryker4s-core&gt; show testGrouping</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">[info] * (&lt;default&gt;,Vector(Test stryker4s.config.TestFilterTest : subclass(false, org.scalatest.Suite)</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">, Test stryker4s.extension.FileExtensionsTest : subclass(false, org.scalatest.Suite), Test stryker4s.m</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">utants.MutatorTest : subclass(false, org.scalatest.Suite), Test stryker4s.mutants.AddAllMutationsTest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">: subclass(false, org.scalatest.Suite), ...</span><br></div></code></pre></div></div>
<p>We now know what tests are in your project. Let's have a look at running those tests:</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="-meet-test-interfaces">🧪 Meet: test interfaces<a href="https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/#-meet-test-interfaces" class="hash-link" aria-label="Direct link to 🧪 Meet: test interfaces" title="Direct link to 🧪 Meet: test interfaces" translate="no">​</a></h3>
<p>This is something our friends in the NodeJS world are (rightfully) a little <a class="" href="https://stryker-mutator.io/docs/stryker-js/plugins/#test-runners">jealous of</a> 😏. When you call <code>sbt test</code>, sbt will look for any registered test frameworks that implement the <a href="https://github.com/sbt/test-interface" target="_blank" rel="noopener noreferrer" class="">test-interface</a> (from <code>loadedTestFrameworks</code>). This is a small collection of interfaces that let a test framework tell sbt how to run tests in that framework. Because all test frameworks in sbt implement this interface, we have a single programmatic way to call any test framework. It doesn't matter if you're using ScalaTest, MUnit, Weaver-test or anything else. Using a bit of reflection, we can create an instance of the test framework runner and run tests:</p>
<div class="language-scala codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-scala codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">val</span><span class="token plain"> framework </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> classLoader</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">loadClass</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">testFrameworkClass</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">getConstructor</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">newInstance</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">asInstanceOf</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">Framework</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">val</span><span class="token plain"> runner </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> framework</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">runner</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">args</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> remoteArgs</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> classLoader</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">val</span><span class="token plain"> testTasks</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Array</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">Task</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> runner</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">tasks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">testGrouping</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">taskDefs</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">testTasks</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">foreach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">testTask </span><span class="token keyword" style="color:#00009f">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  testTask</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">execute</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></div></code></pre></div></div>
<p>Stryker4s can then use this to activate a mutant and instantly run the tests without any overhead from sbt.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="-meet-concurrency">🔀 Meet: concurrency<a href="https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/#-meet-concurrency" class="hash-link" aria-label="Direct link to 🔀 Meet: concurrency" title="Direct link to 🔀 Meet: concurrency" translate="no">​</a></h3>
<p>Stryker4s activates and runs each mutant one by one in isolation. This is to make sure one mutant won't have an impact on the result of another. This is done by creating a separate process for it. However, there's no rule that says we can't start multiple Java processes at the same time and run those in parallel.</p>
<p>With multiple separate worker-processes, each worker has its own separate memory, threads, and active mutant. This way, if one mutant results in an <code>OutOfMemoryError</code> it won't impact the others. In long-lived processes like mutation testing, the performance increases of parallelism far outweigh the overhead of starting and managing multiple workers.</p>
<h3 class="anchor anchorTargetStickyNavbar_NcIB" id="-putting-it-all-together">🧰 Putting it all together<a href="https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/#-putting-it-all-together" class="hash-link" aria-label="Direct link to 🧰 Putting it all together" title="Direct link to 🧰 Putting it all together" translate="no">​</a></h3>
<p>Stryker4s can start a new process with all the information collected above. Because Stryker4s now fully controls how it runs your tests, it can eliminate any overhead of starting new processes or looking for source code changes. It looks a little something like this:</p>
<ol>
<li class="">Start new worker processes in parallel with the full test classpath and send them all the needed test setup.</li>
<li class="">Create a new instance of the test framework in the created process.</li>
<li class="">For each mutant, programmatically run the tests on the worker process.</li>
</ol>
<!-- -->
<p>As you can see, there's not much overhead left in running your tests. The limiting factor is now how fast your tests are! When running Stryker4s on itself, this method improves performance 60x: from 40 minutes to 40 seconds.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's next?<a href="https://stryker-mutator.io/blog/stryker4s-40-minutes-to-40-seconds/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's next?" title="Direct link to 🔮 What's next?" translate="no">​</a></h2>
<p>In this post, we've shown you how Stryker4s uses sbt's test information to reduce overhead and provide massive performance increases. We're very excited for you to try out the increased performance! If you have any feedback or questions, find us on <a href="https://github.com/stryker-mutator/stryker4s" target="_blank" rel="noopener noreferrer" class="">GitHub</a> or <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">Slack</a>.</p>
<p>Next, we want to also bring these performance improvements to the Maven plugin, add per-test coverage support, improve the HTML report to show your tests and perhaps even support some <a href="https://github.com/stryker-mutator/stryker4k" target="_blank" rel="noopener noreferrer" class="">new languages</a>?</p>]]></content:encoded>
            <category>stryker4s</category>
        </item>
        <item>
            <title><![CDATA[Announcing StrykerJS 5.0 - Brave new Dimension]]></title>
            <link>https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/</link>
            <guid>https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/</guid>
            <pubDate>Sat, 15 May 2021 00:00:00 GMT</pubDate>
            <description><![CDATA[We're proud to announce the next major release of StrykerJS: 5.0. With a name change, a new dimension in your report, a new way to discover files, updated mutators, quality of life improvements, and minor bug fixes.]]></description>
            <content:encoded><![CDATA[<p>We're proud to announce the next major release of StrykerJS: 5.0. With a name change, a new dimension in your report, a new way to discover files, updated mutators, quality of life improvements, and minor bug fixes.</p>
<!-- -->
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. A mutation testing framework will make small changes, called <em>mutants</em>, one by one in your source code. Then it will run your tests to see if one of them fails. If so, you just "killed" that mutant; if not, it "survived". If too many mutants survive, you probably want to improve your tests. The mutation testing report will give you insides into the test cases you may have missed. If this all sounds complicated, please take a look at <a class="" href="https://stryker-mutator.io/docs/General/example/">our RoboCoasters 🤖🎢 example</a>.</p>
<p>If you're new to StrykerJS, please follow our <a class="" href="https://stryker-mutator.io/docs/stryker-js/getting-started/">Getting started guide</a>. Are you already using StrykerJS? Update to the latest version with your package manager of choice.</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/core@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/core@latest</span><br></div></code></pre></div></div>
<p>Don't forget to do the same for any plugins you might be using. For example,</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/mocha-runner@latest</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"># OR</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">yarn add --dev @stryker-mutator/mocha-runner@latest</span><br></div></code></pre></div></div>
<p>With that out of the way, let's dive into the new stuff!</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-name-change">👪 Name change<a href="https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/#-name-change" class="hash-link" aria-label="Direct link to 👪 Name change" title="Direct link to 👪 Name change" translate="no">​</a></h2>
<p>That's right. We've rebranded 'Stryker for JavaScript and friends' as simply <strong>StrykerJS</strong>. This change makes it easier to distinguish StrykerJS from other frameworks in the Stryker family (Stryker.NET and Stryker4s). It also allows for better use of Twitter real estate 😊.</p>
<p>Don't worry; the names of the NPM packages haven't changed. So it is purely a branding thing.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-new-dimension">✨ New dimension<a href="https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/#-new-dimension" class="hash-link" aria-label="Direct link to ✨ New dimension" title="Direct link to ✨ New dimension" translate="no">​</a></h2>
<p>The mutation test report has always been the bread and butter of Stryker. Either in your browser or console, it is where you find out where the killed and survived mutants are. But the next question you might ask is: which tests were responsible? Stryker knows but wasn't telling you. Until now!</p>
<p>Behold, the new dimension you'll find in your reports—the test view 🧪.</p>
<p><img decoding="async" loading="lazy" alt="html test view" src="https://stryker-mutator.io/assets/images/test-view-html-1-b677c67c540e82c752f67087cd2d4bb6.png" width="1106" height="708" class="img_Qldj">
<img decoding="async" loading="lazy" alt="html test view2" src="https://stryker-mutator.io/assets/images/test-view-html-2-ddf766a1bca73b9057288c9ca481b0f7.png" width="1614" height="619" class="img_Qldj"></p>
<p>Or using the <code>clear-text</code> reporter:</p>
<p><img decoding="async" loading="lazy" alt="text test view" src="https://stryker-mutator.io/assets/images/test-view-console-0c3e4039fad82b0a9f3f5a56a1499179.png" width="1768" height="381" class="img_Qldj"></p>
<p>The test view tells you at a glance which tests are <em>killing</em> mutants, which are merely <em>covering</em> mutants (without killing) and which are <em>not covering</em> any mutants. Furthermore, you can determine which mutants were covered or killed by that particular test case. Finding out so much information about your tests has never been this easy!</p>
<p>A couple of caveats to point out:</p>
<ul>
<li class="">The <code>Covering</code> state will only be available when selecting the <a class="" href="https://stryker-mutator.io/docs/stryker-js/configuration/#coverageanalysis-string"><code>perTest</code> coverage analysis setting</a>.</li>
<li class="">StrykerJS always runs your tests with <code>bail</code> mode active (or <code>failFast</code> in jasmine), making your test runner stop after the first failing test. As a result, a mutant can only be killed by one test. If you have overlap in asserts across tests, other tests might be marked as "Covering", while they would kill a mutant when run in isolation.</li>
<li class="">Some mutants are executed as soon as your file <em>is loaded</em> instead of during <em>test execution</em>. We call these mutants <em>static mutants</em>, and all your tests are executed as a result. For example:<!-- -->
<div class="language-diff codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-diff codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">// hello.js</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">export const hello ='👋'</span><br></div><div class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">export const hello = ''</span><br></div></code></pre></div></div>
<!-- -->A test that for <code>hello</code> might look like:<!-- -->
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> hello </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'./hello.js'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">describe</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'hello'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#d73a49">it</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'should be a string'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=&gt;</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">typeof</span><span class="token plain"> hello</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">toBe</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'string'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<!-- -->As you can see, this is a relatively weak test that doesn't kill this mutant. You might assume that this test covers the mutant, but upon further inspection, you'll notice that <code>hello</code> is declared as soon as the file loads. There is no way for Stryker to know that this test is supposed to cover the mutant. As a result, the test is marked as "Not Covering".</li>
<li class="">Currently, only the <code>@stryker-mutator/jest-runner</code> can group your tests in their original test files. Running with another test runner will result in your tests being displayed in a list instead.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="️-discovering-files">🤷‍♂️ Discovering files<a href="https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/#%EF%B8%8F-discovering-files" class="hash-link" aria-label="Direct link to 🤷‍♂️ Discovering files" title="Direct link to 🤷‍♂️ Discovering files" translate="no">​</a></h2>
<p>StrykerJS typically doesn't mutate your files directly. Instead, it creates a copy inside a <em>sandbox</em> directory, usually located at <code>.stryker-tmp/sandbox-123456</code>. However, it won't copy over all files there to save time. Stryker used to rely on git to decide which files to copy. Any <code>.gitignored</code> files would not be copied.</p>
<p>There were some issues with this approach. First of all, it required your project to be located in a git repository, and you needed to have git installed. And then, there are also examples of test suites that need some <code>.gitignore</code>d files to run, like <code>.env</code>.</p>
<p>To combat these issues, StrykerJS 5 will no longer use git for file discovery. Instead, it will include all files while ignoring some standard patterns, like "node_modules". You can remove more files by specifying patterns in the new <a class="" href="https://stryker-mutator.io/docs/stryker-js/configuration/#ignorepatterns-string"><code>ignorePatterns</code></a> configuration option. For example:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"ignorePatterns"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"bower_components"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>StrykerJS also allows you to specify <code>files</code>, which does the opposite of <code>ignorePatterns</code>, namely, you select the files you need to run your tests. Painstakenly whitelisting each file is more time-consuming and prone to error; that's why we've decided to <em>deprecate</em> <code>files</code> in favor of <code>ignorePatterns</code>.</p>
<p>Are you currently using <code>files</code>? You can probably remove <code>files</code>, and Stryker will still work. Or, if you still prefer the whitelisting method, you can achieve this like so:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"ignorePatterns"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"**"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"!src/**/*.js"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>See the <a href="https://github.com/stryker-mutator/stryker-js/pull/2848" target="_blank" rel="noopener noreferrer" class="">original pull request</a> for more information.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-updated-mutators">👽 Updated mutators<a href="https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/#-updated-mutators" class="hash-link" aria-label="Direct link to 👽 Updated mutators" title="Direct link to 👽 Updated mutators" translate="no">​</a></h2>
<p>We've decided to add a new variant to the <a class="" href="https://stryker-mutator.io/docs/mutation-testing-elements/supported-mutators/#logical-operator">logical operator mutator</a>. It now also mutates <em>the nullish coalescing operator</em> (<code>??</code>).</p>
<div class="language-diff codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-diff codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">foo ?? bar</span><br></div><div class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">foo &amp;&amp; bar</span><br></div></code></pre></div></div>
<p>To kill this mutant, you will need to write a test for both branches of the operator. Like you already needed to do for the logical OR (<code>||</code>) and logical AND (<code>&amp;&amp;</code>) operators.</p>
<p>We're also in the process of adding a new <a href="https://github.com/stryker-mutator/stryker-js/pull/2886" target="_blank" rel="noopener noreferrer" class="">optional chaining mutator</a>, but that didn't make it in time for this release.</p>
<p>A quick plug: as of version 4.4, StrykerJS will also mutate your <code>/regex/</code>s. For example:</p>
<div class="language-diff codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-diff codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49"> /\d{4}\s?[a-Z]{2}/</span><br></div><div class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa"> /\d\s?[a-Z]{2}/</span><br></div><div class="token-line" style="color:#393A34"><span class="token inserted-sign inserted line" style="color:#36acaa"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa"> /\D{4}\s?[a-Z]{2}/</span><br></div><div class="token-line" style="color:#393A34"><span class="token inserted-sign inserted line" style="color:#36acaa"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa"> /\d{4}\S?[a-Z]{2}/</span><br></div><div class="token-line" style="color:#393A34"><span class="token inserted-sign inserted line" style="color:#36acaa"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa"> /\d{4}\s?[a-Z]/</span><br></div><div class="token-line" style="color:#393A34"><span class="token inserted-sign inserted line" style="color:#36acaa"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa"> /\d{4}\s?[^a-Z]{2}/</span><br></div></code></pre></div></div>
<p>Thanks again to the students who created <a href="https://github.com/stryker-mutator/weapon-regex/" target="_blank" rel="noopener noreferrer" class="">weapon-regex</a> to make this happen 🎉</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="️️-default-coverage-analysis">🕵️‍♂️ Default coverage analysis<a href="https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/#%EF%B8%8F%EF%B8%8F-default-coverage-analysis" class="hash-link" aria-label="Direct link to 🕵️‍♂️ Default coverage analysis" title="Direct link to 🕵️‍♂️ Default coverage analysis" translate="no">​</a></h2>
<p>Coverage analysis is a feature that makes StrykerJS run faster because it will run fewer tests per mutant. In its strongest setting, <code>"coverageAnalysis": "perTest"</code>, it will only run the exact tests that are covering a mutant. Whether or not you are able to use this feature depends on your test suite and test runner, see <a class="" href="https://stryker-mutator.io/docs/stryker-js/configuration/#coverageanalysis-string">coverage analysis in configuration</a> for more details.</p>
<p>Since v4.3, <code>@stryker-mutator/jest-runner</code> also supports this setting. Now that all officially supported test runners support coverage analysis, it was time to make <code>perTest</code> the default setting. So we did. You can still disable it with <code>"coverageAnalysis": "off"</code></p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-other-changes">🧹 Other changes<a href="https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/#-other-changes" class="hash-link" aria-label="Direct link to 🧹 Other changes" title="Direct link to 🧹 Other changes" translate="no">​</a></h2>
<p>We once again chose to improve the maintainability of the Stryker code base.</p>
<p><strong>Unified reporter api</strong></p>
<p>The Reporter plugin API has gotten an overhaul. It is now more in line with <a href="https://github.com/stryker-mutator/mutation-testing-elements/" target="_blank" rel="noopener noreferrer" class="">mutation-testing-elements</a></p>
<p>See the <a href="https://github.com/stryker-mutator/stryker-js/pull/2798" target="_blank" rel="noopener noreferrer" class="">original PR</a> for more information.</p>
<p><strong>Serialization</strong></p>
<p>Stryker uses worker processes to run tests and check mutants for type errors. These workers receive any options via a message. Stryker used the <a href="https://www.npmjs.com/package/surrial" target="_blank" rel="noopener noreferrer" class="">surrial</a> package to serialize complex objects like <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp" target="_blank" rel="noopener noreferrer" class="">RegExp</a>, functions, and even classes. This hidden feature was rarely used and not a good practice in hindsight. StrykerJS 5 replaces this with plain old <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify" target="_blank" rel="noopener noreferrer" class=""><code>JSON.stringify</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse" target="_blank" rel="noopener noreferrer" class=""><code>JSON.parse</code></a>. Don't worry, you get a warning if you configure something that isn't serializable.</p>
<p>See the <a href="https://github.com/stryker-mutator/stryker-js/pull/2877" target="_blank" rel="noopener noreferrer" class="">original PR</a> for more information.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-breaking-changes">💥 Breaking changes<a href="https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/#-breaking-changes" class="hash-link" aria-label="Direct link to 💥 Breaking changes" title="Direct link to 💥 Breaking changes" translate="no">​</a></h2>
<ul>
<li class="">
<p><strong>range:</strong> The <code>range</code> property is no longer present on a <code>mutant</code>. Note, this is a breaking change for plugin creators only.</p>
</li>
<li class="">
<p><strong>options:</strong> <code>"perTest"</code> is now the default value for "coverageAnalysis" when the configured test runner is not "command". Explicitly set <code>"coverageAnalysis": "off"</code> manually to opt-out of this behavior.</p>
</li>
<li class="">
<p><strong>node:</strong> Node 10 is no longer supported. Please use Node 12 or higher.</p>
</li>
<li class="">
<p><strong>serialize:</strong> Having a non-JSON-serializable value in your configuration won't be sent to the child process anymore. If you really need them in your test runner configuration, you should isolate those values and put them in test runner-specific config files, loaded by the test runner plugin itself, for example, jest.config.js, karma.conf.js, webpack.config.js.</p>
</li>
<li class="">
<p><strong>ignore patterns:</strong> Stryker will no longer use a git command to determine which files belong to your project. Instead, it will rely on sane defaults. You can change this behavior by defining <a class="" href="https://stryker-mutator.io/docs/stryker-js/configuration/#ignorepatterns-string"><code>ignorePatterns</code></a>.</p>
</li>
<li class="">
<p><strong>ignore patterns:</strong> The <code>files</code> configuration option is deprecated and will be removed in a future release. Please use <a class="" href="https://stryker-mutator.io/docs/stryker-js/configuration/#ignorepatterns-string"><code>ignorePatterns</code></a> instead.</p>
<p>This:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"files"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"foo.js"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>Is equivalent to:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"ignorePatterns"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"**"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"!foo.js"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
</li>
<li class="">
<p><strong>reporter api:</strong> Changes to <code>Reporter</code> and <code>TestRunner</code> plugin API of Stryker</p>
</li>
<li class="">
<p><strong>jest-runner:</strong> Support for project type <code>create-react-app-ts</code> is dropped from the jest-runner.</p>
</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-thank-you">🎉 Thank you<a href="https://stryker-mutator.io/blog/announcing-stryker-js-5-brave-new-dimension/#-thank-you" class="hash-link" aria-label="Direct link to 🎉 Thank you" title="Direct link to 🎉 Thank you" translate="no">​</a></h2>
<p>Thanks to everyone for your continued support! Have questions or issues? Don't hesitate to contact us in <a href="https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM" target="_blank" rel="noopener noreferrer" class="">Slack</a>, on <a href="https://twitter.com/stryker_mutator/" target="_blank" rel="noopener noreferrer" class="">Twitter</a> or open <a href="https://github.com/stryker-mutator/stryker-js/issues/new/choose" target="_blank" rel="noopener noreferrer" class="">an issue</a>.</p>]]></content:encoded>
            <category>stryker-js</category>
        </item>
        <item>
            <title><![CDATA[Announcing Stryker 4.0 - Mutation Switching]]></title>
            <link>https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/</link>
            <guid>https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/</guid>
            <pubDate>Wed, 07 Oct 2020 00:00:00 GMT</pubDate>
            <description><![CDATA[We're proud to announce the next major release of the Stryker mutation testing framework for JavaScript and friends: Stryker 4.0.]]></description>
            <content:encoded><![CDATA[<p>We're proud to announce the next major release of the Stryker mutation testing framework for JavaScript and friends: Stryker 4.0.</p>
<p>This release marks a fundamental shift in the way Stryker works internally. It now uses "mutation switching", which improves performance and usability, similar to how Stryker.NET and Stryker4s already work. This change, unfortunately, couldn't be done without breaking changes. See the breaking changes paragraph if you're interested.</p>
<!-- -->
<p><strong>🎧 Listen to the <a target="_blank" rel="noopener noreferrer" href="https://thedeepdive.simplecast.com/episodes/mutation-testing-with-stryker">"Mutation testing with Stryker" podcast episode on InDepth.dev</a></strong></p>
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. Please look at <a class="" href="https://stryker-mutator.io/docs/General/example/">our RoboCoasters 🤖🎢 example</a> and see how even 100% code coverage doesn't tell the whole story. Mutation testing is the only way to make sure you're not missing any tests.</p>
<p><strong><em>Note: updated on 9 October 2020: add remark about TypeScript 3.7 requirement in <a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-breaking-changes" class="">Breaking changes</a>.</em></strong></p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-getting-started">🚀 Getting started<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-getting-started" class="hash-link" aria-label="Direct link to 🚀 Getting started" title="Direct link to 🚀 Getting started" translate="no">​</a></h2>
<p>If you're new to Stryker, please follow the <a class="" href="https://stryker-mutator.io/docs/stryker-js/getting-started/">quickstart guide</a>.</p>
<p>If you're already using Stryker, you can install this latest version with your package manager of choice.</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/core</span><br></div></code></pre></div></div>
<p>Don't forget to do the same for your Stryker plugins. Please note that the following plugins have been removed and are no longer needed:</p>
<ul>
<li class=""><del>@stryker-mutator/typescript</del></li>
<li class=""><del>@stryker-mutator/jasmine-framework</del></li>
<li class=""><del>@stryker-mutator/mocha-framework</del></li>
<li class=""><del>@stryker-mutator/babel-transpiler</del></li>
<li class=""><del>@stryker-mutator/webpack-transpiler</del></li>
<li class=""><del>@stryker-mutator/javascript-mutator</del></li>
</ul>
<p>You can remove these from your package.json.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-mutation-switching">👽 Mutation switching<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-mutation-switching" class="hash-link" aria-label="Direct link to 👽 Mutation switching" title="Direct link to 👽 Mutation switching" translate="no">​</a></h2>
<p>Mutation switching is a way to put all mutants into your code simultaneously.</p>
<p>Let's take a look at an example.</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">add</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">a</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>When you feed this code to Stryker, it will generate two mutants:</p>
<p><code>👽 function add(a, b) { return a - b }</code><br>
<code>👾 function add(a, b) {}</code></p>
<p>Previous versions of Stryker would make two copies of your source code. One for each mutant. Stryker 4.0 will now place <em>all mutants into the code simultaneously</em>, but with only <em>one mutant active at any one time</em>.</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">add</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">a</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">activeMutant</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token comment" style="color:#999988;font-style:italic">// 👾</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">activeMutant</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token operator" style="color:#393A34">?</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">-</span><span class="token plain"> b </span><span class="token comment" style="color:#999988;font-style:italic">// 👽</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>(simplified example)</p>
<p>Stryker now runs your tests while changing (or <em>switching</em>) the active mutant between runs. Mutation switching can improve performance dramatically, depending on the type of project.</p>
<p>You're probably wondering: how much performance improvement? Like all great questions, the answer is: 'it depends'. For example, when you bundle your code with webpack before running the tests, then webpack only needs to run once, a significant performance gain. On the other hand, if you're running Stryker on an ES5 project with mocha, the improvement might not be that substantial. In our experience, you can expect somewhere between 20% to 70% speed increase.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-code-instrumentation">🐠 Code instrumentation<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-code-instrumentation" class="hash-link" aria-label="Direct link to 🐠 Code instrumentation" title="Direct link to 🐠 Code instrumentation" translate="no">​</a></h2>
<p>Mutation Switching yields a significant performance improvement, but it means that Stryker is required to perform some complex transformations to the <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree" target="_blank" rel="noopener noreferrer" class="">Abstract Syntax Tree (AST)</a>.</p>
<p>Doing this <em>instrumentation</em> means visiting each node of the AST to collect and place mutants. This instrumentation is implemented with the <a href="https://babeljs.io/" target="_blank" rel="noopener noreferrer" class="">Babel</a> parser and now ships with <code>@stryker-mutator/core</code>. We're taking advantage of Babel's support for all types of JavaScript, including TypeScript code.</p>
<p><em>Note that to implement mutation switching in both TypeScript and JavaScript before the release of Babel v7 would have meant implementing it twice. We think it is incredible that the Babel maintainers chose to add TypeScript support. We're standing on the shoulders of giants here 🎉. Without this, we probably wouldn't have done it.</em></p>
<p>This instrumentation means you <em>no longer need to configure the mutator</em> in your Stryker configuration. Stryker will always use the new mutation instrumenter. It supports TypeScript, JavaScript, Flow, and JSX. It even mutates script tags in <code>.html</code> or <code>.vue</code> files. It also picks up your babel configuration out-of-the-box, so no custom configuration is needed—cupcakes for everyone 🧁.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-build-command-support">👷‍‍ Build command support<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-build-command-support" class="hash-link" aria-label="Direct link to 👷‍‍ Build command support" title="Direct link to 👷‍‍ Build command support" translate="no">​</a></h2>
<p><em>Note: not all projects need building. Simple projects might deploy JS code as is, or the test runner might take care of this step for you. For example, running your tests with ts-node or babel/register or running it with Jest or Karma with the webpack plugin.</em></p>
<p>Previous versions of Stryker allowed you to configure a transpiler. For example, configuring <code>"transpilers": ["babel"]</code> would allow all files to be transpiled with the <code>@stryker-mutator/babel-transpiler</code> plugin. This way of working had its disadvantages:</p>
<ul>
<li class="">⛔ Since every mutant needed to transpiled one by one, it was slow.</li>
<li class="">⛔ Every transpiler/bundler required a plugin. We only officially supported Webpack, Babel, and TypeScript. If you were using a different tool, you were out of luck.</li>
<li class="">⛔ It was hard to maintain the transpiler plugins since it hooked into the transpiler/bundler's API.</li>
</ul>
<p>Stryker 4.0 gets rid of the transpiler plugins. Instead, it allows you to configure a <code>buildCommand</code>. Stryker will run this command once in the sandbox directory after instrumenting your code and just before starting the dry run. For example, running Stryker with <code>--buildCommand "npm run build"</code> will run <code>npm run build</code> inside the sandbox directory.</p>
<p>This new way of working gets rid of all the disadvantages listed above. It will only run once, you can use whichever tool you want, and we don't have to maintain plugins—a win-win-win scenario. The old transpiler plugins are no longer needed, and you can remove them from your project.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-checker-plugin">✅ Checker plugin<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-checker-plugin" class="hash-link" aria-label="Direct link to ✅ Checker plugin" title="Direct link to ✅ Checker plugin" translate="no">​</a></h2>
<p>You might know that the old <code>@stryker-mutator/typescript</code> transpiler not only transpiled your code but also filtered out mutants that resulted in type errors, marking them with "compile error" in your report. Mutants with this status are considered invalid and do not influence your mutation score.</p>
<p>Stryker 4.0 removes the transpiler plugin in favor of <code>--buildCommand</code>.</p>
<p><em>Wondering how your TypeScript code compiles even while some mutants might create type errors? Stryker places <code>// @ts-nocheck</code> atop your code files. Your TypeScript compiler will ignore any type errors produced by instrumenting your code.</em></p>
<p>However, you might still want to invalidate mutants that result in a type error, so you won't spend any time looking at them. The new "Checker" plugin helps you here. Checker plugins can choose to invalidate mutants based on rules specific to the checker.</p>
<p>We maintain one such checker, the <code>@stryker-mutator/typescript-checker</code>. It will mark mutants that would result in a type error with "Compile error".</p>
<p>Install it with <code>npm install -D @stryker-mutator/typescript-checker</code>.</p>
<p>Configure it with:</p>
<div class="language-json codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-json codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"checkers"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"typescript"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#36acaa">"tsconfigFile"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"tsconfig.json"</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>Please see <a href="https://github.com/stryker-mutator/stryker-js/tree/master/packages/typescript-checker#readme" target="_blank" rel="noopener noreferrer" class="">the TypeScript checker's readme</a> for more details.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-coverage-analysis">☔ Coverage analysis<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-coverage-analysis" class="hash-link" aria-label="Direct link to ☔ Coverage analysis" title="Direct link to ☔ Coverage analysis" translate="no">​</a></h2>
<p>Coverage analysis is a great way to speed up mutation testing. It is a means to reduce the number of tests Stryker needs to run to test a mutant. Stryker has three flavors:</p>
<ul>
<li class=""><strong>"off"</strong>: No coverage analysis</li>
<li class=""><strong>"all"</strong>: Mutant coverage for the entire test suite is measured. Mutants without coverage are marked with "no coverage". But all tests run for mutants that are covered.</li>
<li class=""><strong>"perTest"</strong>: Mutant coverage is measured per test. Stryker runs only the tests that cover a specific mutant when it tests that mutant.</li>
</ul>
<p>Running with "perTest" coverage analysis allows for significant performance improvement, usually between 40% and 60%. However, most projects were unable to take advantage of it because Stryker relied on <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer" class="">istanbul code coverage</a> combined with test runner hooks. It only worked in scenarios without transpiling or bundling.</p>
<p>This changes with version 4. When Stryker instruments your code with mutants, it also injects the coverage instrumentation. No need for instanbul anymore, allowing Stryker to measure mutant coverage, <em>regardless of which bundler/transpiler you are using</em>. Hooking into the test runner is the only remaining requirement. All test runner plugins support these hooks, except for the <code>@stryker-mutator/jest-runner</code> (although we're <a href="https://github.com/stryker-mutator/stryker-js/issues/2316" target="_blank" rel="noopener noreferrer" class="">planning to support it</a>).</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-other-changes">🧹 Other changes<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-other-changes" class="hash-link" aria-label="Direct link to 🧹 Other changes" title="Direct link to 🧹 Other changes" translate="no">​</a></h2>
<p>We also decided to take this opportunity to improve the maintainability of the Stryker code further. That's why we've decided to drop support for two more plugin types.</p>
<p><strong>The <code>TestFramework</code> plugins are removed.</strong></p>
<p>A test framework plugin used to be responsible for allowing Stryker to hook into the test framework to support "perTest" coverage analysis. In practice, this was often tightly coupled to the test runner itself. For example, the mocha test runner uses -you guessed it- the mocha test framework. It made configuring Stryker needlessly complicated. That's why we've decided to drop this plugin type and make the Test Runner plugin responsible for hooking into the test framework directly. As a result, the following dependencies are no longer needed: <code>@stryker-mutator/mocha-framework</code> and <code>@stryker-mutator/jasmine-framework</code>.</p>
<p><strong>The <code>OptionsEditor</code> plugins are removed.</strong></p>
<p>Options editors provided a way for plugins to edit the Stryker options directly. In practice, this was used to load plugin-specific options and attach them to the StrykerOptions object for later use. Plugins should now load their needed options in their life cycle, for example, in the <code>init</code> method of the plugin.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-breaking-changes">💥 Breaking changes<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-breaking-changes" class="hash-link" aria-label="Direct link to 💥 Breaking changes" title="Direct link to 💥 Breaking changes" translate="no">​</a></h2>
<p>Here is a list of the most important breaking changes. For a full list, please see our <a href="https://github.com/stryker-mutator/stryker-js/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer" class="">changelog</a>.</p>
<ul>
<li class="">Configuring "transpilers" is no longer supported; please use <code>--buildCommand</code> instead.</li>
<li class="">Configuring <code>mutator</code> as a string, or configuring <code>mutator.name</code> is no longer supported, Stryker will always use its code instrumenter.</li>
<li class="">TypeScript 3.7 or higher is required if you're using TypeScript to transpile your code, either via a <code>--buildCommand</code> or via a test runner plugin, like <a href="https://www.npmjs.com/package/ts-jest" target="_blank" rel="noopener noreferrer" class="">ts-jest</a>, <a href="https://www.npmjs.com/package/karma-webpack" target="_blank" rel="noopener noreferrer" class="">karma-webpack</a> or using the <a href="https://www.npmjs.com/package/@angular/cli" target="_blank" rel="noopener noreferrer" class="">angular-cli</a>. If you're dependent on TS &lt;3.7, please consider upgrading, or keep using Stryker V3. This is because the mutation instrumenter heavily leans on the support of <code>// @ts-nocheck</code> feature, added in TS3.7. If you're using another transpiler, like <a href="https://babeljs.io/" target="_blank" rel="noopener noreferrer" class="">babel</a> or <a href="https://github.com/TypeStrong/ts-node" target="_blank" rel="noopener noreferrer" class="">ts-node with <code>transpileOnly</code></a>, then Stryker will work fine.</li>
<li class="">Because of the requirement for TS 3.7, Angular &gt;=9.0 is required for Angular projects.</li>
<li class="">The <code>"command"</code> test runner is now "best-effort". Stryker will use an environment variable to communicate which mutant should be active. Your test command should pass the environment variables to the test environment. We expect this to work for most test runners and test commands out there. One exception is Karma, but since we have the <code>@stryker-mutator/karma-runner</code> for this use case, it shouldn't be a problem.</li>
<li class="">Support for the Web Component Tester is dropped. Please see <a href="https://github.com/stryker-mutator/stryker-js/issues/2386" target="_blank" rel="noopener noreferrer" class="">#2386</a> for reasoning.</li>
<li class="">Exporting a <code>function</code> from your "stryker.conf.js" file is deprecated. Please export your config as an object instead, or use a stryker.conf.json file. Please see <a href="https://github.com/stryker-mutator/stryker-js/issues/2429" target="_blank" rel="noopener noreferrer" class="">#2429</a> for more details.</li>
<li class="">The <code>--maxConcurrentTestRunner</code> option is now deprecated, please use <code>--concurrency</code> instead. Stryker will use this setting to determine how to scale checkers or test runner processes. Note that Stryker will no longer prevent you from configuring more than the number of logical cores in your machine, i.e., <code>--concurrency 9999</code> might be a bad idea.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's next?<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's next?" title="Direct link to 🔮 What's next?" translate="no">​</a></h2>
<p>Mutation switching was a considerable undertaking, but we had to do it since it allows for further performance and usability improvements. Let's discuss some here.</p>
<p>All these issues align with our project goals, which we've published in <a href="https://github.com/stryker-mutator/stryker-js/wiki/Roadmap" target="_blank" rel="noopener noreferrer" class="">our roadmap</a>.</p>
<p><strong>Better Jest support</strong></p>
<p>With mutation switching in our backpack, implementing "perTest" coverage analysis for Jest is now on the table, allowing Stryker to run fewer tests in total. See <a href="https://github.com/stryker-mutator/stryker-js/issues/2316" target="_blank" rel="noopener noreferrer" class="">#2316</a> for more info.</p>
<p><strong>Hot reload</strong></p>
<p>Currently, Stryker will reload all code files between test runs (clearing them from the <a href="https://nodejs.org/api/modules.html#modules_require_cache" target="_blank" rel="noopener noreferrer" class="">require.cache</a> or doing a full page reload with Karma). However, thanks to mutation switching, the mutated code does not have to be reloaded. Instead, we can switch the active mutant and do another test run. Mocha will be the first test runner to receive this improvement. See <a href="https://github.com/stryker-mutator/stryker-js/issues/2413" target="_blank" rel="noopener noreferrer" class="">#2413</a> for more info.</p>
<p><strong>In place mutation</strong></p>
<p>Stryker currently never mutates <em>your code</em> directly. Instead, it makes a copy of it in a "sandbox" directory, and it mutates your code there. The reason for this should be apparent; you don't want mutants to make there way into production.</p>
<p>However, in some corner cases, the simple act of copying your code to a sandbox directory makes running the tests impossible. See <a href="https://github.com/stryker-mutator/stryker-js/issues/2163" target="_blank" rel="noopener noreferrer" class="">#2163</a> for some examples. To truly make Stryker work for all JavaScript projects, we will need to allow for "in place" mutation. Don't worry, this will be optional, and we will make sure to let you know what Stryker is doing 🧐.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-thank-you">🎉 Thank you<a href="https://stryker-mutator.io/blog/announcing-stryker-4-mutation-switching/#-thank-you" class="hash-link" aria-label="Direct link to 🎉 Thank you" title="Direct link to 🎉 Thank you" translate="no">​</a></h2>
<p>Back in July, we released the first beta of Stryker 4. Since then, we got loads of responses resulting in the closing of <a href="https://github.com/stryker-mutator/stryker-js/issues?q=is%3Aissue+milestone%3A4.0+is%3Aclosed" target="_blank" rel="noopener noreferrer" class="">more than 40 issues</a>, some of which were pretty major 😅. We want to thank everyone who helped to make this release possible! In particular (in no specific order)</p>
<p>🌹 <a href="https://github.com/gramster" target="_blank" rel="noopener noreferrer" class="">gramster</a><br>
<!-- -->💐<a href="https://github.com/kmdrGroch" target="_blank" rel="noopener noreferrer" class="">kmdrGroch</a><br>
<!-- -->🌼<a href="https://github.com/Lakitna" target="_blank" rel="noopener noreferrer" class="">Lakitna</a><br>
<!-- -->🌻<a href="https://github.com/brodybits" target="_blank" rel="noopener noreferrer" class="">brodybits</a><br>
<!-- -->🌺<a href="https://github.com/Garethp" target="_blank" rel="noopener noreferrer" class="">Garethp</a></p>
<p>You guys are incredible!</p>
<p>If you read through this article: thank you! You're awesome! Now stop reading and give Stryker 4 a try. And let us know what you think 😀.</p>]]></content:encoded>
            <category>stryker-js</category>
        </item>
        <item>
            <title><![CDATA[Announcing Stryker 4.0 Beta]]></title>
            <link>https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/</link>
            <guid>https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/</guid>
            <pubDate>Mon, 13 Jul 2020 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to announce the beta of the next major release of the Stryker mutation testing framework for JavaScript and friends: Stryker 4.0.]]></description>
            <content:encoded><![CDATA[<p>We're excited to announce the beta of the next major release of the Stryker mutation testing framework for JavaScript and friends: Stryker 4.0.</p>
<p>This beta is a huge milestone because it means a fundamental shift in the way Stryker works internally. It now uses "Mutation switching", a technique that can improve performance.</p>
<!-- -->
<p>This, unfortunately, couldn't be done without breaking changes. These changes are mostly limited to the internal plugin API's except for the changes highlighted in this blog article.</p>
<p>To get started using the beta, update your Stryker dependencies using npm or yarn.</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/core@next</span><br></div></code></pre></div></div>
<p>Don't forget to update Stryker plugins. For example, when using mocha:</p>
<div class="language-shell codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-shell codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token plain">npm install --save-dev @stryker-mutator/mocha-runner@next</span><br></div></code></pre></div></div>
<p>This beta is released early, in order to get community feedback. We've not yet updated the docs with the changes specified in this blog article. At this moment, the jest-runner and the command test runner <em>still need to be migrated and will not work as expected</em>.</p>
<p><em>Note: Since beta version <code>4.0.0-beta.2</code>, both the command test runner and the jest test runner are supported. However, the command test runner does have some <a href="https://github.com/stryker-mutator/stryker-js/pull/2345" target="_blank" rel="noopener noreferrer" class="">limitations</a></em></p>
<p>If you're new to mutation testing, it's a way to measure your tests' effectiveness. Please take a look at <a class="" href="https://stryker-mutator.io/docs/General/example/">our RoboCoasters 🤖🎢 example</a> and see how even 100% code coverage doesn't tell the whole story. Mutation testing is the only way to make sure your code is thoroughly tested.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-mutation-switching">👽 Mutation switching<a href="https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/#-mutation-switching" class="hash-link" aria-label="Direct link to 👽 Mutation switching" title="Direct link to 👽 Mutation switching" translate="no">​</a></h2>
<p>Mutation switching is a way to simultaneously put all mutants into your code while making sure only one mutant is active at the same time. Let's take a look at an example.</p>
<p>Let's take this.</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">add</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">a</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>When you feed this code to Stryker, it will generate two mutants:</p>
<p>👽 <code>function add(a, b) { return a - b }</code><br>
<!-- -->👾 <code>function add(a, b) {}</code></p>
<p>Previous versions of Stryker would make two copies of the source code. One for each mutant. This changes with Stryker 4.0. Both mutants will be placed into the code <em>at the same time</em>.</p>
<div class="language-js codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-js codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">add</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">a</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> b</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">activeMutant</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> global</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">activeMutant</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">?</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">-</span><span class="token plain"> b </span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> a </span><span class="token operator" style="color:#393A34">+</span><span class="token plain"> b</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>(simplified example)</p>
<p>Stryker can now run your tests twice while changing which mutant is active in the process. Mutation switching can improve performance dramatically, depending on the type of project. For example, when you bundle your code with webpack before running the tests, then webpack only needs to run once. The same goes for TypeScript projects where you compile your code before testing.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-instrumentation-with-babel">🐠 Instrumentation with Babel<a href="https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/#-instrumentation-with-babel" class="hash-link" aria-label="Direct link to 🐠 Instrumentation with Babel" title="Direct link to 🐠 Instrumentation with Babel" translate="no">​</a></h2>
<p>Mutation Switching is a significant performance improvement, but it means that Stryker is required to perform some complex transformations of the <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree" target="_blank" rel="noopener noreferrer" class="">Abstract Syntax Tree (AST)</a>.</p>
<p>Doing this <em>instrumentation</em> means visiting each node of the AST to collect and place mutants. This instrumentation is implemented with the <a href="https://babeljs.io/" target="_blank" rel="noopener noreferrer" class="">Babel</a> parser and now ships with <code>@stryker-mutator/core</code>. We're taking advantage of Babel 7's support to parse and print any type of JavaScript, including TypeScript code.</p>
<p>This means that it is <em>no longer needed to configure the <code>mutator</code></em> in your Stryker configuration. Stryker will always use the new mutation instrumenter. It supports TypeScript, JavaScript, Flow, and JSX. It even supports mutating script tags in <code>.html</code> or <code>.vue</code> files. It also picks up your babel configuration out-of-the-box, so no custom configuration is needed.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-build-command-support">👷‍‍ Build command support<a href="https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/#-build-command-support" class="hash-link" aria-label="Direct link to 👷‍‍ Build command support" title="Direct link to 👷‍‍ Build command support" translate="no">​</a></h2>
<p>With mutation switching, all mutants are placed in the code at the same time. This also means that it only has to be built (transpiled or bundled) once.</p>
<p><em>Note: not all projects need building. Simple projects might deploy JS code as is, or the test runner might take care of this step for you. For example, running your tests with <code>ts-node</code> or <code>babel/register</code> or running it with <code>Jest</code> or <code>Karma</code> with the <a href="https://github.com/webpack-contrib/karma-webpack" target="_blank" rel="noopener noreferrer" class="">webpack plugin</a>.</em></p>
<p>Before mutation switching, this would be the job of the <code>transpiler</code> plugin type. For example, <code>transpiler: ['babel']</code> would mean that all files would be transpiled with the <code>@stryker-mutator/babel-transpiler</code> plugin. It was a bit complex to create a transpiler plugin, and since every mutant needed to transpiled, it was slow. Every transpiler/bundler needed its a transpiler plugin.</p>
<p>Stryker 4.0 will no longer support the <code>transpiler</code> plugins. Instead, it allows you to configure a <code>buildCommand</code> yourself. A build command can be any command. Some examples include <code>npm run build</code>, <code>tsc -b</code> or <code>webpack --config webpack.config</code>. This means that the available plugins do not limit you.</p>
<p>The following dependencies are therefore no longer needed, and you can simply remove them:</p>
<ul>
<li class=""><code>@stryker-mutator/babel-transpiler</code></li>
<li class=""><code>@stryker-mutator/webpack-transpiler</code></li>
<li class=""><code>@stryker-mutator/typescript</code></li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-checker-plugin">✅ Checker plugin<a href="https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/#-checker-plugin" class="hash-link" aria-label="Direct link to ✅ Checker plugin" title="Direct link to ✅ Checker plugin" translate="no">​</a></h2>
<p>You might know that the old <code>@stryker-mutator/typescript</code> transpiler not only transpiled your code but also filtered out mutants that resulted in type errors, marking them with <code>compile error</code> (or <code>transpile error</code>) in your report. Mutants with this status are marked as "invalid" and do not influence your mutation score.</p>
<p>Since Stryker 4.0 <a href="https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/#-build-command-support" class="">removes the transpiler plugin type</a> we needed a new plugin that can perform this type checking. Introducing the <code>Checker</code> plugin type. In the Stryker 4 release, we will include one such checkers, the <code>@stryker-mutator/typescript-checker</code>.</p>
<p>Install it with <code>npm install @stryker-mutator/typescript-checker@next</code></p>
<p>Configure it with:</p>
<div class="language-ts codeBlockContainer_ecZj theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_vYJ5"><pre tabindex="0" class="prism-code language-ts codeBlock_Gi4l thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_RuQK"><div class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token string-property property" style="color:#36acaa">"checkers"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"typescript"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token string-property property" style="color:#36acaa">"tsconfigFile"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"tsconfig.json"</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>(tsconfig.json is the default setting for "tsconfigFile").</p>
<p>Please see <a href="https://github.com/stryker-mutator/stryker-js/tree/epic/mutation-switching/packages/typescript-checker#readme" target="_blank" rel="noopener noreferrer" class="">the TypeScript checker's readme for more details</a></p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-more-coverage-analysis">☔ More coverage analysis<a href="https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/#-more-coverage-analysis" class="hash-link" aria-label="Direct link to ☔ More coverage analysis" title="Direct link to ☔ More coverage analysis" translate="no">​</a></h2>
<p>Coverage analysis is a way to speed up mutation testing. Stryker always came with three flavors:</p>
<ul>
<li class="">"off": No coverage analysis</li>
<li class="">"all": Coverage is measured for the entire test suite. Mutants that are not covered by even one test are marked with "NoCoverage"</li>
<li class="">"perTest": Coverage is measured per test. Only tests that cover a specific mutant are run for that mutant.</li>
</ul>
<p>Running with "perTest" coverage yields a significant performance improvement (usually between 40% and 60%). However, most projects were unable to take advantage of it because Stryker relied on a complex mechanism of <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer" class="">istanbul</a> code coverage combined with hooks in the test runner. It only worked in scenarios without complicated transpiling or bundling.</p>
<p>With the introduction of mutation switching, the instrumenter is responsible for inserting coverage instrumentation into the code. This means that Stryker can measure mutant coverage, <em>regardless of which bundler/transpiler you are using</em>. The only requirement is that Stryker needs to be able to hook into the test runner. This is currently supported for <code>@stryker-mutator/mocha-runner</code>, <code>@stryker-mutator/karma-runner</code> and <code>@stryker-mutator/jasmine-runner</code>. Support for <a href="https://github.com/stryker-mutator/stryker-js/issues/2316" target="_blank" rel="noopener noreferrer" class=""><code>@stryker-mutator/jest-runner</code> is planned</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-other-changes">🧹 Other changes<a href="https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/#-other-changes" class="hash-link" aria-label="Direct link to 🧹 Other changes" title="Direct link to 🧹 Other changes" translate="no">​</a></h2>
<p>We also decided to take this opportunity to improve the maintainability of the Stryker code further. That's why we've decided to drop support for two more plugin types.</p>
<ul>
<li class="">The <code>TestFramework</code> plugin type is removed<br>
<!-- -->A test framework plugin used to be responsible for allowing Stryker to hook into the test framework to implement test filtering and perTest coverage analysis. In practice, this was often tightly coupled to the test runner itself. That's why we've decided to drop this plugin type and make the Test Runner plugin responsible for hooking into the test framework directly. Therefore the following dependencies can simply be removed: <code>@stryker-mutator/mocha-framework</code> and <code>@stryker-mutator/jasmine-framework</code>.</li>
<li class="">The <code>OptionsEditor</code> plugin type is removed<br>
<!-- -->Options editors provided a way for plugins to edit the Stryker options directly. In practice, this was used to load plugin-specific options and attach them to the StrykerOptions object for later use. Plugins are now expected to load their options in their life cycle.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_NcIB" id="-whats-next">🔮 What's next<a href="https://stryker-mutator.io/blog/announcing-stryker-4-beta-mutation-switching/#-whats-next" class="hash-link" aria-label="Direct link to 🔮 What's next" title="Direct link to 🔮 What's next" translate="no">​</a></h2>
<p>We'll be focussing on getting Stryker 4.0 released. For that to happen, we would appreciate your feedback. Feel free to report any <a href="https://github.com/stryker-mutator/stryker-js/issues/new" target="_blank" rel="noopener noreferrer" class="">issues</a> you have with this beta release.</p>]]></content:encoded>
            <category>stryker-js</category>
        </item>
    </channel>
</rss>