<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Özgür Deniz Türker on Medium]]></title>
        <description><![CDATA[Stories by Özgür Deniz Türker on Medium]]></description>
        <link>https://medium.com/@odenizturker?source=rss-a177528b5e7d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zB1fVwl8Z9ReetjHe7UUSw.jpeg</url>
            <title>Stories by Özgür Deniz Türker on Medium</title>
            <link>https://medium.com/@odenizturker?source=rss-a177528b5e7d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 05:42:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@odenizturker/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Cutting Jest Integration Test Times in Half]]></title>
            <link>https://medium.com/@odenizturker/cutting-jest-integration-test-times-in-half-da918990a762?source=rss-a177528b5e7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/da918990a762</guid>
            <category><![CDATA[integration-testing]]></category>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[sharding]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Özgür Deniz Türker]]></dc:creator>
            <pubDate>Tue, 01 Sep 2026 19:08:29 GMT</pubDate>
            <atom:updated>2026-09-01T19:08:29.019Z</atom:updated>
            <content:encoded><![CDATA[<p>Why adding Jest workers failed on GitHub Actions, and how <strong>test sharding </strong>solved the problem.</p><p>As a codebase grows, so does its test suite. We maintain a <strong>NestJS</strong> application that relies heavily on integration tests. These tests are necessary to verify that our database queries and API endpoints work as expected.</p><p>Over the past few months, our application expanded. We wrote more features and, naturally, more integration tests. Eventually, we noticed a problem: our <strong>Continuous Integration (CI)</strong> pipeline was slowing down.</p><h3>The Bottleneck in the Pipeline</h3><p>Waiting for tests to finish slows down the entire engineering team. A developer opens a pull request, <strong>waits 15 or 20 minutes</strong> for the CI checks to pass, and often loses focus. If a test fails, they have to fix it and wait all over again.</p><p>Our GitHub Actions workflow was taking far too long. We needed to reduce the test execution time so developers could get faster feedback and merge their code sooner.</p><h3>The First Attempt: Increasing Jest Workers</h3><p>When tests are slow, the most common response is to run them in <strong>parallel</strong>. Jest has built-in support for this through the --maxWorkers flag. Our first step was simply to <strong>increase the number of workers</strong>, expecting the tests to finish faster.</p><p>This approach failed entirely.</p><p>The standard GitHub runners simply did not have <strong>enough CPU</strong> and <strong>memory</strong> to handle the extra load. When we increased the worker count, multiple test suites tried to run at the same time on limited hardware. The runner ran out of memory, and the CPU spent more time switching between tasks than actually executing the code. Our tests became unstable, and the execution time did not improve. <strong>We realized that a single GitHub runner was not powerful enough to run our integration tests in parallel.</strong></p><h3>The Working Solution: Test Sharding</h3><p>Since we could not scale up a single runner, we had to scale out. We decided to distribute the test load across multiple runners instead of relying on just one. This technique is called test sharding.</p><p>Instead of running all the tests on one machine, sharding splits the tests into equal parts. For example, Machine A runs the first half of the tests, and Machine B runs the second half.</p><p>Jest supports this natively using the --shard flag. You can tell Jest to run a specific fraction of the tests, such as --shard=1/2for the first half and --shard=2/2 for the second half.</p><p>We updated our <strong>GitHub Actions workflow</strong> to use a matrix strategy. This allowed us to automatically start multiple runner jobs at the same time. We configured the matrix to spawn two parallel jobs, passing the corresponding shard number to each job.</p><p>Here is what the change looked like conceptually:</p><p>Instead of running jest --runInBand on one machine, we now run jest --shard=1/2 on Runner A and jest --shard=2/2 on Runner B at the exact same time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0KIer5Z8scDPRIG6oWY_OA.png" /></figure><h3>The Outcome</h3><p>The impact of this change was immediate and measurable. By splitting the work across separate runners, we stopped overloading single machines. Each runner had plenty of CPU and memory to execute its share of the tests.</p><p>Our integration test execution time <strong>dropped by exactly 50%.</strong></p><p>The CI feedback loop is now much shorter. Developers spend less time waiting for green checkmarks on their pull requests, and the engineering team can ship code faster. By shifting our approach from trying to maximize a single weak machine to coordinating multiple machines, we solved the bottleneck cleanly and permanently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da918990a762" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>