<?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>Jest Blog</title>
        <link>https://jestjs.io/uk/blog</link>
        <description>Jest Blog</description>
        <lastBuildDate>Wed, 04 Jun 2025 00:00:00 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>uk</language>
        <item>
            <title><![CDATA[Jest 30: Faster, Leaner, Better]]></title>
            <link>https://jestjs.io/uk/blog/2025/06/04/jest-30</link>
            <guid>https://jestjs.io/uk/blog/2025/06/04/jest-30</guid>
            <pubDate>Wed, 04 Jun 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Today we are happy to announce the release of Jest 30. This release features a substantial number of changes, fixes, and improvements. While it is one of the largest major releases of Jest ever, we admit that three years for a major release is too long. In the future, we are aiming to make more frequent major releases to keep Jest great for the next decade.]]></description>
            <content:encoded><![CDATA[<p>Today we are happy to announce the release of Jest 30. This release features a substantial number of changes, fixes, and improvements. While it is one of the largest major releases of Jest ever, we admit that three years for a major release is too long. In the future, we are aiming to make more frequent major releases to keep Jest great for the next decade.</p>
<p>If you want to skip all the news and just get going, run <code>npm install jest@^30.0.0</code> and follow the migration guide: <a href="https://jestjs.io/docs/upgrading-to-jest30" target="_blank" rel="noopener noreferrer">Upgrading from Jest 29 to 30</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="whats-new">What’s New?<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#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>Jest 30 is noticeably faster, uses less memory, and comes with tons of new features. First, let’s take a look at the breaking changes:</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="важливі-зміни">Важливі Зміни<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#%D0%B2%D0%B0%D0%B6%D0%BB%D0%B8%D0%B2%D1%96-%D0%B7%D0%BC%D1%96%D0%BD%D0%B8" class="hash-link" aria-label="Direct link to Важливі Зміни" title="Direct link to Важливі Зміни" translate="no">​</a></h2>
<ul>
<li>Jest 30 drops support for Node 14, 16, 19, and 21.</li>
<li><code>jest-environment-jsdom</code> was upgraded from jsdom 21 to 26.</li>
<li>The minimum compatible TypeScript version is now 5.4.</li>
<li>Various <code>expect</code> aliases were removed. <a href="https://github.com/jest-community/eslint-plugin-jest/blob/HEAD/docs/rules/no-alias-methods.md" target="_blank" rel="noopener noreferrer"><code>eslint-plugin-jest</code> has an autofixer</a> which you can run to automatically upgrade your codebase.</li>
<li>Non-enumerable object properties are now excluded from object matchers such as <code>toEqual</code> by default.</li>
<li>Jest now supports <code>.mts</code> and <code>.cts</code> files by default.</li>
<li><code>--testPathPattern</code> was renamed to <code>--testPathPatterns</code>.</li>
<li>Jest now properly handles promises that are first rejected and then later caught to avoid false positive test failures.</li>
<li>We made various improvements to Jest’s printing of snapshots which might require you to update snapshots. Google deprecated <code>goo.gl</code> links which we were using in snapshots. We don’t like it either, but you’ll have to update all your snapshots.</li>
<li>Jest itself is now bundled into a single file per package. This improves performance, but might break if you built tools that reach into Jest's internals.</li>
</ul>
<p>These are just some of the highlights. The full list of breaking changes can be found in the <a href="https://github.com/jestjs/jest/blame/main/CHANGELOG.md" target="_blank" rel="noopener noreferrer">CHANGELOG</a> and the <a href="https://jestjs.io/docs/upgrading-to-jest30" target="_blank" rel="noopener noreferrer">Jest 30 migration guide</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="performance--memory-improvements">Performance &amp; Memory Improvements<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#performance--memory-improvements" class="hash-link" aria-label="Direct link to Performance &amp; Memory Improvements" title="Direct link to Performance &amp; Memory Improvements" translate="no">​</a></h2>
<p>Jest 30 delivers real-world performance gains thanks to many optimizations, especially related to module resolution, memory usage, and test isolation. By relying on the new <a href="https://github.com/unrs/unrs-resolver" target="_blank" rel="noopener noreferrer">unrs-resolver</a>, module resolution in Jest became more feature-rich, standards-compliant, and faster. Thanks to <a href="https://github.com/JounQin" target="_blank" rel="noopener noreferrer">@JounQin</a> for the migration. Depending on your project, you may see significantly faster test runs and reduced memory consumption. For example, one large TypeScript app with a client and server observed 37% faster test runs and 77% lower memory usage in one part of their codebase:</p>
<table><thead><tr><th></th><th>Jest 29</th><th>Jest 30</th></tr></thead><tbody><tr><td><strong>Server tests</strong></td><td>~1350s / 7.8 GB max</td><td><strong>~850s / 1.8 GB max</strong></td></tr><tr><td><strong>Client tests</strong></td><td>~49s / 1.0 GB max</td><td><strong>~44s / 0.8 GB max</strong></td></tr></tbody></table>
<p>Jest is fast, but due to Jest's test isolation, slow user code often exacerbates performance issues and leads to slow test runs. When tests leave behind open handles like unclosed timers or connections to other services, it can cause Jest to hang or slow down. Jest 30 has gotten better at detecting and reporting these issues, which helps you identify and fix slow or problematic tests more easily. For example, tests at <a href="https://happo.io/" target="_blank" rel="noopener noreferrer">Happo</a> were sped up by 50% from 14 minutes down to 9 minutes by cleaning up open handles and upgrading to Jest 30.</p>
<p>If you are using files that consolidate the exports of multiple modules into a single file (i.e. "barrel files"), we recommend using tools such as <a href="https://github.com/gtsop/babel-jest-boost" target="_blank" rel="noopener noreferrer"><code>babel-jest-boost</code></a>, <a href="https://github.com/FogelAI/babel-plugin-transform-barrels" target="_blank" rel="noopener noreferrer"><code>babel-plugin-transform-barrels</code></a> or <a href="https://github.com/Nergie/no-barrel-file" target="_blank" rel="noopener noreferrer"><code>no-barrel-file</code></a> to avoid loading large swaths of application code for each test file. This can lead to performance improvements of up to 100x.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="globals-cleanup-between-test-files">Globals cleanup between test files<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#globals-cleanup-between-test-files" class="hash-link" aria-label="Direct link to Globals cleanup between test files" title="Direct link to Globals cleanup between test files" translate="no">​</a></h3>
<p>Jest achieves test isolation between files by running each test in a separate <a href="https://nodejs.org/api/vm.html#vm-executing-javascript" target="_blank" rel="noopener noreferrer">VM context</a>, giving each file a fresh global environment. However, if your code does not clean up globals after each test file, it can lead to memory leaks across Jest and slow down your test runs. Jest 30 introduces a new feature that notifies you about globals that are not correctly cleaned up after a test run.</p>
<p>In the future, Jest will automatically clean up globals after each test run. If you don't get any warnings about uncleaned globals with Jest 30, you can already set the globals cleanup mode to "on" now to enable this feature fully, and benefit from major memory savings and performance improvements:</p>
<div class="language-javascript codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-javascript codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#297a29">export</span><span class="token plain"> </span><span class="token keyword module" style="color:#297a29">default</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token literal-property property" style="color:#82772c">testEnvironmentOptions</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token literal-property property" style="color:#82772c">globalsCleanup</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token string" style="color:#c21325">'on'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span 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></span><span 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></span></code></pre></div></div>
<p>The default in Jest is <code>globalsCleanup: 'soft'</code>. To disable this feature you can set it to <code>off</code>. If you need to protect specific global objects from being cleaned up -- for example, shared utilities or caches -- you can mark them as protected using <code>jest-util</code>:</p>
<div class="language-ts codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-ts codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#297a29">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">protectProperties</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#297a29">from</span><span class="token plain"> </span><span class="token string" style="color:#c21325">'jest-util'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#6b2e85">protectProperties</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">globalThis</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#c21325">'my-property'</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></span></code></pre></div></div>
<p>Thanks to <a href="https://github.com/eyalroth" target="_blank" rel="noopener noreferrer">@eyalroth</a> for implementing this feature!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="new-features">New Features<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#new-features" class="hash-link" aria-label="Direct link to New Features" title="Direct link to New Features" translate="no">​</a></h2>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="improved-ecmascript-module--typescript-support">Improved ECMAScript Module &amp; TypeScript Support<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#improved-ecmascript-module--typescript-support" class="hash-link" aria-label="Direct link to Improved ECMAScript Module &amp; TypeScript Support" title="Direct link to Improved ECMAScript Module &amp; TypeScript Support" translate="no">​</a></h3>
<p>Support for <code>import.meta.*</code> and <code>file://</code> was added <a href="https://jestjs.io/docs/ecmascript-modules" target="_blank" rel="noopener noreferrer">when using native ESM with Jest</a>. In addition, you can now write your Jest config files in TypeScript, and <code>.mts</code> and <code>.cts</code> files are natively supported without requiring extra configuration. If you are using Node’s native TypeScript type stripping feature, we no longer load the TypeScript transformer to strip types, leading to faster test runs.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="spies-and-the-using-keyword">Spies and the <code>using</code> keyword<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#spies-and-the-using-keyword" class="hash-link" aria-label="Direct link to spies-and-the-using-keyword" title="Direct link to spies-and-the-using-keyword" translate="no">​</a></h3>
<p>You can now use <a href="https://v8.dev/features/explicit-resource-management" target="_blank" rel="noopener noreferrer">JavaScript’s new explicit resource management syntax (<code>using</code>)</a> with Jest spies. If your environment supports it, writing <code>using jest.spyOn(obj, 'method')</code> will automatically restore the spy when the block ends, so you don’t have to manually clean up.</p>
<div class="language-typescript codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-typescript codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#6b2e85">test</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'logs a warning'</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 operator" style="color:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  using spy </span><span class="token operator" style="color:#888">=</span><span class="token plain"> jest</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#6b2e85">spyOn</span><span class="token punctuation" style="color:#393A34">(</span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#c21325">'warn'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#6b2e85">doSomeThingWarnWorthy</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></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#6b2e85">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">spy</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#6b2e85">toHaveBeenCalled</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></span><span 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></span></code></pre></div></div>
<p><a href="https://jestjs.io/uk/docs/jest-object#spied-methods-and-the-using-keyword">Documentation</a></p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="expectarrayof"><code>expect.arrayOf</code><a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#expectarrayof" class="hash-link" aria-label="Direct link to expectarrayof" title="Direct link to expectarrayof" translate="no">​</a></h3>
<p>Jest 30 introduces a new <a href="https://jestjs.io/docs/expect#asymmetric-matchers" target="_blank" rel="noopener noreferrer">asymmetric matcher</a>, <code>expect.arrayOf</code>, which lets you validate every element of an array against a condition or type. For instance, you can expect an array of numbers ensuring all items are numbers:</p>
<div class="language-javascript codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-javascript codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#6b2e85">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">someArray</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:#6b2e85">toEqual</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">expect</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">arrayOf</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">expect</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">any</span><span class="token punctuation" style="color:#393A34">(</span><span class="token known-class-name class-name">Number</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 punctuation" style="color:#393A34">;</span><br></span></code></pre></div></div>
<p><a href="https://jestjs.io/uk/docs/expect#expectarrayofvalue">Documentation</a></p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="new-testeach-placeholder-">New <code>test.each</code> placeholder: <code>%$</code><a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#new-testeach-placeholder-" class="hash-link" aria-label="Direct link to new-testeach-placeholder-" title="Direct link to new-testeach-placeholder-" translate="no">​</a></h3>
<p>If you use data-driven tests with <code>test.each</code>, you can now include a special placeholder <code>%$</code> in your test titles to inject the <strong>number of the test case</strong>. Наприклад:</p>
<div class="language-javascript codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-javascript codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token plain">test</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">cases</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'Case %$ works as expected'</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:#888">=&gt;</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 punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre></div></div>
<p>will replace <code>%$</code> with the test’s sequence number.</p>
<p><a href="https://jestjs.io/uk/docs/api#testeachtablename-fn-timeout">Documentation</a></p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="jestadvancetimerstonextframe"><code>jest.advanceTimersToNextFrame()</code><a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#jestadvancetimerstonextframe" class="hash-link" aria-label="Direct link to jestadvancetimerstonextframe" title="Direct link to jestadvancetimerstonextframe" translate="no">​</a></h3>
<p><a href="https://github.com/sinonjs/fake-timers" target="_blank" rel="noopener noreferrer"><code>@sinonjs/fake-timers</code></a> was upgraded to v13, adding <code>jest.advanceTimersToNextFrame()</code>. This new function allows you to advance all pending <code>requestAnimationFrame</code> callbacks to the next frame boundary, making it easier to test animations or code that relies on <code>requestAnimationFrame</code> without having to guess millisecond durations.</p>
<p><a href="https://jestjs.io/uk/docs/jest-object#jestadvancetimerstonextframe">Documentation</a></p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="configurable-test-retries">Configurable test retries<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#configurable-test-retries" class="hash-link" aria-label="Direct link to Configurable test retries" title="Direct link to Configurable test retries" translate="no">​</a></h3>
<p>Jest 30 enhances <code>jest.retryTimes()</code> with new options that give you control over how retries are handled. You can specify a delay or immediately retry a failed test instead of waiting until the entire test suite finishes:</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Retry failed tests up to 3 times, waiting 1 second between attempts:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">jest</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">retryTimes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#1373c2">3</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 literal-property property" style="color:#82772c">waitBeforeRetry</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token number" style="color:#1373c2">1000</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></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Immediately retry without waiting for other tests to finish:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">jest</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">retryTimes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#1373c2">3</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 literal-property property" style="color:#82772c">retryImmediately</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</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></span></code></pre></div></div>
<p><a href="https://jestjs.io/uk/docs/jest-object#jestretrytimesnumretries-options">Documentation</a></p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="jestunstable_unmockmodule"><code>jest.unstable_unmockModule()</code><a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#jestunstable_unmockmodule" class="hash-link" aria-label="Direct link to jestunstable_unmockmodule" title="Direct link to jestunstable_unmockmodule" translate="no">​</a></h3>
<p>Jest 30 adds new experimental <code>jest.unstable_unmockModule()</code> API for finer control when unmocking modules (especially when using native ESM).</p>
<p><a href="https://jestjs.io/uk/docs/ecmascript-modules#module-unmocking-in-esm">Documentation</a></p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="jestongeneratemockcallback"><code>jest.onGenerateMock(callback)</code><a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#jestongeneratemockcallback" class="hash-link" aria-label="Direct link to jestongeneratemockcallback" title="Direct link to jestongeneratemockcallback" translate="no">​</a></h3>
<p>A new <code>onGenerateMock</code> method was added. It registers a callback function that is invoked whenever Jest generates a mock for a module. This callback allows you to modify a mock before it is returned to your test environment:</p>
<div class="language-javascript codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-javascript codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token plain">jest</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">onGenerateMock</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">modulePath</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> moduleMock</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#297a29">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">modulePath</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">includes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'Database'</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></span><span class="token-line" style="color:#393A34"><span class="token plain">    moduleMock</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">connect</span><span class="token plain"> </span><span class="token operator" style="color:#888">=</span><span class="token plain"> jest</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">fn</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:#6b2e85">mockImplementation</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><span class="token arrow operator" style="color:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'Connected to mock DB'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span 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></span><span 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></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#297a29">return</span><span class="token plain"> moduleMock</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span 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></span></code></pre></div></div>
<p><a href="https://jestjs.io/uk/docs/jest-object#jestongeneratemockcb">Documentation</a></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="інші-покращення">Інші покращення<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#%D1%96%D0%BD%D1%88%D1%96-%D0%BF%D0%BE%D0%BA%D1%80%D0%B0%D1%89%D0%B5%D0%BD%D0%BD%D1%8F" class="hash-link" aria-label="Direct link to Інші покращення" title="Direct link to Інші покращення" translate="no">​</a></h2>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="custom-object-serialization">Custom object serialization<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#custom-object-serialization" class="hash-link" aria-label="Direct link to Custom object serialization" title="Direct link to Custom object serialization" translate="no">​</a></h3>
<p>Jest’s matcher utilities now support defining a static <code>SERIALIZABLE_PROPERTIES</code> on custom objects. This allows you to control which properties of a custom object are included in snapshots and error messages, making the output more focused and relevant.</p>
<p><a href="https://jestjs.io/docs/next/expect#serializable_properties" target="_blank" rel="noopener noreferrer">Documentation</a></p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="asynchronous-setup-support">Asynchronous setup support<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#asynchronous-setup-support" class="hash-link" aria-label="Direct link to Asynchronous setup support" title="Direct link to Asynchronous setup support" translate="no">​</a></h3>
<p>Test files listed in <code>setupFilesAfterEnv</code> can now export an async function or use top-level <code>await</code> similar to <code>setupFiles</code>.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="and-so-much-more">And so much more…<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#and-so-much-more" class="hash-link" aria-label="Direct link to And so much more…" title="Direct link to And so much more…" translate="no">​</a></h3>
<p>Check out the full <a href="https://github.com/jestjs/jest/blame/main/CHANGELOG.md" target="_blank" rel="noopener noreferrer">CHANGELOG</a> for all changes, improvements and new features.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="known-issues">Known Issues<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#known-issues" class="hash-link" aria-label="Direct link to Known Issues" title="Direct link to Known Issues" translate="no">​</a></h3>
<p><a href="https://github.com/jsdom/jsdom/issues/3492" target="_blank" rel="noopener noreferrer">jsdom has made changes to become more spec compliant</a>. This might break some use cases, most notably mocking <code>window.location</code> in tests. Jest now ships with <code>@jest/environment-jsdom-abstract</code> to make it easier for you to compose your own custom test environment based on jsdom. If you are just looking to patch <code>jsdom</code>, you can apply <a href="https://gist.github.com/cpojer/e66f9a082021a82230f2595a6027f161" target="_blank" rel="noopener noreferrer">this <code>jsdom</code> patch to your project</a>. In the future, we may look into providing an alternative to <code>jsdom</code> that is better suited for testing.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="whats-next">What's Next<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#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>Jest has been the most popular JavaScript testing framework for a decade. It is used by millions of developers, supporting a wide range of projects from small libraries to the largest codebases in the world. Jest has constantly been improved over time, and as with all long-lasting software projects used in the real world, we accumulated technical debt. We support some features that only few people or companies use, and we have kept breaking changes to a minimum to avoid disrupting users. Some features should be made possible by Jest, but not as part of the core framework. Other features promote testing the wrong things, and should maybe not be part of Jest at all. In terms of Jest's team, a few of us moved on over time which led to slower progress and fewer releases. Here is how we are going to address these issues going forward:</p>
<ul>
<li><strong>Performance / Technical Debt:</strong> Slim Jest down into a leaner, more performant core. Remove features that are not used by the majority of users, and focus on what makes Jest great.</li>
<li><strong>Consistent Release Cycles:</strong> We will aim to be more consistent with our release cycles and deprecation policies.</li>
<li><strong>Be Open:</strong> Build everything in the open, and be transparent about our plans. Provide more opportunities to get involved and increase the number of contributors.</li>
<li><strong>Be Bold:</strong> As the Jest team, we should be more bold. There are a bunch of things that holds Jest back from what it could be. It's time to make moves.</li>
</ul>
<p>The great news is that Jest has always been well set up to deliver on these principles, ever since we built the framework as a modular system with clear separation of concerns. Now it's time to execute. <em>More on all that soon!</em></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="подяка">Подяка<a href="https://jestjs.io/uk/blog/2025/06/04/jest-30#%D0%BF%D0%BE%D0%B4%D1%8F%D0%BA%D0%B0" class="hash-link" aria-label="Direct link to Подяка" title="Direct link to Подяка" translate="no">​</a></h2>
<p>This release wouldn’t have been possible without the hard work of our community. Дякуємо.</p>
<p><a href="https://github.com/SimenB" target="_blank" rel="noopener noreferrer">@SimenB</a>, <a href="https://github.com/mrazauskas" target="_blank" rel="noopener noreferrer">@mrazauskas</a>, <a href="https://github.com/Connormiha" target="_blank" rel="noopener noreferrer">@Connormiha</a>, <a href="https://github.com/liuxingbaoyu" target="_blank" rel="noopener noreferrer">@liuxingbaoyu</a>, <a href="https://github.com/k-rajat19" target="_blank" rel="noopener noreferrer">@k-rajat19</a>, <a href="https://github.com/G-Rath" target="_blank" rel="noopener noreferrer">@G-Rath</a>, <a href="https://github.com/charpeni" target="_blank" rel="noopener noreferrer">@charpeni</a>, <a href="https://github.com/dubzzz" target="_blank" rel="noopener noreferrer">@dubzzz</a>, <a href="https://github.com/stekycz" target="_blank" rel="noopener noreferrer">@stekycz</a>, <a href="https://github.com/yinm" target="_blank" rel="noopener noreferrer">@yinm</a>, <a href="https://github.com/lencioni" target="_blank" rel="noopener noreferrer">@lencioni</a>, <a href="https://github.com/phawxby" target="_blank" rel="noopener noreferrer">@phawxby</a>, <a href="https://github.com/lukeapage" target="_blank" rel="noopener noreferrer">@lukeapage</a>, <a href="https://github.com/robhogan" target="_blank" rel="noopener noreferrer">@robhogan</a>, <a href="https://github.com/fisker" target="_blank" rel="noopener noreferrer">@fisker</a>, <a href="https://github.com/k-rajat19" target="_blank" rel="noopener noreferrer">@k-rajat19</a>, <a href="https://github.com/connectdotz" target="_blank" rel="noopener noreferrer">@connectdotz</a>, <a href="https://github.com/alesmenzel" target="_blank" rel="noopener noreferrer">@alesmenzel</a>, <a href="https://github.com/rickhanlonii" target="_blank" rel="noopener noreferrer">@rickhanlonii</a>, <a href="https://github.com/mbelsky" target="_blank" rel="noopener noreferrer">@mbelsky</a>, <a href="https://github.com/brunocabral88" target="_blank" rel="noopener noreferrer">@brunocabral88</a>, <a href="https://github.com/brandon-leapyear" target="_blank" rel="noopener noreferrer">@brandon-leapyear</a>, <a href="https://github.com/nicolo-ribaudo" target="_blank" rel="noopener noreferrer">@nicolo-ribaudo</a>, <a href="https://github.com/dj-stormtrooper" target="_blank" rel="noopener noreferrer">@dj-stormtrooper</a>, <a href="https://github.com/eryue0220" target="_blank" rel="noopener noreferrer">@eryue0220</a></p>
<p>A special thanks to everyone who made their first contribution to Jest in this release. Thank you for making Jest better for everyone!</p>
<p><a href="https://github.com/eyalroth" target="_blank" rel="noopener noreferrer">@eyalroth</a>, <a href="https://github.com/KhaledElmorsy" target="_blank" rel="noopener noreferrer">@KhaledElmorsy</a>, <a href="https://github.com/mohammednumaan" target="_blank" rel="noopener noreferrer">@mohammednumaan</a>, <a href="https://github.com/bensternthal" target="_blank" rel="noopener noreferrer">@bensternthal</a>, <a href="https://github.com/BondarenkoAlex" target="_blank" rel="noopener noreferrer">@BondarenkoAlex</a>, <a href="https://github.com/phryneas" target="_blank" rel="noopener noreferrer">@phryneas</a>, <a href="https://github.com/jayvdb" target="_blank" rel="noopener noreferrer">@jayvdb</a>, <a href="https://github.com/brandonchinn178" target="_blank" rel="noopener noreferrer">@brandonchinn178</a>, <a href="https://github.com/latin-1" target="_blank" rel="noopener noreferrer">@latin-1</a>, <a href="https://github.com/rmartine-ias" target="_blank" rel="noopener noreferrer">@rmartine-ias</a>, <a href="https://github.com/fa93hws" target="_blank" rel="noopener noreferrer">@fa93hws</a>, <a href="https://github.com/Dunqing" target="_blank" rel="noopener noreferrer">@Dunqing</a>, <a href="https://github.com/gustav0d" target="_blank" rel="noopener noreferrer">@gustav0d</a>, <a href="https://github.com/noritaka1166" target="_blank" rel="noopener noreferrer">@noritaka1166</a>, <a href="https://github.com/andreibereczki" target="_blank" rel="noopener noreferrer">@andreibereczki</a>, <a href="https://github.com/Dreamsorcerer" target="_blank" rel="noopener noreferrer">@Dreamsorcerer</a>, <a href="https://github.com/satanTime" target="_blank" rel="noopener noreferrer">@satanTime</a>, <a href="https://github.com/icholy" target="_blank" rel="noopener noreferrer">@icholy</a>, <a href="https://github.com/ecraig12345" target="_blank" rel="noopener noreferrer">@ecraig12345</a>, <a href="https://github.com/cgm-16" target="_blank" rel="noopener noreferrer">@cgm-16</a>, <a href="https://github.com/sebastiancarlos" target="_blank" rel="noopener noreferrer">@sebastiancarlos</a>, <a href="https://github.com/dancer1325" target="_blank" rel="noopener noreferrer">@dancer1325</a>, <a href="https://github.com/loganrosen" target="_blank" rel="noopener noreferrer">@loganrosen</a>, <a href="https://github.com/zakingslayerv22" target="_blank" rel="noopener noreferrer">@zakingslayerv22</a>, <a href="https://github.com/dev-intj" target="_blank" rel="noopener noreferrer">@dev-intj</a>, <a href="https://github.com/tez3998" target="_blank" rel="noopener noreferrer">@tez3998</a>, <a href="https://github.com/anbnyc" target="_blank" rel="noopener noreferrer">@anbnyc</a>, <a href="https://github.com/pengqiseven" target="_blank" rel="noopener noreferrer">@pengqiseven</a>, <a href="https://github.com/thypon" target="_blank" rel="noopener noreferrer">@thypon</a>, <a href="https://github.com/co63oc" target="_blank" rel="noopener noreferrer">@co63oc</a>, <a href="https://github.com/danielrentz" target="_blank" rel="noopener noreferrer">@danielrentz</a>, <a href="https://github.com/jonasongg" target="_blank" rel="noopener noreferrer">@jonasongg</a>, <a href="https://github.com/andrew-the-drawer" target="_blank" rel="noopener noreferrer">@andrew-the-drawer</a>, <a href="https://github.com/phryneas" target="_blank" rel="noopener noreferrer">@phryneas</a>, <a href="https://github.com/hyperupcall" target="_blank" rel="noopener noreferrer">@hyperupcall</a>, <a href="https://github.com/tonyd33" target="_blank" rel="noopener noreferrer">@tonyd33</a>, <a href="https://github.com/madcapnmckay" target="_blank" rel="noopener noreferrer">@madcapnmckay</a>, <a href="https://github.com/dongwa" target="_blank" rel="noopener noreferrer">@dongwa</a>, <a href="https://github.com/gagan-bhullar-tech" target="_blank" rel="noopener noreferrer">@gagan-bhullar-tech</a>, <a href="https://github.com/ikonst" target="_blank" rel="noopener noreferrer">@ikonst</a>, <a href="https://github.com/ZuBB" target="_blank" rel="noopener noreferrer">@ZuBB</a>, <a href="https://github.com/jzaefferer" target="_blank" rel="noopener noreferrer">@jzaefferer</a>, <a href="https://github.com/brandonnorsworthy" target="_blank" rel="noopener noreferrer">@brandonnorsworthy</a>, <a href="https://github.com/henny1105" target="_blank" rel="noopener noreferrer">@henny1105</a>, <a href="https://github.com/DmitryMakhnev" target="_blank" rel="noopener noreferrer">@DmitryMakhnev</a>, <a href="https://github.com/askoufis" target="_blank" rel="noopener noreferrer">@askoufis</a>, <a href="https://github.com/RahulARanger" target="_blank" rel="noopener noreferrer">@RahulARanger</a>, <a href="https://github.com/Jon-Biz" target="_blank" rel="noopener noreferrer">@Jon-Biz</a>, <a href="https://github.com/fynsta" target="_blank" rel="noopener noreferrer">@fynsta</a>, <a href="https://github.com/KonnorRogers" target="_blank" rel="noopener noreferrer">@KonnorRogers</a>, <a href="https://github.com/BondarenkoAlex" target="_blank" rel="noopener noreferrer">@BondarenkoAlex</a>, <a href="https://github.com/mouadhbb" target="_blank" rel="noopener noreferrer">@mouadhbb</a>, <a href="https://github.com/kemuridama" target="_blank" rel="noopener noreferrer">@kemuridama</a>, <a href="https://github.com/Avi-E-Koenig" target="_blank" rel="noopener noreferrer">@Avi-E-Koenig</a>, <a href="https://github.com/davidroeca" target="_blank" rel="noopener noreferrer">@davidroeca</a>, <a href="https://github.com/akwodkiewicz" target="_blank" rel="noopener noreferrer">@akwodkiewicz</a>, <a href="https://github.com/mukul-turing" target="_blank" rel="noopener noreferrer">@mukul-turing</a>, <a href="https://github.com/dnicolson" target="_blank" rel="noopener noreferrer">@dnicolson</a>, <a href="https://github.com/colinacassidy" target="_blank" rel="noopener noreferrer">@colinacassidy</a>, <a href="https://github.com/ofekm97" target="_blank" rel="noopener noreferrer">@ofekm97</a>, <a href="https://github.com/haze" target="_blank" rel="noopener noreferrer">@haze</a>, <a href="https://github.com/Vadimchesh" target="_blank" rel="noopener noreferrer">@Vadimchesh</a>, <a href="https://github.com/peterdenham" target="_blank" rel="noopener noreferrer">@peterdenham</a>, <a href="https://github.com/ShuZhong" target="_blank" rel="noopener noreferrer">@ShuZhong</a>, <a href="https://github.com/manoraj" target="_blank" rel="noopener noreferrer">@manoraj</a>, <a href="https://github.com/nicolo-ribaudo" target="_blank" rel="noopener noreferrer">@nicolo-ribaudo</a>, <a href="https://github.com/georgekaran" target="_blank" rel="noopener noreferrer">@georgekaran</a>, <a href="https://github.com/MathieuFedrigo" target="_blank" rel="noopener noreferrer">@MathieuFedrigo</a>, <a href="https://github.com/hkdobrev" target="_blank" rel="noopener noreferrer">@hkdobrev</a>, <a href="https://github.com/Germandrummer92" target="_blank" rel="noopener noreferrer">@Germandrummer92</a>, <a href="https://github.com/CheadleCheadle" target="_blank" rel="noopener noreferrer">@CheadleCheadle</a>, <a href="https://github.com/notaphplover" target="_blank" rel="noopener noreferrer">@notaphplover</a>, <a href="https://github.com/danbeam" target="_blank" rel="noopener noreferrer">@danbeam</a>, <a href="https://github.com/arescrimson" target="_blank" rel="noopener noreferrer">@arescrimson</a>, <a href="https://github.com/yepitschunked" target="_blank" rel="noopener noreferrer">@yepitschunked</a>, <a href="https://github.com/JimminiKin" target="_blank" rel="noopener noreferrer">@JimminiKin</a>, <a href="https://github.com/DerTimonius" target="_blank" rel="noopener noreferrer">@DerTimonius</a>, <a href="https://github.com/vkml" target="_blank" rel="noopener noreferrer">@vkml</a>, <a href="https://github.com/ginabethrussell" target="_blank" rel="noopener noreferrer">@ginabethrussell</a>, <a href="https://github.com/jeremiah-snee-openx" target="_blank" rel="noopener noreferrer">@jeremiah-snee-openx</a>, <a href="https://github.com/WillianAgostini" target="_blank" rel="noopener noreferrer">@WillianAgostini</a>, <a href="https://github.com/casey-lentz" target="_blank" rel="noopener noreferrer">@casey-lentz</a>, <a href="https://github.com/faizanu94" target="_blank" rel="noopener noreferrer">@faizanu94</a>, <a href="https://github.com/someone635" target="_blank" rel="noopener noreferrer">@someone635</a>, <a href="https://github.com/rafaelrabelos" target="_blank" rel="noopener noreferrer">@rafaelrabelos</a>, <a href="https://github.com/RayBrokeSomething" target="_blank" rel="noopener noreferrer">@RayBrokeSomething</a>, <a href="https://github.com/DaniAcu" target="_blank" rel="noopener noreferrer">@DaniAcu</a>, <a href="https://github.com/mattkubej" target="_blank" rel="noopener noreferrer">@mattkubej</a>, <a href="https://github.com/tr1ckydev" target="_blank" rel="noopener noreferrer">@tr1ckydev</a>, <a href="https://github.com/shresthasurav" target="_blank" rel="noopener noreferrer">@shresthasurav</a>, <a href="https://github.com/the-ress" target="_blank" rel="noopener noreferrer">@the-ress</a>, <a href="https://github.com/Mutesa-Cedric" target="_blank" rel="noopener noreferrer">@Mutesa-Cedric</a>, <a href="https://github.com/nolddor" target="_blank" rel="noopener noreferrer">@nolddor</a>, <a href="https://github.com/alexreardon" target="_blank" rel="noopener noreferrer">@alexreardon</a>, <a href="https://github.com/Peeja" target="_blank" rel="noopener noreferrer">@Peeja</a>, <a href="https://github.com/verycosy" target="_blank" rel="noopener noreferrer">@verycosy</a>, <a href="https://github.com/mknight-atl" target="_blank" rel="noopener noreferrer">@mknight-atl</a>, <a href="https://github.com/maro1993" target="_blank" rel="noopener noreferrer">@maro1993</a>, <a href="https://github.com/Eric-Tyrrell22" target="_blank" rel="noopener noreferrer">@Eric-Tyrrell22</a></p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 29: Snapshot format changes]]></title>
            <link>https://jestjs.io/uk/blog/2022/08/25/jest-29</link>
            <guid>https://jestjs.io/uk/blog/2022/08/25/jest-29</guid>
            <pubDate>Thu, 25 Aug 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[Jest 29 is here, just a few short months after Jest 28. As mentioned in the Jest 28 blog post, this version contains just a couple of breaking changes, in order to make the upgrade as smooth as possible.]]></description>
            <content:encoded><![CDATA[<p>Jest 29 is here, just a few short months after Jest 28. As mentioned in the <a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#future">Jest 28 blog post</a>, this version contains just a couple of breaking changes, in order to make the upgrade as smooth as possible.</p>
<p>The only breaking changes that should be noticeable are:</p>
<ul>
<li>
<p>Node versions 12 and 17 are dropped, both of which are EOL</p>
</li>
<li>
<p>The <code>snapshotFormat</code> property is changed to:</p>
<div class="language-diff codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-diff codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token inserted-sign inserted prefix inserted" style="color:#397300;background:#baeeba">+</span><span class="token inserted-sign inserted line" style="color:#397300;background:#baeeba"> snapshotFormat: {</span><br></span><span class="token-line" style="color:#393A34"><span class="token inserted-sign inserted line" style="color:#397300;background:#baeeba"></span><span class="token inserted-sign inserted prefix inserted" style="color:#397300;background:#baeeba">+</span><span class="token inserted-sign inserted line" style="color:#397300;background:#baeeba">   escapeString: false,</span><br></span><span class="token-line" style="color:#393A34"><span class="token inserted-sign inserted line" style="color:#397300;background:#baeeba"></span><span class="token inserted-sign inserted prefix inserted" style="color:#397300;background:#baeeba">+</span><span class="token inserted-sign inserted line" style="color:#397300;background:#baeeba">   printBasicPrototype: false</span><br></span><span class="token-line" style="color:#393A34"><span class="token inserted-sign inserted line" style="color:#397300;background:#baeeba"></span><span class="token inserted-sign inserted prefix inserted" style="color:#397300;background:#baeeba">+</span><span class="token inserted-sign inserted line" style="color:#397300;background:#baeeba"> }</span><br></span></code></pre></div></div>
</li>
<li>
<p><code>jest-environment-jsdom</code> has upgraded <code>jsdom</code> from v19 to v20</p>
</li>
</ul>
<p>There are certain changes to the types exposed by Jest, but probably (hopefully!) nothing that should impede the upgrade. Please see the <a href="https://jest-archive-august-2023.netlify.app/docs/upgrading-to-jest29" target="_blank" rel="noopener noreferrer">upgrade guide</a> for more details.</p>
<p>That's it for breaking changes! Hopefully this means the upgrade path from Jest 28 is smooth. Please see the <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md#2900" target="_blank" rel="noopener noreferrer">changelog</a> for other changes.</p>
<p>Thanks for reading, and happy Jesting! 🃏</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest joins OpenJS Foundation]]></title>
            <link>https://jestjs.io/uk/blog/2022/05/11/jest-joins-openjs</link>
            <guid>https://jestjs.io/uk/blog/2022/05/11/jest-joins-openjs</guid>
            <pubDate>Wed, 11 May 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[Banner image for Meta Open Source and OpenJS Foundation]]></description>
            <content:encoded><![CDATA[<p><img decoding="async" loading="lazy" alt="Banner image for Meta Open Source and OpenJS Foundation" src="https://jestjs.io/uk/assets/images/openjs-ba98de96267fe09d68d434f11271825b.png" width="8002" height="1278" class="img_SS3x"></p>
<p>Today we're excited to announce that Jest is joining the OpenJS Foundation!</p>
<p>This change transfers ownership of the project from Meta to the Jest Core team via the OpenJS Foundation as an Impact Project. We’re grateful to Meta for creating Jest and all of their support over the years, and we look forward to the future of Jest as a project owned by the Jest community!</p>
<p>Check out the <a href="https://developers.facebook.com/blog/post/2022/05/11/meta-open-source-transfers-jest-to-openjs-foundation/" target="_blank" rel="noopener noreferrer">Meta Engineering blog</a> and <a href="https://openjsf.org/blog/2022/05/11/openjs-foundation-welcomes-jest/" target="_blank" rel="noopener noreferrer">OpenJS Foundation blog</a> announcements for more info.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 28: Shedding weight and improving compatibility 🫶]]></title>
            <link>https://jestjs.io/uk/blog/2022/04/25/jest-28</link>
            <guid>https://jestjs.io/uk/blog/2022/04/25/jest-28</guid>
            <pubDate>Mon, 25 Apr 2022 00:00:00 GMT</pubDate>
            <description><![CDATA[Jest 28 is finally here, and it comes with some long requested features such as support for sharding a test run across multiple machines, package exports and the ability to customize the behavior of fake timers. These are just some personal highlights, and we'll be highlighting more in this blog post.]]></description>
            <content:encoded><![CDATA[<p>Jest 28 is finally here, and it comes with some long requested features such as support for <a href="https://jestjs.io/uk/docs/cli#--shard">sharding</a> a test run across multiple machines, <a href="https://nodejs.org/api/packages.html#exports" target="_blank" rel="noopener noreferrer">package <code>exports</code></a> and the ability to customize the behavior of <a href="https://jestjs.io/uk/docs/jest-object#fake-timers">fake timers</a>. These are just some personal highlights, and we'll be highlighting more in this blog post.</p>
<p>Additionally, as announced in the <a href="https://jestjs.io/uk/blog/2021/05/25/jest-27">Jest 27 blog post</a> last year, we have removed some packages that no longer are used by default from the default installation. As a result the installation size has dropped by about 1/3.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="breaking-changes">Breaking changes<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#breaking-changes" class="hash-link" aria-label="Direct link to Breaking changes" title="Direct link to Breaking changes" translate="no">​</a></h2>
<p>The list of breaking changes is long (and can be seen fully in the <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md#2800" target="_blank" rel="noopener noreferrer">changelog</a>), but for migration purposes, we've also written <a href="https://jest-archive-august-2023.netlify.app/docs/28.x/upgrading-to-jest28/" target="_blank" rel="noopener noreferrer">a guide</a> you can follow. Hopefully this makes the upgrade experience as frictionless as possible!</p>
<p>Main breaking changes likely to impact your migration are dropped support for Node 10 and 15 (but <em>not</em> Node 12, which will be EOL in a few days) and some renamed configuration options.</p>
<p>Please note that both of the removed modules (<code>jest-environment-jsdom</code> and <code>jest-jasmine2</code>) are still actively maintained and tested in the same way, so the only breaking change here is that you'll need to explicitly install them.</p>
<p>The guide should hopefully make migration trivial, but note that if you use any of the packages Jest consists of directly (such as <code>jest-worker</code> or <code>pretty-format</code>), instead of just running <code>jest</code>, then you need to go through the changelog to view any breaking changes.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="features">Features<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#features" class="hash-link" aria-label="Direct link to Features" title="Direct link to Features" translate="no">​</a></h2>
<p>Now let's talk about the new features in Jest 28, which is way more exciting! And there's quite a few of them, so buckle up.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="sharding-of-test-run">Sharding of test run<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#sharding-of-test-run" class="hash-link" aria-label="Direct link to Sharding of test run" title="Direct link to Sharding of test run" translate="no">​</a></h3>
<p>Jest now includes a new <a href="https://jestjs.io/uk/docs/cli#--shard"><code>--shard</code></a> CLI option, contributed by <a href="https://github.com/marionebl" target="_blank" rel="noopener noreferrer">Mario Nebl</a>. It allows you to run parts of your test across different machine, and has been one of Jest's oldest feature requests.</p>
<p>Jest's own test suite on CI went from about 10 minutes to 3 on Ubuntu, and on Windows from 20 minutes to 7.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="packagejson-exports"><code>package.json</code> <code>exports</code><a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#packagejson-exports" class="hash-link" aria-label="Direct link to packagejson-exports" title="Direct link to packagejson-exports" translate="no">​</a></h3>
<p>Jest shipped minimal support of <a href="https://nodejs.org/api/packages.html#exports" target="_blank" rel="noopener noreferrer"><code>exports</code></a> in 27.3. However, it only supported the "main" entry point (<code>.</code>), and only if no <code>main</code> field was present in <code>package.json</code>. With Jest 28 we're excited to finally be shipping full support!</p>
<p>Related, in Jest 27, we provided either <code>require</code> or <code>import</code> condition. In Jest 28, <code>jest-environment-node</code> will now automatically provide <code>node</code> and <code>node-addons</code> conditions, while <code>jest-environment-jsdom</code> will provide the <code>browser</code> condition.</p>
<p>This has been one of the biggest compatibility issues of Jest, and hopefully this is now resolved once and for all.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="fake-timers">Fake timers<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#fake-timers" class="hash-link" aria-label="Direct link to Fake timers" title="Direct link to Fake timers" translate="no">​</a></h3>
<p>Jest 26 introduced the concept of "modern" fake timers, which uses <a href="https://www.npmjs.com/package/@sinonjs/fake-timers" target="_blank" rel="noopener noreferrer"><code>@sinonjs/fake-timers</code></a> under the hood, and Jest 27 made it the default. In Jest 28, we are now exposing more of the underlying implementation through both configuration and runtime APIs. Huge thanks to <a href="https://github.com/mrazauskas" target="_blank" rel="noopener noreferrer">Tom Mrazauskas</a> who contributed this feature!</p>
<p>This allows you to not mock out <code>process.nextTick</code> which improves compatibility with fake <code>Promise</code>s, or to enable <code>advanceTimers</code> which automatically advance timers.</p>
<p>Please see <a href="https://jestjs.io/uk/docs/configuration#faketimers-object">the <code>fakeTimers</code> configuration</a> for details.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="github-actions-reporter">GitHub Actions Reporter<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#github-actions-reporter" class="hash-link" aria-label="Direct link to GitHub Actions Reporter" title="Direct link to GitHub Actions Reporter" translate="no">​</a></h3>
<p>Jest now ships with a reporter to be used on GitHub Actions, which will use annotations to print test errors inline.</p>
<p><img decoding="async" loading="lazy" alt="GitHub Actions test error screenshot" src="https://jestjs.io/uk/assets/images/28-gh-actions-reporter-1ee03f15b770cc9e04bb15ad1a532e1d.png" width="2286" height="554" class="img_SS3x"></p>
<p>You can activate this reporter by passing <code>github-actions</code> in the <a href="https://jestjs.io/uk/docs/configuration#reporters-arraymodulename--modulename-options"><code>reporters</code> configuration option</a>.</p>
<p>Huge thanks to <a href="https://github.com/ockham" target="_blank" rel="noopener noreferrer">Bernie Reiter</a> and other contributors for sticking by us and finally landing this feature.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="inline-testenvironmentoptions">Inline <code>testEnvironmentOptions</code><a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#inline-testenvironmentoptions" class="hash-link" aria-label="Direct link to inline-testenvironmentoptions" title="Direct link to inline-testenvironmentoptions" translate="no">​</a></h3>
<p>You can now pass <a href="https://jestjs.io/uk/docs/configuration#testenvironmentoptions-object"><code>testEnvironmentOptions</code></a> inline in a file, similar to how you can set test environment. This is useful if you want to e.g. change the URL in a single file.</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token doc-comment comment" style="color:#999988;font-style:italic">/**</span><br></span><span class="token-line" style="color:#393A34"><span class="token doc-comment comment" style="color:#999988;font-style:italic"> * </span><span class="token doc-comment comment keyword" style="color:#297a29;font-style:italic">@jest-environment</span><span class="token doc-comment comment" style="color:#999988;font-style:italic"> jsdom</span><br></span><span class="token-line" style="color:#393A34"><span class="token doc-comment comment" style="color:#999988;font-style:italic"> * </span><span class="token doc-comment comment keyword" style="color:#297a29;font-style:italic">@jest-environment-options</span><span class="token doc-comment comment" style="color:#999988;font-style:italic"> </span><span class="token doc-comment comment punctuation" style="color:#393A34;font-style:italic">{</span><span class="token doc-comment comment" style="color:#999988;font-style:italic">"url": "https://jestjs.io/"</span><span class="token doc-comment comment punctuation" style="color:#393A34;font-style:italic">}</span><span class="token doc-comment comment" style="color:#999988;font-style:italic"></span><br></span><span class="token-line" style="color:#393A34"><span class="token doc-comment comment" style="color:#999988;font-style:italic"> */</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#6b2e85">test</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'use jsdom and set the URL in this test file'</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:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#6b2e85">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token dom variable" style="color:#1373c2">window</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">location</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</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:#6b2e85">toBe</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'https://jestjs.io/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span 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></span></code></pre></div></div>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="all-nodejs-globals">All Node.js globals<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#all-nodejs-globals" class="hash-link" aria-label="Direct link to All Node.js globals" title="Direct link to All Node.js globals" translate="no">​</a></h3>
<p>If you are using the new <a href="https://nodejs.org/en/blog/announcements/v18-release-announce/#fetch-experimental" target="_blank" rel="noopener noreferrer"><code>fetch</code></a> implementation in Node v18, you might have noticed that this function is not available in Jest. It has been a long-standing issue that we have to manually copy over any globals into the test globals. With Jest 28, this is no longer an issue as we now inspect the global environment Jest itself is running in, and copy over any globals that are missing in the test environment.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="модулі-ecmascript">Модулі ECMAScript<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D1%96-ecmascript" class="hash-link" aria-label="Direct link to Модулі ECMAScript" title="Direct link to Модулі ECMAScript" translate="no">​</a></h3>
<p>Not much has changed in Jest's support for native ESM since Jest 27 came out. We continue to be blocked by <a href="https://github.com/nodejs/node/issues/37648" target="_blank" rel="noopener noreferrer">stabilization in Node</a>, and are hopeful this situation will improve sooner rather than later!</p>
<p>However, we have been able to add a couple of new features in Jest 28.</p>
<h4 class="anchor anchorWithStickyNavbar_JmGV" id="data-urls"><code>data:</code> URLs<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#data-urls" class="hash-link" aria-label="Direct link to data-urls" title="Direct link to data-urls" translate="no">​</a></h4>
<p><a href="https://github.com/tbossi" target="_blank" rel="noopener noreferrer">Tommaso Bossi</a> has contributed support for <a href="https://nodejs.org/api/esm.html#data-imports" target="_blank" rel="noopener noreferrer"><code>data</code> URLs</a>, meaning you can now inline define some JavaScript to run without using <code>eval</code>.</p>
<h4 class="anchor anchorWithStickyNavbar_JmGV" id="importmetajest"><code>import.meta.jest</code><a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#importmetajest" class="hash-link" aria-label="Direct link to importmetajest" title="Direct link to importmetajest" translate="no">​</a></h4>
<p>While you have been able to access <code>jest</code> via <code>import {jest} from '@jest/globals'</code> in Jest, we've received feedback that this is less ergonomical than the (seemingly, but not really) global <code>jest</code> variable available in CJS. So Jest 28 ships with <code>import.meta.jest</code> to allow easier access.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="miscellaneous">Miscellaneous<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#miscellaneous" class="hash-link" aria-label="Direct link to Miscellaneous" title="Direct link to Miscellaneous" translate="no">​</a></h3>
<p>That's quite a lot of features, and are my personal highlights. However, we still have many more which I'll quickly go through:</p>
<h4 class="anchor anchorWithStickyNavbar_JmGV" id="asynchronous-resolvers">Asynchronous resolvers<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#asynchronous-resolvers" class="hash-link" aria-label="Direct link to Asynchronous resolvers" title="Direct link to Asynchronous resolvers" translate="no">​</a></h4>
<p><a href="https://github.com/IanVS" target="_blank" rel="noopener noreferrer">Ian VanSchooten</a> has contributed support for <a href="https://jestjs.io/uk/docs/configuration#resolver-string">asynchronous resolvers</a>, which enables tools like <a href="https://vitejs.dev/" target="_blank" rel="noopener noreferrer">Vite</a> to have better integrations with Jest.</p>
<h4 class="anchor anchorWithStickyNavbar_JmGV" id="asynchronous-setup-files">Asynchronous setup files<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#asynchronous-setup-files" class="hash-link" aria-label="Direct link to Asynchronous setup files" title="Direct link to Asynchronous setup files" translate="no">​</a></h4>
<p>If you have some async work you want to do when using <code>setupFiles</code>, you can now export an <code>async function</code>, which Jest will call and await before loading any tests.</p>
<p>Note that this feature is only available for CJS. For ESM, we recommend using top-level <code>await</code> instead.</p>
<h4 class="anchor anchorWithStickyNavbar_JmGV" id="using-globalthis">Using <code>globalThis</code><a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#using-globalthis" class="hash-link" aria-label="Direct link to using-globalthis" title="Direct link to using-globalthis" translate="no">​</a></h4>
<p>Internally, Jest has been using <code>global</code> to refer to the <a href="https://developer.mozilla.org/en-US/docs/Glossary/Global_object" target="_blank" rel="noopener noreferrer">global environment</a>. However, since this only exists in Node, and not browsers (<code>window</code>), this led to incompatibility when attempting to use Jest's modules in another environment.</p>
<p>Jest 28 uses <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis" target="_blank" rel="noopener noreferrer"><code>globalThis</code></a> instead, which works in all environments.</p>
<h4 class="anchor anchorWithStickyNavbar_JmGV" id="jsdom-19">JSDOM 19<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#jsdom-19" class="hash-link" aria-label="Direct link to JSDOM 19" title="Direct link to JSDOM 19" translate="no">​</a></h4>
<p>While, as mentioned, Jest no longer ships <code>jest-environment-jsdom</code> in the default installation, it is still actively maintained. As part of that, Jest 28 has upgraded from <code>jsdom@16</code> to <code>jsdom@19</code>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="typescript">TypeScript<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#typescript" class="hash-link" aria-label="Direct link to TypeScript" title="Direct link to TypeScript" translate="no">​</a></h2>
<p>If you use Jest with TypeScript, either in your tests or when writing plugins such as custom runners, Jest 28 comes with extensive improvements to our types. Here's a non-exhaustive list of the changes in Jest 28.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="expect"><code>expect</code><a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#expect" class="hash-link" aria-label="Direct link to expect" title="Direct link to expect" translate="no">​</a></h3>
<p>When using <code>expect</code>'s own types (either directly, or via <code>import {expect} from '@jest/globals'</code>), it's now finally possible to add custom matchers. See our <a href="https://github.com/jestjs/jest/tree/main/examples/expect-extend" target="_blank" rel="noopener noreferrer">example</a> for how to do this.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="custom-plugins">Custom plugins<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#custom-plugins" class="hash-link" aria-label="Direct link to Custom plugins" title="Direct link to Custom plugins" translate="no">​</a></h3>
<p>If you write a custom runner, test reporter, resolver or something else, we now export more types that should help you type these more correctly. This is a moving target, so if you are the author of something pluggable in Jest and the types aren't as useful as they could be, please file an issue!</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="jest-runner-tsd"><code>jest-runner-tsd</code><a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#jest-runner-tsd" class="hash-link" aria-label="Direct link to jest-runner-tsd" title="Direct link to jest-runner-tsd" translate="no">​</a></h3>
<p><a href="https://github.com/jest-community/jest-runner-tsd" target="_blank" rel="noopener noreferrer"><code>jest-runner-tsd</code></a> is a custom runner for running type tests. This is what Jest uses itself to test our types, and we hope it can also be used by others! As its name implies, it is based on <a href="https://npmjs.com/package/tsd" target="_blank" rel="noopener noreferrer"><code>tsd</code></a>, although it under the hood uses the fork <a href="https://npmjs.com/package/tsd-lite" target="_blank" rel="noopener noreferrer"><code>tsd-lite</code></a>.</p>
<hr>
<p>All of these improvements and fixes has been contributed by <a href="https://github.com/mrazauskas" target="_blank" rel="noopener noreferrer">Tom Mrazauskas</a>. Thank you so much, Tom! 👏</p>
<p>Lastly, the minimum support version of TypeScript is now 4.3.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="jest-light-runner"><code>jest-light-runner</code><a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#jest-light-runner" class="hash-link" aria-label="Direct link to jest-light-runner" title="Direct link to jest-light-runner" translate="no">​</a></h2>
<p>The last thing we want to highlight in this blog post, is a very cool new Jest runner, created by <a href="https://github.com/nicolo-ribaudo" target="_blank" rel="noopener noreferrer">Nicolò Ribaudo</a>, called <a href="https://www.npmjs.com/package/jest-light-runner" target="_blank" rel="noopener noreferrer"><code>jest-light-runner</code></a>. This takes almost all of the DX Jest is known for, and speeds it way up by being a smaller abstraction on top of Node. Babel's tests became almost twice as fast after migrating. While there are caveats, the existence of this runner should make it even easier for people who have smaller Node modules to test to choose Jest. Thanks, Nicolò!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="future">Future<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#future" class="hash-link" aria-label="Direct link to Future" title="Direct link to Future" translate="no">​</a></h2>
<p>While Jest 28 came almost a year after Jest 27, Jest 29 will be coming sooner, probably in just a few months. The current plan then is to just have one breaking change (except dropping Node versions), and that is to default <a href="https://jestjs.io/uk/docs/configuration#snapshotformat-object"><code>snapshotFormat</code></a> to <code>{escapeString: false, printBasicPrototype: false}</code>. This makes snapshots both more readable and more copy-pasteable.</p>
<p>This will of course be possible to override if you don't want to change, but you can also use those options today if you don't want to wait!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="acknowledgements">Acknowledgements<a href="https://jestjs.io/uk/blog/2022/04/25/jest-28#acknowledgements" class="hash-link" aria-label="Direct link to Acknowledgements" title="Direct link to Acknowledgements" translate="no">​</a></h2>
<p>Jest 28 contains contributions from more than 60 people, of which more than two thirds are first time contributors. Thank you so much to all contributors, old and new. Without you the project wouldn't be nearly as good as it is! I'd particularly like to thank <a href="https://github.com/mrazauskas" target="_blank" rel="noopener noreferrer">Tom Mrazauskas</a> and <a href="https://github.com/F3n67u" target="_blank" rel="noopener noreferrer">Feng Yu</a> for all their contributions, from code, to issue triaging to debugging, that made Jest 28 what it is. Thank you! 🙏</p>
<p>Thanks for reading, and happy Jesting! 🃏</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 27: New Defaults for Jest, 2021 edition ⏩]]></title>
            <link>https://jestjs.io/uk/blog/2021/05/25/jest-27</link>
            <guid>https://jestjs.io/uk/blog/2021/05/25/jest-27</guid>
            <pubDate>Tue, 25 May 2021 00:00:00 GMT</pubDate>
            <description><![CDATA[In the Jest 26 blog post about a year ago, we announced that after two major releases with few breaking changes, Jest 27 will flip some switches to set better defaults for projects that are new or can migrate smoothly. This gives us the opportunity to remove some packages from the default distribution of Jest 28 and publish them as separately installable and pluggable modules instead. Everyone on the new defaults can benefit from a smaller install size, while people needing these packages can still install them separately.]]></description>
            <content:encoded><![CDATA[<p>In the <a href="https://jestjs.io/uk/blog/2020/05/05/jest-26">Jest 26 blog post</a> about a year ago, we announced that after two major releases with few breaking changes, Jest 27 will flip some switches to set better defaults for projects that are new or can migrate smoothly. This gives us the opportunity to remove some packages from the default distribution of Jest 28 and publish them as separately installable and pluggable modules instead. Everyone on the new defaults can benefit from a smaller install size, while people needing these packages can still install them separately.</p>
<p>With the first major change of defaults since the <a href="https://jestjs.io/uk/blog/2016/09/01/jest-15">New Defaults for Jest</a> that came with the seminal version 15, Jest 27 is now here, to keep Jest fast, lean, and relevant in the future. We will explain those changes of defaults and other notable breaking changes in this post, but first, let's get into some exciting new features!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="feature-updates">Feature updates<a href="https://jestjs.io/uk/blog/2021/05/25/jest-27#feature-updates" class="hash-link" aria-label="Direct link to Feature updates" title="Direct link to Feature updates" translate="no">​</a></h2>
<p>Firstly, the interactive mode you may know from reviewing and updating failed snapshots can now also be used to <strong>step through failed tests</strong> one at a time. Credit goes to first-time contributor <a href="https://github.com/NullDivision" target="_blank" rel="noopener noreferrer">@NullDivision</a> for <a href="https://github.com/jestjs/jest/pull/10858" target="_blank" rel="noopener noreferrer">implementing</a> this feature!</p>
<p><img decoding="async" loading="lazy" alt="Interactive failed test run" src="https://jestjs.io/uk/assets/images/27-interactive-failures-e22e3b31b285188ed65f6432cb21df30.png" width="2416" height="1289" class="img_SS3x"></p>
<p>Speaking of snapshots, one of the more exciting features we've shipped in recent years are Inline Snapshots, which <a href="https://github.com/jestjs/jest/pull/6380" target="_blank" rel="noopener noreferrer">landed</a> in a minor release of Jest 23 almost three years ago. However, they came with the restriction that projects wanting to utilize them must be using <a href="https://prettier.io/" target="_blank" rel="noopener noreferrer">Prettier</a> to format their code, because that's what Jest would use to make sure the file it writes the snapshots into remains properly formatted.<br>
<!-- -->And so for most of these years, we've had a <a href="https://github.com/jestjs/jest/pull/7792" target="_blank" rel="noopener noreferrer">pull request</a> in the pipeline to eliminate this restriction and allow using <strong>Inline Snapshots without Prettier</strong>. It has amassed well above a hundred comments, not even taking into account PRs split out from it and landed first, and even changed owner once after the initial submission by another first-time contributor, <a href="https://github.com/mmkal" target="_blank" rel="noopener noreferrer">@mmkal</a> under the hilarious working title 'Uglier Inline Snapshots'. With the stellar rise of Prettier in recent times, this improvement is now maybe less needed than back in 2018, but still, we know that feeling of getting into a project that does not use Prettier, and suddenly not being able to use inline snapshots anymore. Nevermore!</p>
<p>The main reason why it took us so long to land this was, somewhat surprisingly, an out of memory error on our build pipeline. It turns out that the dependencies we load for each test file to perform the parsing, snapshot insertion, and printing do incur a significant time and memory overhead.<br>
<!-- -->So with some <a href="https://github.com/jestjs/jest/issues/9898" target="_blank" rel="noopener noreferrer">tricks</a>, we've <strong>speed up the initialization per test file</strong> by roughly 70% compared to Jest 26. Note that you will almost certainly not see this big of a performance improvement on your project—you would need a lot of test files that each run very quickly to best notice this, and the overhead when using a <a href="https://jestjs.io/uk/docs/configuration#testenvironment-string">JSDOM environment</a> dwarfs any such improvement.</p>
<p>In other news, the <a href="https://github.com/jestjs/jest/issues/9430" target="_blank" rel="noopener noreferrer">native ESM support</a> is progressing, but some major complexities, for instance around mocking, are still ahead of us, and we continue to observe the migration to ESM as a huge ecosystem effort, where Node and a lot of crucial tools and packages all have to rely on each other to deliver an overall compelling experience.<br>
<!-- -->ESM support <a href="https://github.com/jestjs/jest/issues/11167" target="_blank" rel="noopener noreferrer">for plugging modules into Jest</a> is more advanced—custom runners, reporters, watch plugins, and many other modules can already be loaded as ES modules.</p>
<p>We've also merged <a href="https://github.com/jestjs/jest/pull/9351" target="_blank" rel="noopener noreferrer">a PR</a> to be able to deal with test files symlinked into the test directory, a feature much wanted by users of <a href="https://bazel.build/" target="_blank" rel="noopener noreferrer">Bazel</a>.</p>
<p><a href="https://github.com/jestjs/jest/issues/9504" target="_blank" rel="noopener noreferrer">Another PR</a> enabled <a href="https://jestjs.io/uk/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object"><code>transform</code>s</a> to be asynchronous, a requirement to support transpilation through tools such as <a href="https://esbuild.github.io/" target="_blank" rel="noopener noreferrer">esbuild</a>, <a href="https://www.snowpack.dev/" target="_blank" rel="noopener noreferrer">Snowpack</a>, and <a href="https://vitejs.dev/" target="_blank" rel="noopener noreferrer">Vite</a> effectively.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="flipping-defaults">Flipping defaults<a href="https://jestjs.io/uk/blog/2021/05/25/jest-27#flipping-defaults" class="hash-link" aria-label="Direct link to Flipping defaults" title="Direct link to Flipping defaults" translate="no">​</a></h2>
<p>Up until now, if you were using Jest in its default configuration, you were—perhaps unknowingly—running some code forked many years ago from the test runner <a href="https://jasmine.github.io/2.0/introduction" target="_blank" rel="noopener noreferrer">Jasmine 2.0</a> that provides test framework functions such as <code>describe</code>, <code>it</code>, and <code>beforeEach</code>. In 2017, <a href="https://github.com/aaronabramov" target="_blank" rel="noopener noreferrer">Aaron Abramov</a> <a href="https://github.com/jestjs/jest/pull/3668" target="_blank" rel="noopener noreferrer">initially wrote</a> a <strong>replacement for the Jasmine code</strong> called <code>jest-circus</code>, meant to improve error messages, maintainability, and extensibility.<br>
<!-- -->After years of large-scale use at Facebook and of course in Jest itself, as well as recent adoption in <code>create-react-app</code>, we are now confident that <code>jest-circus</code> is highly compatible with <code>jest-jasmine2</code> and should work in most environments with little to no migration work. There may be minor differences in execution order and strictness, but we expect no major upgrade difficulties other than for code relying on Jasmine-specific APIs such as <code>jasmine.getEnv()</code>. If you rely extensively on such APIs, you can opt back in to the Jasmine-based test runner by <a href="https://jestjs.io/uk/docs/configuration#testrunner-string">configuring</a> <code>"testRunner": "jest-jasmine2"</code>.</p>
<p>Running tests in a <a href="https://jestjs.io/uk/docs/configuration#testenvironment-string">JSDOM environment</a> incurs a significant performance overhead. Because this was the default behavior of Jest unless otherwise configured up until now, users who are writing Node apps, for example, may not even know they are given an expensive DOM environment that they do not even need.<br>
<!-- -->For this reason, we are <strong>changing the default test environment</strong> from <code>"jsdom"</code> to <code>"node"</code>. If you are affected by this change because you use DOM APIs and do not have the test environment explicitly configured, you should be receiving an error when e.g. <code>document</code> is accessed, and you can configure <code>"testEnvironment": "jsdom"</code> or use <a href="https://jestjs.io/uk/docs/configuration#testenvironment-string">per-file environment configuration</a> to resolve this.<br>
<!-- -->For mixed projects where some tests require a DOM environment but others don't, we recommend using the fast <code>"node"</code> environment by default and declaring exactly those tests that need the DOM using <a href="https://jestjs.io/uk/docs/configuration#testenvironment-string">docblocks</a>.<br>
<!-- -->In the next major, we plan to also eliminate <code>jest-jasmine2</code> and <code>jest-environment-jsdom</code> from the Jest dependency tree and require them to be installed explicitly, so that many users can profit from a smaller install size with less clutter that they don't need.</p>
<p>Another default that we are changing affects Fake Timers aka <a href="https://jestjs.io/uk/docs/timer-mocks">Timer Mocks</a>. We introduced an opt-in "modern" implementation of Fake Timers in Jest 26 accessed transparently through the same API, but with much more comprehensive mocking, such as for <code>Date</code> and <code>queueMicrotask</code>.<br>
<!-- -->This <strong>modern fake timers implementation will now be the default</strong>. If you are among the unlucky few who are affected by the subtle implementation differences too heavily to migrate, you can get back the old implementation using <code>jest.useFakeTimers("legacy")</code> or, if you are enabling fake timers globally via <a href="https://jestjs.io/uk/docs/configuration#timers-string">configuration</a>, <code>"timers": "legacy"</code>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="features-coming-with-breaking-changes">Features coming with breaking changes<a href="https://jestjs.io/uk/blog/2021/05/25/jest-27#features-coming-with-breaking-changes" class="hash-link" aria-label="Direct link to Features coming with breaking changes" title="Direct link to Features coming with breaking changes" translate="no">​</a></h2>
<p>We introduced a few more small breaking changes to help you avoid mistakes by disallowing some things that can easily happen unintentionally:</p>
<ul>
<li>The same <code>done</code> test callback may not be called more than once,</li>
<li>calling <code>done</code> and returning a Promise may not be combined,</li>
<li>a <code>describe</code> block must not return anything,</li>
</ul>
<p>and we <a href="https://github.com/jestjs/jest/pull/10512" target="_blank" rel="noopener noreferrer">made some TypeScript types stricter</a>.</p>
<p>Modules used in the following configuration options are now transformed like the rest of your code, which may be breaking if you relied on them being loaded as-is:</p>
<ul>
<li><code>testEnvironment</code></li>
<li><code>runner</code></li>
<li><code>testRunner</code></li>
<li><code>snapshotResolver</code></li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="miscellaneous-breaking-changes">Miscellaneous breaking changes<a href="https://jestjs.io/uk/blog/2021/05/25/jest-27#miscellaneous-breaking-changes" class="hash-link" aria-label="Direct link to Miscellaneous breaking changes" title="Direct link to Miscellaneous breaking changes" translate="no">​</a></h2>
<p>We removed some long-deprecated functions:</p>
<ul>
<li><code>jest.addMatchers</code> (use <code>expect.extend</code> instead)</li>
<li><code>jest.resetModuleRegistry</code> (use <code>jest.resetModules</code> instead)</li>
<li><code>jest.runTimersToTime</code> (use <code>jest.advanceTimersByTime</code> instead)</li>
</ul>
<p>A lot of Jest's packages have been migrated to use ESM-style exports (although they are still shipped as CommonJS), so if you consume e.g. <code>pretty-format</code> directly, you may need to adjust your import to a <code>default</code> import.</p>
<p>We dropped support for Node 13—but Jest always supports the <em>Current</em> and all <em>LTS</em> <a href="https://nodejs.org/en/about/releases/" target="_blank" rel="noopener noreferrer">Node versions</a>, and Jest 27 continues to support Node 10, which only recently became unmaintained.</p>
<p>As always, the full changelog and list of breaking changes can be <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md#2700" target="_blank" rel="noopener noreferrer">viewed here</a>.</p>
<p>Finally, we'd like to thank the community for once again awarding Jest a sky-high satisfaction rating of 96% in the <a href="https://2020.stateofjs.com/en-US/technologies/testing/" target="_blank" rel="noopener noreferrer">State of JS 2020</a> survey! Stay safe everyone, and we hope you continue to enjoy using Jest in the years and versions to come! 🃏</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Оновлення вебсайту Jest]]></title>
            <link>https://jestjs.io/uk/blog/2021/03/09/jest-website-upgrade</link>
            <guid>https://jestjs.io/uk/blog/2021/03/09/jest-website-upgrade</guid>
            <pubDate>Tue, 09 Mar 2021 00:00:00 GMT</pubDate>
            <description><![CDATA[We are excited to present the new Jest website!]]></description>
            <content:encoded><![CDATA[<p>We are excited to present the <strong>new Jest website</strong>!</p>
<p>The Jest site was upgraded from <strong><a href="https://v1.docusaurus.io/" target="_blank" rel="noopener noreferrer">Docusaurus 1</a></strong> to <strong><a href="https://v2.docusaurus.io/" target="_blank" rel="noopener noreferrer">Docusaurus 2</a></strong>, and is an early adopter of the <a href="https://v2.docusaurus.io/blog/2021/03/09/releasing-docusaurus-i18n" target="_blank" rel="noopener noreferrer">newly released Docusaurus 2 i18n support</a>.</p>
<p>So, what's new exactly?</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="що-нового">Що нового?<a href="https://jestjs.io/uk/blog/2021/03/09/jest-website-upgrade#%D1%89%D0%BE-%D0%BD%D0%BE%D0%B2%D0%BE%D0%B3%D0%BE" class="hash-link" aria-label="Direct link to Що нового?" title="Direct link to Що нового?" translate="no">​</a></h2>
<p>Here's a good overview of the most visible improvements:</p>
<ul>
<li>
<p><strong>Dark Mode</strong>: change the color scheme through the navbar switch.</p>
</li>
<li>
<p><strong>Modern navigation</strong>: we improved the navigation experience with <strong>client-side routing</strong> and <strong>prefetching</strong>.</p>
</li>
<li>
<p><strong>Versions dropdown</strong>: it is now simpler to switch from one Jest version to another.</p>
</li>
<li>
<p><strong>Progressive-Web-App</strong>: you can install the Jest website and browse it offline.</p>
</li>
<li>
<p><strong>Search</strong>: try the new Algolia <strong>DocSearch v3</strong> user-experience. It is now possible to <strong>search in blog posts</strong>.</p>
</li>
<li>
<p><strong>I18n</strong>: Jest is the first website using the <strong><a href="https://v2.docusaurus.io/docs/i18n/introduction" target="_blank" rel="noopener noreferrer">new i18n feature of Docusaurus 2</a></strong>. It is now possible to <strong>translate blog posts</strong>.</p>
</li>
<li>
<p><strong>MDX</strong>: embedding React components in Markdown will allow maintainers to make the <strong>documentation more interactive</strong>.</p>
</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="for-site-translators">For site translators<a href="https://jestjs.io/uk/blog/2021/03/09/jest-website-upgrade#for-site-translators" class="hash-link" aria-label="Direct link to For site translators" title="Direct link to For site translators" translate="no">​</a></h2>
<p>If you want to help to translate the new Jest website, please use the new Crowdin project <a href="https://crowdin.com/project/jest-v2" target="_blank" rel="noopener noreferrer">jest-v2</a> instead of the previous one.</p>
<div class="theme-admonition theme-admonition-note admonition_WCGJ alert alert--secondary"><div class="admonitionHeading_GCBg"><span class="admonitionIcon_L39b"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_pbrs"><p>In localized pages, the edit button now links directly to Crowdin.</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="подяка">Подяка<a href="https://jestjs.io/uk/blog/2021/03/09/jest-website-upgrade#%D0%BF%D0%BE%D0%B4%D1%8F%D0%BA%D0%B0" class="hash-link" aria-label="Direct link to Подяка" title="Direct link to Подяка" translate="no">​</a></h2>
<p>Thanks to all the contributors that supported or reviewed this migration: <a href="https://github.com/SimenB" target="_blank" rel="noopener noreferrer">Simen</a>, <a href="https://github.com/orta" target="_blank" rel="noopener noreferrer">Orta</a>, <a href="https://github.com/JoelMarcey" target="_blank" rel="noopener noreferrer">Joel</a>, <a href="https://github.com/merceyz" target="_blank" rel="noopener noreferrer">Kristoffer</a>...</p>
<p>Please report any problem on the <a href="https://github.com/jestjs/jest/pull/11021" target="_blank" rel="noopener noreferrer">migration issue</a>.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 26: Tick Tock]]></title>
            <link>https://jestjs.io/uk/blog/2020/05/05/jest-26</link>
            <guid>https://jestjs.io/uk/blog/2020/05/05/jest-26</guid>
            <pubDate>Tue, 05 May 2020 00:00:00 GMT</pubDate>
            <description><![CDATA[When we started rebuilding Jest five years ago our goal was to provide a batteries-included zero-configuration test runner that is approachable for beginners, extensible for almost all testing use cases and scalable to large projects. One of the instrumental releases was Jest 15 which tied everything together and provided good defaults that allowed people to run Jest often without any setup. However, this approach has a big downside as Jest installs a lot of dependencies into your projects that you may not need.]]></description>
            <content:encoded><![CDATA[<p>When we started rebuilding Jest five years ago our goal was to provide a batteries-included zero-configuration test runner that is approachable for beginners, extensible for almost all testing use cases and scalable to large projects. One of the instrumental releases was <a href="https://jestjs.io/uk/blog/2016/09/01/jest-15">Jest 15</a> which tied everything together and provided good defaults that allowed people to run Jest often without any setup. However, this approach has a big downside as Jest installs a lot of dependencies into your projects that you may not need.</p>
<p>We are now beginning to address this shortcoming and are working on reducing Jest’s install size while keeping it approachable and extensible. We have made the following <strong>breaking changes</strong> in Jest 26:</p>
<ul>
<li>
<p><code>[expect, jest-mock, pretty-format]</code> Remove <code>ES5</code> build files with a new minimum of support of ES2015 (Node 8) which were only used for browser builds (<a href="https://github.com/jestjs/jest/pull/9945" target="_blank" rel="noopener noreferrer">#9945</a>)</p>
<blockquote>
<p><strong>Migration</strong>: With this change, we are pushing the responsibility to bundle the affected packages to the users, rather than Jest providing them out of the box, since they know their target environments best. If you want it back, we're open to shipping these as separate packages. PRs welcome!</p>
</blockquote>
</li>
<li>
<p><code>[jest-config, jest-resolve]</code> Remove support for <code>browser</code> field (<a href="https://github.com/jestjs/jest/pull/9943" target="_blank" rel="noopener noreferrer">#9943</a>)</p>
<blockquote>
<p><strong>Migration</strong>: Install <code>browser-resolve</code> module and use the following configuration:</p>
</blockquote>
<div class="language-json codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-json codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#82772c">"jest"</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token property" style="color:#82772c">"resolver"</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token string" style="color:#c21325">"&lt;rootDir&gt;/resolver.js"</span><span class="token plain"></span><br></span><span 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></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre></div></div>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// resolver.js</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#297a29">const</span><span class="token plain"> browserResolve </span><span class="token operator" style="color:#888">=</span><span class="token plain"> </span><span class="token function" style="color:#6b2e85">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'browser-resolve'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">module</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">exports</span><span class="token plain"> </span><span class="token operator" style="color:#888">=</span><span class="token plain"> browserResolve</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">sync</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre></div></div>
</li>
<li>
<p>TypeScript definitions requires a minimum of TypeScript v3.8 (<a href="https://github.com/jestjs/jest/pull/9823" target="_blank" rel="noopener noreferrer">#9823</a>)</p>
</li>
</ul>
<p>With the above changes Jest 26 is now 4 MiB smaller than Jest 25.5.4 (53 → 49 MiB). Please keep in mind that many dependencies like Babel are likely already part of your project. Jest's own size was reduced by 1.2 MiB (4.3 -&gt; 3.1 MiB).</p>
<p>While this is a good start, it isn’t enough to make Jest meaningfully leaner. We are planning on gradually reducing Jest's and its dependency tree size by up to 70%. Most of the changes to reduce Jest’s default setup will be small breaking changes and we want to bring the community with us as much as possible. Therefore we will make the following changes in Jest 27 and Jest 28 using a <a href="https://en.wikipedia.org/wiki/Tick%E2%80%93tock_model" target="_blank" rel="noopener noreferrer">“Tick-Tock" release process</a>:</p>
<ul>
<li>Jest 27 will ship with a new test runner "<code>jest-circus</code>" and the Node.js environment by default. <code>jest-jasmine2</code> and <code>jest-environment-jsdom</code> will still be bundled so users can keep using them by changing one-line each in the configuration.</li>
<li>Jest 28 will remove <code>jest-jasmine2</code> and <code>jest-environment-jsdom</code> from the default distribution of Jest. The packages will still be actively maintained as part of the Jest project and be published separately. Users will need to install these packages to use them.</li>
</ul>
<p>Upon upgrading to these major releases, Jest will guide you through the necessary changes. Якщо ви зараз захочете перейти до нових значень за замовчуванням і ваш проект не потребує DOM середовища. ви можете покращити до Jest 26 і додати наступні параметри конфігурації:</p>
<div class="language-json codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-json codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#82772c">"jest"</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token property" style="color:#82772c">"testEnvironment"</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token string" style="color:#c21325">"node"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token property" style="color:#82772c">"testRunner"</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token string" style="color:#c21325">"jest-circus/runner"</span><span class="token plain"></span><br></span><span 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></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre></div></div>
<p>Jest will continue to ship with <code>babel-jest</code> enabled by default. It currently powers a few Jest features beyond compiling modern JavaScript syntax to something understood by current versions of Node.js and browsers: It also powers Jest's code coverage and mocking of ES modules. Jest currently ships with experimental support for <a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#v8-code-coverage">V8 coverage</a> and native support for ES Modules (more on that below!). It is not possible to mock static ES Modules per the specification without transforming the code first, so we will be encouraging patterns that work without the transformation we use Babel for today. Once V8 coverage and native ESM support stabilizes in Jest, we will also be able remove <code>babel-jest</code> as a default but we will keep maintaining it.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="new-fake-timers">New fake timers<a href="https://jestjs.io/uk/blog/2020/05/05/jest-26#new-fake-timers" class="hash-link" aria-label="Direct link to New fake timers" title="Direct link to New fake timers" translate="no">​</a></h2>
<p>With Jest 26 we are shipping a new implementation of fake timers based on <code>@sinonjs/fake-timers</code>. We've wanted to do this for years and are happy this has finally progressed far enough to support all of Jest's existing fake timer use cases.</p>
<p>The new implementation comes with extra features such as mocking <code>Date</code>, <code>queueMicrotask</code> and more, see <a href="https://github.com/sinonjs/fake-timers/blob/master/README.md" target="_blank" rel="noopener noreferrer">this README</a>. It works transparently using the existing timer APIs like <code>jest.runAllTimers()</code> – check out the documentation <a href="https://jestjs.io/uk/docs/timer-mocks">on our website</a>.</p>
<p>We are confident this implementation is ready for prime time, however we don't want to force people to rewrite their tests if they depend on subtle differences between the old and new implementation. In Jest 26, this new implementation will remain <em>opt-in</em> and can be activated by calling <code>jest.useFakeTimers('modern')</code> or by passing <code>modern</code> to the <code>timers</code> option in your config if you opted all tests into fake timers previously.</p>
<p>In Jest 27 we will swap the default to the new "modern" implementation but we will keep supporting and maintaining the legacy implementation which can be used by calling <code>jest.useFakeTimers('legacy')</code>. If you are unsure whether you'll be able to upgrade all your tests by the time Jest 27 rolls out, you can add this to your tests now to keep the old behavior.</p>
<p>We'd like to thank <a href="https://github.com/fatso83" target="_blank" rel="noopener noreferrer">Carl-Erik Kopseng</a>, <a href="https://github.com/benjamingr" target="_blank" rel="noopener noreferrer">Benjamin Gruenbaum</a> and other maintainers of <code>@sinonjs/fake-timers</code> for their help and patience when working with us to make this happen! <em>Exciting</em>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="a-new-way-to-consume-jest---jestglobals">A new way to consume Jest - <code>@jest/globals</code><a href="https://jestjs.io/uk/blog/2020/05/05/jest-26#a-new-way-to-consume-jest---jestglobals" class="hash-link" aria-label="Direct link to a-new-way-to-consume-jest---jestglobals" title="Direct link to a-new-way-to-consume-jest---jestglobals" translate="no">​</a></h2>
<p>Jest has relied on globals popularized by the Jasmine testing framework and others such as <code>describe</code>, <code>it</code>, <code>test</code> and <code>expect</code>. While this is a widely used pattern, many people have expressed their preference for importing testing related functions instead. To support this use case, we added a new package <code>@jest/globals</code> that can be used to import testing functions: <code>import {expect, jest, test} from '@jest/globals';</code>.</p>
<p>Caveats:</p>
<ul>
<li>Currently the globals still exist in the environment but we will introduce a mode to disable globals in the future. Similarly, you cannot use <code>const jest = require('@jest/globals')</code> as you'll get declaration errors because the <code>jest</code> variable is still a global for now.</li>
<li>There is currently no way to add custom matchers to the TypeScript definitions when using globals like this.</li>
<li>While this allows running tests without globals, it does not allow running tests without Jest's test runner at this time.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="native-esm-support">Native ESM support<a href="https://jestjs.io/uk/blog/2020/05/05/jest-26#native-esm-support" class="hash-link" aria-label="Direct link to Native ESM support" title="Direct link to Native ESM support" translate="no">​</a></h2>
<p>As mentioned in the <a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#ecmascript-modules-support">Jest 25 blog post</a> we have been working on native support for ECMAScript Modules. It is not stable yet but it is ready to be tested. We'd love to hear your feedback and bug reports! For an overview of the current state you can check out <a href="https://github.com/jestjs/jest/issues/9430" target="_blank" rel="noopener noreferrer">this issue</a>, or browse all issues with that label <a href="https://github.com/jestjs/jest/labels/ES%20Modules" target="_blank" rel="noopener noreferrer">ES Modules</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="other-breaking-changes-in-jest-26">Other Breaking Changes in Jest 26<a href="https://jestjs.io/uk/blog/2020/05/05/jest-26#other-breaking-changes-in-jest-26" class="hash-link" aria-label="Direct link to Other Breaking Changes in Jest 26" title="Direct link to Other Breaking Changes in Jest 26" translate="no">​</a></h2>
<ul>
<li>Dropped support for Node 8 (<a href="https://github.com/jestjs/jest/pull/9423" target="_blank" rel="noopener noreferrer">#9423</a>)</li>
<li><code>[jest-environment-jsdom]</code> Upgrade <code>jsdom</code> to v16 (<a href="https://github.com/jestjs/jest/pull/9606" target="_blank" rel="noopener noreferrer">#9606</a>)</li>
<li><code>[jest-runtime]</code> Remove long-deprecated <code>require.requireActual</code> and <code>require.requireMock</code> methods (<a href="https://github.com/jestjs/jest/pull/9854" target="_blank" rel="noopener noreferrer">#9854</a>)</li>
<li><code>[jest-haste-map]</code> Removed <code>providesModuleNodeModules</code> (<a href="https://github.com/jestjs/jest/pull/8535" target="_blank" rel="noopener noreferrer">#8535</a>)</li>
<li><code>[jest-circus]</code> Fail tests if a test takes a done callback and have return values (<a href="https://github.com/jestjs/jest/pull/9129" target="_blank" rel="noopener noreferrer">#9129</a>)</li>
<li><code>[jest-circus]</code> Throw a proper error if a test / hooks is defined asynchronously (<a href="https://github.com/jestjs/jest/pull/8096" target="_blank" rel="noopener noreferrer">#8096</a>)</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="stay-safe">Stay Safe<a href="https://jestjs.io/uk/blog/2020/05/05/jest-26#stay-safe" class="hash-link" aria-label="Direct link to Stay Safe" title="Direct link to Stay Safe" translate="no">​</a></h2>
<p>We are all currently experiencing an unprecedented time of uncertainty. If you are struggling financially, we would like to use <a href="https://opencollective.com/jest" target="_blank" rel="noopener noreferrer">Jest’s Open Collective fund</a> to help new and existing contributors. We place <a href="https://github.com/jestjs/jest/issues?q=is%3Aissue+is%3Aopen+bounty+label%3A%22Has+Bounty%22" target="_blank" rel="noopener noreferrer">bounties on some issues</a> and are open to offering a bounty on any of our current open issues - you can mention that an issue should have a bounty in the issue or contact <a href="https://twitter.com/cpojer" target="_blank" rel="noopener noreferrer">@cpojer via private message on Twitter</a>.</p>
<p>Please stay safe.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 25: 🚀 Вибудовуємо основу майбутнього]]></title>
            <link>https://jestjs.io/uk/blog/2020/01/21/jest-25</link>
            <guid>https://jestjs.io/uk/blog/2020/01/21/jest-25</guid>
            <pubDate>Tue, 21 Jan 2020 00:00:00 GMT</pubDate>
            <description><![CDATA[Jest 25 закладає основу для багатьох великих змін у майбутньому. Для цього, ми мінімізували критичні зміни, але зміни внутрішньої архітектури вимагають уваги під час оновлення. Основними змінами є оновлення JSDOM з версії 11 до 15, пришвидшення тестів на 10-15%, новий вигляд різниці для застарілих знімків і припинення підтримки Node 6.]]></description>
            <content:encoded><![CDATA[<p>Jest 25 закладає основу для багатьох великих змін у майбутньому. Для цього, ми мінімізували критичні зміни, але зміни внутрішньої архітектури вимагають уваги під час оновлення. Основними змінами є оновлення JSDOM з версії 11 до 15, пришвидшення тестів на 10-15%, новий вигляд різниці для застарілих знімків і припинення підтримки Node 6.</p>
<p>There has been more than 200 commits since Jest 24.9 by more than 80 different contributors, so as always, take a look at the <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md" target="_blank" rel="noopener noreferrer">changelog</a> for a full list of changes.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="бувай-node-6">Бувай, Node 6<a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#%D0%B1%D1%83%D0%B2%D0%B0%D0%B9-node-6" class="hash-link" aria-label="Direct link to Бувай, Node 6" title="Direct link to Бувай, Node 6" translate="no">​</a></h2>
<p>Node 6 завершив існування 30 квітня 2019, тож Jest 25 залишає його позаду. Видалення Node 6 означає, що ми можемо оновити залежності, найголовніше - JSDOM, що було оновлено до версії 15. Upgrading also means we no longer have to transpile <code>async-await</code> syntax, which results in both faster code execution and less memory consumption. Додатково, перекладений код Jest повинен бути простішим в налагоджені, якщо комусь доведеться в тому розбиратись.</p>
<p>Навіть якщо Node 8 також став EOL, Jest 25 підтримуватиме його, щоб зробити оновлення якомога простішим для тих з нас, хто досі підтримує Node 8. It does come with some tradeoffs though, such as JSDOM v16 having been released without Node 8 support, so you'll need to use <a href="https://www.npmjs.com/package/jest-environment-jsdom-sixteen" target="_blank" rel="noopener noreferrer"><code>jest-environment-jsdom-sixteen</code></a> if you want to use the latest version.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="покращення-продуктивності">Покращення продуктивності<a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#%D0%BF%D0%BE%D0%BA%D1%80%D0%B0%D1%89%D0%B5%D0%BD%D0%BD%D1%8F-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%B8%D0%B2%D0%BD%D0%BE%D1%81%D1%82%D1%96" class="hash-link" aria-label="Direct link to Покращення продуктивності" title="Direct link to Покращення продуктивності" translate="no">​</a></h2>
<p>За останні декілька релізів, ми отримали повідомлення про вповільнення Jest. Jest 25 містить оновлений Micromatch, яке дає величезну перевагу під час запуску, та деякі виправлення помилок і налаштування продуктивності, які повертають Jest швидкість версії 23. Як було зазначено на початку цього допису, для Jest це означає 10-15% зменшення часу виконання тестів. Ми завжди прагнемо вдосконалити цей момент, тож, будь ласка, перевірте, як він порівнюється з більш ранніми версіями та створіть проблеми, якщо ми маємо щось покращити!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="покриття-коду-v8">Покриття коду V8<a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#%D0%BF%D0%BE%D0%BA%D1%80%D0%B8%D1%82%D1%82%D1%8F-%D0%BA%D0%BE%D0%B4%D1%83-v8" class="hash-link" aria-label="Direct link to Покриття коду V8" title="Direct link to Покриття коду V8" translate="no">​</a></h2>
<p>Jest’s current code coverage instrumentation is powered by <code>babel-plugin-istanbul</code> inserting code coverage collection code before creating reports. Однак це доволі повільний процес, що використовує багато пам'яті, особливо для великих файлів та баз коду. Luckily, V8 has built-in code coverage, which is becoming more and more usable in Node thanks to the hard work of <a href="https://github.com/bcoe" target="_blank" rel="noopener noreferrer">Benjamin Coe</a> and others on the V8 and Node.js teams. Jest 25 comes with experimental support for this via a new <code>--coverage-provider</code> flag. Please see its <a href="https://jestjs.io/uk/docs/configuration#coverageprovider-string">documentation</a> for caveats and how to use it.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="думаємо-швидко-та-повільно-щодо-провальних-тестів">Думаємо швидко та повільно щодо провальних тестів<a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#%D0%B4%D1%83%D0%BC%D0%B0%D1%94%D0%BC%D0%BE-%D1%88%D0%B2%D0%B8%D0%B4%D0%BA%D0%BE-%D1%82%D0%B0-%D0%BF%D0%BE%D0%B2%D1%96%D0%BB%D1%8C%D0%BD%D0%BE-%D1%89%D0%BE%D0%B4%D0%BE-%D0%BF%D1%80%D0%BE%D0%B2%D0%B0%D0%BB%D1%8C%D0%BD%D0%B8%D1%85-%D1%82%D0%B5%D1%81%D1%82%D1%96%D0%B2" class="hash-link" aria-label="Direct link to Думаємо швидко та повільно щодо провальних тестів" title="Direct link to Думаємо швидко та повільно щодо провальних тестів" translate="no">​</a></h2>
<p>Зайві зусилля для розуміння звітів провальних тестів заважають:</p>
<ul>
<li>“думати швидко”, розпізнаючи шаблони вашого минулого досвіду</li>
<li>“думати повільно”, аналізуючи зміни та вирішуючи, чи є вони очікуваним прогресом або несподіваним регресом</li>
</ul>
<p>Jest 25 завершує другу половину процесу, розпочатого в Jest 24, щодо покращення усіх матчерів:</p>
<ul>
<li>correct description line, including <code>.rejects</code>, <code>.resolves</code>, and <code>.not</code> modifiers</li>
<li>лаконічні мітки та послідовність щодо очікуваних та отриманих значень</li>
<li>інвертоване підсвічування підрядків розбіжностей, коли очікуються та отримуються рядки</li>
<li>кількість рядків змін, для розуміння типу зміни (лише видалення/додавання)</li>
</ul>
<p>Special thanks to Jest maintainer <a href="https://github.com/pedrottimark" target="_blank" rel="noopener noreferrer">Mark Pedrotti</a> for driving this effort and his continued work towards making expectation errors as good as they can be.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="кольори-відмінностей-при-провалі-тестування-знімками">Кольори відмінностей при провалі тестування знімками<a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#%D0%BA%D0%BE%D0%BB%D1%8C%D0%BE%D1%80%D0%B8-%D0%B2%D1%96%D0%B4%D0%BC%D1%96%D0%BD%D0%BD%D0%BE%D1%81%D1%82%D0%B5%D0%B9-%D0%BF%D1%80%D0%B8-%D0%BF%D1%80%D0%BE%D0%B2%D0%B0%D0%BB%D1%96-%D1%82%D0%B5%D1%81%D1%82%D1%83%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F-%D0%B7%D0%BD%D1%96%D0%BC%D0%BA%D0%B0%D0%BC%D0%B8" class="hash-link" aria-label="Direct link to Кольори відмінностей при провалі тестування знімками" title="Direct link to Кольори відмінностей при провалі тестування знімками" translate="no">​</a></h2>
<p>Найбільш очевидною зміною для боротьби з плутаниною стали кольори рядків відмінностей у випадках, коли тести знімків провалюються:</p>
<ul>
<li><code>- Snapshot</code> changes from green to <strong>magenta</strong></li>
<li><code>+ Received</code> changes from red to <strong>teal</strong> foreground on cyan/aqua background</li>
</ul>
<p>Приклади звітів тестів знімками (до ліворуч, після праворуч)</p>
<ol>
<li>Кількість змінених ліній підтверджує ваше перше враження щодо зміни знімків (тобто видалених або вставлених рядків)</li>
</ol>
<p><img decoding="async" loading="lazy" alt="snapshot-insert-lines" src="https://jestjs.io/uk/assets/images/25-snapshot-insert-lines-8168b88f07172d72e4d2cd0e05d200f1.png" width="1800" height="532" class="img_SS3x"></p>
<ol start="2">
<li>Колір фону спрощує візуальне порівняння змінених рядків</li>
</ol>
<p><img decoding="async" loading="lazy" alt="snapshot-change-lines" src="https://jestjs.io/uk/assets/images/25-snapshot-change-lines-d42906add66e08bb7c0ffffbca9a44bc.png" width="1800" height="504" class="img_SS3x"></p>
<ol start="3">
<li>Background colors also help you see which <code>toThrow</code> tests require a decision whether or not to update the snapshot</li>
</ol>
<p><img decoding="async" loading="lazy" alt="snapshot-change-substrings" src="https://jestjs.io/uk/assets/images/25-snapshot-change-substrings-0798d37f2f603ec43b57145cddc1247b.png" width="1800" height="168" class="img_SS3x"></p>
<p>Наведемо кілька причин, чому ми обрали унікальні кольори:</p>
<ul>
<li>95% людей, які повноцінно бачать кольори, можуть швидко визначити, які звіти стосуються тестів зі знімками, а не інших матчерів.</li>
<li>Це вирішує прямий конфлікт між значенням зеленого/червоного кольорів у тестах Jest, порівнюючи з перевіркою коду.</li>
<li>На відміну від червоного/зеленого кольорів, через які можна припустити, що оновлення є рішенням за замовчуванням, нинішня візуалізація показує, що відмінності вимагають більш ретельного розгляду на предмет можливої регресії в локальних помилках тестування знімками, а не перевірці коду (коли проблеми вже виправлені).</li>
</ul>
<p>Різниця у тональності від пурпуру 300° до відтінків блакитного 180° дає кращу видимість кольорів, а світлий відтінок фону для змінених ліній забезпечує постійний контраст у світлих і темних темах.</p>
<p>If you maintain a command line tool, you might find inspiration to improve its accessibility in <a href="https://github.com/jestjs/jest/pull/9132" target="_blank" rel="noopener noreferrer">#9132</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="підтримка-модулів-ecmascript">Підтримка модулів ECMAScript<a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#%D0%BF%D1%96%D0%B4%D1%82%D1%80%D0%B8%D0%BC%D0%BA%D0%B0-%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D1%96%D0%B2-ecmascript" class="hash-link" aria-label="Direct link to Підтримка модулів ECMAScript" title="Direct link to Підтримка модулів ECMAScript" translate="no">​</a></h2>
<p>Node 13 прибрав позначку підтримки ESM, тож ми почали потроху працювати над вбудованою підтримкою в Jest. Jest 25 includes support for <code>jest.config.cjs</code> and <code>jest.config.mjs</code> configuration files, but tests themselves cannot yet be written using ESM without something like Babel or TypeScript transforming it into CJS.</p>
<p>API, які використовуватиме Jest, все ще позначені як експериментальні, тому наразі не очікуйте підтримки. These APIs are something the <a href="https://github.com/nodejs/modules" target="_blank" rel="noopener noreferrer">Node.js Modules team</a> is actively working on, and we'll be keeping an eye on it moving forward and experiment with them so we can provide feedback. You can subscribe to <a href="https://github.com/jestjs/jest/issues/9430" target="_blank" rel="noopener noreferrer">this issue</a> to get any updates about the implementation status in Jest.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="інші-вдосконалення-та-оновлення">Інші вдосконалення та оновлення<a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#%D1%96%D0%BD%D1%88%D1%96-%D0%B2%D0%B4%D0%BE%D1%81%D0%BA%D0%BE%D0%BD%D0%B0%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D1%82%D0%B0-%D0%BE%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F" class="hash-link" aria-label="Direct link to Інші вдосконалення та оновлення" title="Direct link to Інші вдосконалення та оновлення" translate="no">​</a></h2>
<ul>
<li>Jest has passed <a href="https://github.com/jestjs/jest/graphs/contributors" target="_blank" rel="noopener noreferrer">1000 unique contributors</a>. Це неймовірне досягнення! Дякуємо всім, хто допомагає нам робити тестування якомога приємнішим.</li>
<li>Thanks to community member <a href="https://github.com/JoshRosenstein" target="_blank" rel="noopener noreferrer">Josh Rosenstein</a>, Jest now comes with support for <code>BigInt</code> in most matchers, such as <code>toBeGreaterThan</code>. Jest також приймає bigint літерали з коробки.</li>
<li>Jest’s feature <code>--detect-leaks</code> has been broken for Node 12 and newer - this has been fixed in Jest 25.</li>
<li>Як було оголошено в дописі блогу про Jest 24, базу коду Jest було переписано на TypeScript. Ця робота була завершена в Jest 24.3. Якщо ви використовуєте будь-яку з окремих частин Jest, ви маєте отримати відмінну інтеграцію IDE. Надалі ми дійсно хочемо покращити взаємодію Jest імітацій з системами типів; допомога спільноти в цьому не завадить. Please chime in <a href="https://github.com/jestjs/jest/issues/7832" target="_blank" rel="noopener noreferrer">here</a> with ideas and send PRs! Також ми будемо досліджувати переміщення типів для використання виконавця тестів Jest з DefinitelyTyped в самий Jest.</li>
<li>The <code>jest-diff</code> package now exports functions like <code>diffLinesUnified</code> and <code>diffStringsUnified</code> which have configuration options, so other applications can format differences in a custom way. For more information and code examples, see its new <code>README.md</code> file in the Jest repository or on package repositories.</li>
<li>Thanks to community member <a href="https://github.com/WeiAnAn" target="_blank" rel="noopener noreferrer">Wei An Yen</a>, Jest will no longer highlight passing asymmetric matchers in expectation errors. Це була давня проблема асиметричних матчерів і ми дуже раді, що вона нарешті вирішилась.</li>
<li>For the second year running, Jest won the Highest Satisfaction award from <a href="https://2019.stateofjs.com/awards/" target="_blank" rel="noopener noreferrer">State of JS</a>. Ми неймовірно вдячні за підтримку спільноти та сподіваємося, що зможемо продовжити такий рівень активності та покращитись за 2020 рік!</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="плани-на-майбутнє">Плани на майбутнє<a href="https://jestjs.io/uk/blog/2020/01/21/jest-25#%D0%BF%D0%BB%D0%B0%D0%BD%D0%B8-%D0%BD%D0%B0-%D0%BC%D0%B0%D0%B9%D0%B1%D1%83%D1%82%D0%BD%D1%94" class="hash-link" aria-label="Direct link to Плани на майбутнє" title="Direct link to Плани на майбутнє" translate="no">​</a></h2>
<ul>
<li>Jest’s configuration is vast and somewhat clunky - there is often <em>at least</em> two ways of doing the same thing, oftentimes even more. В Jest 26 ми сподіваємось зменшити конфігурацію та зробити її більш передбачуваною. See this <a href="https://github.com/jestjs/jest/issues/7185" target="_blank" rel="noopener noreferrer">issue</a> for details.</li>
<li>We also hope to be able to provide a proper programmatic API for running Jest, to make integration into IDEs and other tooling easier. Please see <a href="https://github.com/jestjs/jest/issues/5048" target="_blank" rel="noopener noreferrer">this</a> tracking issue.</li>
<li>There’s been an open PR for adding Lolex as an implementation of Jest’s fake timers since December 2017. While we’re not adding it to any public APIs in Jest 25, support for it is technically included and you we're looking into how to expose this so people can test and experiment with it. Using it means you can mock out <code>Date</code> and other timer function Jest currently doesn’t touch. Зверніть увагу, що це слід вважати експериментальним, і відповідна підтримка API буде в більш пізньому релізі. Follow <a href="https://github.com/jestjs/jest/pull/7776" target="_blank" rel="noopener noreferrer">this PR</a> for the latest updates on the status.</li>
</ul>
<p>Happy Jesting! 🃏</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 24: 💅 Оновлений, Відшліфований, Сумісний з TypeScript]]></title>
            <link>https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly</link>
            <guid>https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly</guid>
            <pubDate>Fri, 25 Jan 2019 00:00:00 GMT</pubDate>
            <description><![CDATA[Сьогодні ми з радістю повідомляємо про наступний великий реліз Jest - версія 24! Минуло 4 місяці з моменту останнього мінорного релізу та 8 місяців після виходу Jest 23, так що це велике оновлення буде корисне для кожного! Основні моменти містять в собі вбудовану підтримку TypeScript шляхом оновлення внутрішньої начинки Jest до Babel 7, виправлення деяких давніх проблем із відсутнім виводом консолі та проблемами продуктивності при обчисленні великих відмінностей, а також новісінький сайт. ✨]]></description>
            <content:encoded><![CDATA[<p>Сьогодні ми з радістю повідомляємо про наступний великий реліз Jest - версія 24! Минуло 4 місяці з моменту останнього мінорного релізу та 8 місяців після виходу Jest 23, так що це велике оновлення буде корисне для кожного! Основні моменти містять в собі вбудовану підтримку TypeScript шляхом оновлення внутрішньої начинки Jest до Babel 7, виправлення деяких давніх проблем із відсутнім виводом консолі та проблемами продуктивності при обчисленні великих відмінностей, а також новісінький сайт. ✨</p>
<p>For a full list of all changes see the <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md" target="_blank" rel="noopener noreferrer">changelog</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="новий-вебсайт">Новий вебсайт<a href="https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#%D0%BD%D0%BE%D0%B2%D0%B8%D0%B9-%D0%B2%D0%B5%D0%B1%D1%81%D0%B0%D0%B9%D1%82" class="hash-link" aria-label="Direct link to Новий вебсайт" title="Direct link to Новий вебсайт" translate="no">​</a></h2>
<p><a href="https://twitter.com/orta" target="_blank" rel="noopener noreferrer">@orta</a> has provided a beautiful redesign of Jest's website, which has been implemented by community members <a href="https://twitter.com/montogeek" target="_blank" rel="noopener noreferrer">@montogeek</a> and <a href="https://github.com/brainkim" target="_blank" rel="noopener noreferrer">@brainkim</a>.</p>
<p>Метою редизайну було виділити більше чудових моментів Jest та розвіяти міт, ніби Jest є насамперед інструментом для тестування додатків React - ви можете використовувати Jest на різних проєктах і ми хочемо, аби це було для всіх очевидним. You can read more about the ideas behind the redesign in <a href="https://github.com/jestjs/jest/issues/7265" target="_blank" rel="noopener noreferrer">this issue</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="підтримка-typescript">Підтримка TypeScript<a href="https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#%D0%BF%D1%96%D0%B4%D1%82%D1%80%D0%B8%D0%BC%D0%BA%D0%B0-typescript" class="hash-link" aria-label="Direct link to Підтримка TypeScript" title="Direct link to Підтримка TypeScript" translate="no">​</a></h2>
<p>З Jest 24, ми внутрішньо оновилися до Babel 7, що надало підтримку проєктів TypeScript. That means Jest can support transpiling TypeScript out of the box, as long as you configure Babel to use it with <code>@babel/preset-typescript</code>. Єдина незручність підтримки TypeScript за замовчуванням, аналогічна Flow, це те, що Babel вилучить лише анотації типів, щоб зробити ваш код дійсним JavaScript. It will <em>not</em> typecheck your code.</p>
<p>У той час як Jest підтримував Babel 7 з версії 22, випущеної в грудні 2017, це вимагало використання перехідного модуля, щоб співпрацювати з Jest підтримкою Babel 6. In Jest 24 we have migrated entirely over to Babel 7, with great help from community member <a href="https://github.com/milesj" target="_blank" rel="noopener noreferrer">@milesj</a>. This means that setup is now easier and we can take advantage of other Babel 7 features, such as config loading and automatic <code>modules</code> transpilation. Make sure to remove the <code>babel-core@^7.0.0-bridge.0</code> as it's not needed now.</p>
<p>If you want to run typechecks while you test, you should use <a href="https://github.com/kulshekhar/ts-jest" target="_blank" rel="noopener noreferrer"><code>ts-jest</code></a>. You will need to configure the transformer, as Jest by default applies Babel to <code>.ts</code> (and <code>.tsx</code>) files. Alternatively, you can run <code>tsc</code> or even use a Jest runner to simultaneously transpile your TypeScript whilst running your tests! See <a href="https://github.com/azz/jest-runner-tsc" target="_blank" rel="noopener noreferrer"><code>jest-runner-tsc</code></a> for more information.</p>
<p>See <a href="https://jestjs.io/uk/docs/getting-started#using-typescript">the docs</a> for more details.</p>
<div class="theme-admonition theme-admonition-tip admonition_WCGJ alert alert--success"><div class="admonitionHeading_GCBg"><span class="admonitionIcon_L39b"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>порада</div><div class="admonitionContent_pbrs"><p>If you for whatever reason cannot upgrade to Babel 7, you can still use Jest 24 with <code>babel@6</code> as long as you keep <code>babel-jest</code> at version 23.</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="testtodo"><code>test.todo</code><a href="https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#testtodo" class="hash-link" aria-label="Direct link to testtodo" title="Direct link to testtodo" translate="no">​</a></h2>
<p>В Jest 23 змінив пропуск тестів без реалізації на кидання throw. Ця зміна була зроблена через зворотний зв'язок; було зазначено, що випадково пропущені тести важко було знайти та відстежувати. Однак ця зміна зламала робочий процес для багатьох розробників, які використовували функцію для приблизної оцінки, які тести потрібно писати.</p>
<p>In Jest 24, we are addressing this issue by adding an explicit <code>test.todo</code> (inspired by the excellent AVA), which will be printed separately in the test summary. It allows you to quickly sketch out which tests you want to write and in the future, an <a href="https://eslint.org/" target="_blank" rel="noopener noreferrer">ESLint</a> rule might even be able to warn you that you have forgotten to write out some tests.</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token plain">test</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">todo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'invalid input should throw'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">test</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">todo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'missing options should be normalized'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre></div></div>
<p><img decoding="async" loading="lazy" alt="test.todo" src="https://jestjs.io/uk/assets/images/24-todo-c06adf4108c116aa230143cb8a147ae3.png" width="2324" height="1422" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="покращені-повідомлення-тверджень">Покращені повідомлення тверджень<a href="https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#%D0%BF%D0%BE%D0%BA%D1%80%D0%B0%D1%89%D0%B5%D0%BD%D1%96-%D0%BF%D0%BE%D0%B2%D1%96%D0%B4%D0%BE%D0%BC%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D1%82%D0%B2%D0%B5%D1%80%D0%B4%D0%B6%D0%B5%D0%BD%D1%8C" class="hash-link" aria-label="Direct link to Покращені повідомлення тверджень" title="Direct link to Покращені повідомлення тверджень" translate="no">​</a></h2>
<p>Коли тести провалюються, вам потрібно приймати впевнено та правильно вирішити, які зміни є очікуваним прогресом, а які несподіваним кроком назад. Особливо важливо не пропустити кілька проблем, захованих серед великого прогресу. Jest 24 робить звіти провальних тверджень яснішими та лаконічними для випадку декількох матчерів. Ініціатива буде продовжена у Jest 25, тож ви можете помітити деякі тимчасові невідповідності. Якщо ваші тести ніколи не провалюються, то ви не зможете їх побачити; для інших буде простіше знайти, чому щось не працює належним чином. Thanks for the hard work by <a href="https://twitter.com/ittordepam" target="_blank" rel="noopener noreferrer">@ittordepam</a> and other contributors from the community.</p>
<p>You can see these changes across all these PRs: <a href="https://github.com/jestjs/jest/pull/7621" target="_blank" rel="noopener noreferrer">7621</a>, <a href="https://github.com/jestjs/jest/pull/7557" target="_blank" rel="noopener noreferrer">7557</a>, <a href="https://github.com/jestjs/jest/pull/7448" target="_blank" rel="noopener noreferrer">7448</a>, <a href="https://github.com/jestjs/jest/pull/7325" target="_blank" rel="noopener noreferrer">7325</a>, <a href="https://github.com/jestjs/jest/pull/7241" target="_blank" rel="noopener noreferrer">7241</a>, <a href="https://github.com/jestjs/jest/pull/7152" target="_blank" rel="noopener noreferrer">7152</a>, <a href="https://github.com/jestjs/jest/pull/7125" target="_blank" rel="noopener noreferrer">7125</a>, <a href="https://github.com/jestjs/jest/pull/7107" target="_blank" rel="noopener noreferrer">7107</a>, <a href="https://github.com/jestjs/jest/pull/6961" target="_blank" rel="noopener noreferrer">6961</a>.</p>
<p>Приклади:</p>
<p>Провальні твердження</p>
<p><img decoding="async" loading="lazy" alt="failing assertion" src="https://jestjs.io/uk/assets/images/24-assertion-error-424a6b04bd7012af7d80419981d553d4.png" width="1844" height="1246" class="img_SS3x"></p>
<p>Невідповідність типів</p>
<p><img decoding="async" loading="lazy" alt="different types" src="https://jestjs.io/uk/assets/images/24-different-types-6cdc48fef8c458eeb7b804ba60f4661e.png" width="1844" height="1246" class="img_SS3x"></p>
<p>Функція-імітація не викликається</p>
<p><img decoding="async" loading="lazy" alt="mock functions" src="https://jestjs.io/uk/assets/images/24-mock-function-c93fb0afe32cea366976c870d89d9309.png" width="1844" height="1246" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="чинимо-давні-проблеми">Чинимо давні проблеми<a href="https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#%D1%87%D0%B8%D0%BD%D0%B8%D0%BC%D0%BE-%D0%B4%D0%B0%D0%B2%D0%BD%D1%96-%D0%BF%D1%80%D0%BE%D0%B1%D0%BB%D0%B5%D0%BC%D0%B8" class="hash-link" aria-label="Direct link to Чинимо давні проблеми" title="Direct link to Чинимо давні проблеми" translate="no">​</a></h2>
<p>В цьому релізі, ми виправили пару дійсно старих проблем.</p>
<p>The first one we'd like to highlight is <code>console.log</code> statements going missing. Jest перехоплює та збирає всі логи для того, щоб надати вам трасування стеку, а також віддати генераторам звітів, щоб ви змогли використовувати їх як заманеться. Однак, це призвело до проблеми їх відсутності в певних крайніх випадках. Luckily for Jest 24, <a href="https://twitter.com/spion" target="_blank" rel="noopener noreferrer">@spion</a> has <a href="https://github.com/jestjs/jest/pull/6871" target="_blank" rel="noopener noreferrer">stepped up</a> and fixed this issue. Щиро дякуємо!</p>
<p>Друга - це проблема дефіциту пам'яті Jest, якщо різниця в серіалізації очікуваного та отриманого значень має величезну кількість внесених змін (неочікувано через помилку в тесті або дефекті серіалізатора, або ж очікувана через тимчасові провали під час розробки через тестування). <a href="https://twitter.com/ittordepam" target="_blank" rel="noopener noreferrer">@ittordepam</a> has <a href="https://github.com/jestjs/jest/pull/6961" target="_blank" rel="noopener noreferrer">replaced</a> the previous diffing algorithm with <code>diff-sequences</code> package, which should fix this issue because it uses the theoretical minimum amount of memory. It opens up possibility for word-diffs in the future, similar to what <a href="https://git-scm.com/docs/git-diff#git-diff---word-diffltmodegt" target="_blank" rel="noopener noreferrer">git provides</a>. Please see <a href="https://github.com/jestjs/jest/pull/4619" target="_blank" rel="noopener noreferrer">this PR</a> and don't hesitate to reach out if you want to help make that happen!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="інші-зміни">Інші зміни<a href="https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#%D1%96%D0%BD%D1%88%D1%96-%D0%B7%D0%BC%D1%96%D0%BD%D0%B8" class="hash-link" aria-label="Direct link to Інші зміни" title="Direct link to Інші зміни" translate="no">​</a></h2>
<ul>
<li>We have some improvements for <code>globalSetup</code> and <code>globalTeardown</code> as well - code transformation will be applied to them similar to <code>setupFiles</code> and they are now supported as part of <code>projects</code>.</li>
<li>You can <a href="https://github.com/jestjs/jest/pull/6143" target="_blank" rel="noopener noreferrer">configure</a> Jest's snapshot location, this is mainly useful if you are building tools which use Jest in a larger build process.</li>
<li>A quirk of Jest's CLI has been that while some flags and options have been camel cased (such as <code>runInBand</code>), others have not been (such as <code>no-cache</code>). У Jest 24, обидва розпізнаються, що означає, що ви можете писати аргументи командного рядка будь-яким чином.</li>
<li>We've renamed <code>setupTestFrameworkScriptFile</code> to <code>setupFilesAfterEnv</code>, and made it into an array. Сподіваємося, стане більш зрозумілим, для чого необхідні опції. Ми маємо плани надалі знову переглянути конфігурацію, дивіться абзац у розділі нижче.</li>
<li>To reduce the amount of magic Jest performs to “just work™”, in this release we decided to drop automatic injection of <code>regenerator-runtime</code>, which is sometimes used in compiled async code. Including <code>regenerator-runtime</code> is not always necessary and we believe it's the user's responsibility to include it if it's needed. If you use <code>@babel/preset-env</code> with <code>targets</code> set to a modern Node version (e.g. Node 6+) you will not need to include it. Please see our <a href="https://jestjs.io/uk/docs/getting-started#using-babel">Using Babel docs</a> for more information.</li>
<li>Node.js 10 came with an experimental module <a href="https://nodejs.org/api/worker_threads.html" target="_blank" rel="noopener noreferrer">called <code>worker_threads</code></a>, which is similar to Worker threads in the browser. <code>jest-worker</code>, part of the <a href="https://jestjs.io/uk/docs/jest-platform">Jest platform</a>, will be able to use <code>worker_threads</code> if available instead of <code>child_process</code>, which makes it even faster! <a href="https://github.com/jestjs/jest/pull/6676" target="_blank" rel="noopener noreferrer">Benchmarks</a> show a 50% improvement. Через свою експериментальну природу, функцію вимкнено при використанні Jest як виконавця тестів, але ви вже можете використовувати її у своїх проєктах! Ми плануємо включити його за замовчуванням, коли його підвищать з експериментального статусу в Node.js.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="важливі-зміни">Важливі Зміни<a href="https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#%D0%B2%D0%B0%D0%B6%D0%BB%D0%B8%D0%B2%D1%96-%D0%B7%D0%BC%D1%96%D0%BD%D0%B8" class="hash-link" aria-label="Direct link to Важливі Зміни" title="Direct link to Важливі Зміни" translate="no">​</a></h2>
<p>While all breaking changes are listed in the <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md" target="_blank" rel="noopener noreferrer">changelog</a>, there's a few of them that are worth highlighting:</p>
<ul>
<li>Ми оновились до Micromatch 3. Хоча це може не вплинути на кожного користувача, він більш жорсткий при парсингу пошуку по масці, ніж у версії 2, яка використовується в Jest 23. Please read through <a href="https://github.com/micromatch/micromatch/issues/133#issuecomment-404211484" target="_blank" rel="noopener noreferrer">this</a> and linked issues for examples of invalid globs in case you have problems.</li>
<li>Ми видалили залишки коду, необхідні для Node 4. Раніше можна було запустити Jest 23 на Node 4, що стало неможливим без полінаповнювання та транспіляції.</li>
<li>Деякі зміни для серіалізації функцій-імітацій в знімках - не забудьте перевірити знімки після оновлення. Related <a href="https://github.com/jestjs/jest/pull/6381" target="_blank" rel="noopener noreferrer">PR</a>.</li>
<li>Jest no longer automatically injects <code>regenerator-runtime</code> - if you get errors concerning it, make sure to configure Babel to properly transpile <code>async</code> functions, using e.g. <code>@babel/preset-env</code>. Related <a href="https://github.com/jestjs/jest/pull/7595" target="_blank" rel="noopener noreferrer">PR</a>.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="майбутнє">Майбутнє<a href="https://jestjs.io/uk/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#%D0%BC%D0%B0%D0%B9%D0%B1%D1%83%D1%82%D0%BD%D1%94" class="hash-link" aria-label="Direct link to Майбутнє" title="Direct link to Майбутнє" translate="no">​</a></h2>
<p>We are incredibly humbled by the results in <a href="https://2018.stateofjs.com/awards/" target="_blank" rel="noopener noreferrer">State Of JS 2018</a>, where Jest won the “Highest Satisfaction” award. Ще однією великою подією, що вперше відбулася у жовтні 2018 році, стало досягнення Jest 2 мільйонів завантажень за тиждень. Дякуємо.</p>
<p>Ми дуже вдячні за довіру спільноти та сподіваємося підтверджувати її в майбутньому. Ми продовжимо будувати Jest 24 та майбутні релізи на цій неймовірній основі, і надалі бути невіднятною частиною інструментів JavaScript розробників.</p>
<p>Це був перший реліз, в якому ми досліджували ідею використання нашого фонду Open Collective для створення винагороди за знайдені помилки. This worked well in getting non-core developers involved in the implementation of the new landing page, and we're optimistic for a long running bug where Jest globals <a href="https://github.com/jestjs/jest/issues/2549" target="_blank" rel="noopener noreferrer">are mismatched</a> from Node globals. Ми хотіли б зробити більше, тож якщо у вас є невелика помилка, що в теорії є гарним кандидатом для нашої програми, повідомте нас про це. In the meantime, you can find all the tickets with a bounty via <a href="https://github.com/jestjs/jest/labels/Has%20Bounty" target="_blank" rel="noopener noreferrer">the issue label</a>.</p>
<p>Ми вже почали розробляти плани для наступного релізу Jest 25; найбільшою запланованою функцією стала капітальна зміна нашої конфігурації, яку здійснити складно, в основному через перетин опцій, змішані пошуки та регулярні вирази. Feedback on how you want Jest's configuration to look is very much welcome, and can be submitted in <a href="https://github.com/jestjs/jest/issues/7185" target="_blank" rel="noopener noreferrer">this issue</a>.</p>
<p>Ви також могли чути, що ми плануємо перенести кодову базу з Flow на TypeScript. Ми сподіваємось, що ця міграція дозволить ще більшій кількості учасників долучитись та допомогти зробити тестування JavaScript у 2019 році ще кращим. 🚀 План полягає в тому, щоб втілити це в мінорному релізі в найближчий час. Feedback on this choice can be added to <a href="https://github.com/jestjs/jest/pull/7554" target="_blank" rel="noopener noreferrer">the RFC</a>.</p>
<p>Lastly, if you've ever wondered about how Jest is built, <a href="https://twitter.com/cpojer" target="_blank" rel="noopener noreferrer">@cpojer</a> has recorded a video with an architectural overview of how Jest is put together under the hood. Якщо у вас є будь-які інші запитання з цього приводу, сміливо задавайте їх нам. The video is available on our <a href="https://jestjs.io/uk/docs/architecture">website</a>.</p>
<p>Happy Jesting! 🃏</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Підтримка відкритого вихідного коду Jest]]></title>
            <link>https://jestjs.io/uk/blog/2018/06/27/supporting-jest-open-source</link>
            <guid>https://jestjs.io/uk/blog/2018/06/27/supporting-jest-open-source</guid>
            <pubDate>Wed, 27 Jun 2018 00:00:00 GMT</pubDate>
            <description><![CDATA[Jest підтримується спільнотою відкритого вихідного коду та робітниками Facebook.]]></description>
            <content:encoded><![CDATA[<p>Jest підтримується спільнотою відкритого вихідного коду та робітниками Facebook.</p>
<p>Наші дописувачі вихідного коду працюють над створенням нового функціоналу, виправленням помилок та підтримувати список завдань. Співробітники Facebook роблять те саме, зосереджуючись на специфічних проблемах масштабування, і запускають усі запропоновані релізи на величезному тестовому комплекті Facebook перед публікацією.</p>
<p>Усі ми робимо свою частину, щоб зробити тестування приємним.</p>
<p>На саміті Jest ми оголосили про Jest Open Collective. Це наш спосіб допомогти підтримати зусилля спільноти з відкритим вихідним кодом Jest. <strong>To be absolutely clear: Facebook employees cannot benefit from the Jest Open Collective.</strong> The collective's sole purpose is to support the open source side of the Jest community.</p>
<p>В цьому повідомленні ми опишемо те, що собою являє Jest Open Collective, структуру та наявні цілі.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="jest-open-collective">Jest Open Collective<a href="https://jestjs.io/uk/blog/2018/06/27/supporting-jest-open-source#jest-open-collective" class="hash-link" aria-label="Direct link to Jest Open Collective" title="Direct link to Jest Open Collective" translate="no">​</a></h2>
<p><img decoding="async" loading="lazy" alt="Banner image for Jest Open Collective" src="https://jestjs.io/uk/assets/images/collective-fcec198ec20af7c295dbdab660e972b5.png" width="1869" height="800" class="img_SS3x"></p>
<p>Open Collective є платформою для видимого управління групами людей. Jest joins projects like <a href="https://opencollective.com/webpack" target="_blank" rel="noopener noreferrer">webpack</a>, <a href="https://opencollective.com/babel" target="_blank" rel="noopener noreferrer">Babel</a>, <a href="https://opencollective.com/mochajs" target="_blank" rel="noopener noreferrer">Mocha</a>, <a href="https://opencollective.com/preact" target="_blank" rel="noopener noreferrer">Preact</a>, <a href="https://opencollective.com/vuejs" target="_blank" rel="noopener noreferrer">Vue</a>, and many more in supporting the open source community through the Open Collective platform.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="що-таке-jest-open-collective">Що таке Jest Open Collective<a href="https://jestjs.io/uk/blog/2018/06/27/supporting-jest-open-source#%D1%89%D0%BE-%D1%82%D0%B0%D0%BA%D0%B5-jest-open-collective" class="hash-link" aria-label="Direct link to Що таке Jest Open Collective" title="Direct link to Що таке Jest Open Collective" translate="no">​</a></h3>
<p>Jest Open Collective - це група розробників відкритого вихідного коду, які працюють над:</p>
<ul>
<li>Отримуванням коштів від меценатів та спонсорів</li>
<li>Затвердженням витрат, запропонованих спільнотою</li>
<li>Наданням публічно видимих бюджетних звітів</li>
</ul>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="яка-структура-ініціативи">Яка структура ініціативи<a href="https://jestjs.io/uk/blog/2018/06/27/supporting-jest-open-source#%D1%8F%D0%BA%D0%B0-%D1%81%D1%82%D1%80%D1%83%D0%BA%D1%82%D1%83%D1%80%D0%B0-%D1%96%D0%BD%D1%96%D1%86%D1%96%D0%B0%D1%82%D0%B8%D0%B2%D0%B8" class="hash-link" aria-label="Direct link to Яка структура ініціативи" title="Direct link to Яка структура ініціативи" translate="no">​</a></h3>
<p>На цю мить Jest Open Collective керують три базові розробники з відкритим вихідним кодом(не з Facebook):</p>
<ul>
<li><a href="https://twitter.com/thymikee" target="_blank" rel="noopener noreferrer">Michal Pierzchala</a></li>
<li><a href="https://github.com/simenb" target="_blank" rel="noopener noreferrer">Simen Bekkhus</a></li>
<li><a href="https://twitter.com/rickhanlonii" target="_blank" rel="noopener noreferrer">Rick Hanlon</a></li>
</ul>
<p>Facebook був активним дописувачем Jest з вересня 2016 року, Simen приєднався до основної команди в червні 2017 року, Rick приєднався в січні. Вони відповідальні за встановлення бюджету, схвалення витрат і управління адміністраторами ініціативи. We have elected to keep <a href="https://twitter.com/cpojer" target="_blank" rel="noopener noreferrer">Christoph Nakazawa</a> as an adviser.</p>
<p>Є два рівні підтримки цього проєкту: Меценат і Спонсор.</p>
<h4 class="anchor anchorWithStickyNavbar_JmGV" id="меценати">Меценати<a href="https://jestjs.io/uk/blog/2018/06/27/supporting-jest-open-source#%D0%BC%D0%B5%D1%86%D0%B5%D0%BD%D0%B0%D1%82%D0%B8" class="hash-link" aria-label="Direct link to Меценати" title="Direct link to Меценати" translate="no">​</a></h4>
<p>Backers of the collective are individuals contributing at least $2/month. Ми додали список меценатів на головну сторінку Jest, README на github/yarn/npm та на сторінку учасників.</p>
<h4 class="anchor anchorWithStickyNavbar_JmGV" id="спонсори">Спонсори<a href="https://jestjs.io/uk/blog/2018/06/27/supporting-jest-open-source#%D1%81%D0%BF%D0%BE%D0%BD%D1%81%D0%BE%D1%80%D0%B8" class="hash-link" aria-label="Direct link to Спонсори" title="Direct link to Спонсори" translate="no">​</a></h4>
<p>Спонсори ініціативи - це особи та організації, що вносять щонайменше 100$/місяць. Ми додали логотипи спонсорів з посиланнями на їх сайти на головну сторінку Jest, README на github/yarn/npm та на сторінку учасників.</p>
<h3 class="anchor anchorWithStickyNavbar_JmGV" id="яка-ціль-ініціативи">Яка ціль ініціативи<a href="https://jestjs.io/uk/blog/2018/06/27/supporting-jest-open-source#%D1%8F%D0%BA%D0%B0-%D1%86%D1%96%D0%BB%D1%8C-%D1%96%D0%BD%D1%96%D1%86%D1%96%D0%B0%D1%82%D0%B8%D0%B2%D0%B8" class="hash-link" aria-label="Direct link to Яка ціль ініціативи" title="Direct link to Яка ціль ініціативи" translate="no">​</a></h3>
<p>Мета колективної роботи - підтримати розробників відкритого вихідного коду Jest для того, щоб зробити тестування приємним.</p>
<p>Для досягнення цієї мети, ми використаємо кошти на:</p>
<ul>
<li>Покриття витрат на поїздки для представників</li>
<li>Проведення зустрічей</li>
<li>Друк та розповсюдження тематичних матеріалів</li>
<li>Розробку та фінансування програми винагород (TBD)</li>
</ul>
<p>Це тільки початок, але ми прагнемо зробити все правильно. If you have ideas on how else we can support the community, or feedback on the structure of the collective, please reach out to us on <a href="https://twitter.com/jestjs_" target="_blank" rel="noopener noreferrer">twitter</a>!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="дякуємо">Дякуємо<a href="https://jestjs.io/uk/blog/2018/06/27/supporting-jest-open-source#%D0%B4%D1%8F%D0%BA%D1%83%D1%94%D0%BC%D0%BE" class="hash-link" aria-label="Direct link to Дякуємо" title="Direct link to Дякуємо" translate="no">​</a></h2>
<p>Врешті-решт, дякуємо усім, хто долучається до справ спільноти Jest та відкритого вихідного коду загалом. Ми безмежно вдячні за можливість покращувати тестування JavaScript разом з вами.</p>
<p>Основна команда Jest також хотіла б окремо подякувати Facebook Open Source за сприяння цій ініціативі.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 23: 🔥 Неймовірно Швидке Приємне Тестування]]></title>
            <link>https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing</link>
            <guid>https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing</guid>
            <pubDate>Tue, 29 May 2018 00:00:00 GMT</pubDate>
            <description><![CDATA[Сьогодні ми з радістю анонсуємо Jest 23, наш найбільший великий реліз станом на сьогодні! Разом із понад 100 учасниками, ми публікуємо купу оновлень та виправлень помилок. Дякуємо всім у спільноті за допомогу в Покращенні JavaScript Тестування.]]></description>
            <content:encoded><![CDATA[<p>Сьогодні ми з радістю анонсуємо Jest 23, наш найбільший великий реліз станом на сьогодні! Разом із понад 100 учасниками, ми публікуємо купу оновлень та виправлень помилок. Дякуємо всім у спільноті за допомогу в Покращенні JavaScript Тестування.</p>
<p>We would also like to welcome both <a href="https://babeljs.io/" target="_blank" rel="noopener noreferrer">Babel</a> and <a href="https://webpack.js.org/" target="_blank" rel="noopener noreferrer">webpack</a> to the Jest community! Після переходу з Mocha на Jest 23 Beta, webpack отримав зменшення загального часу виконання тестових наборів в 6 разів, з 13 хвилин до 2 хв 20 секунд. <a href="https://twitter.com/search?q=%23blazingmeansgood" target="_blank" rel="noopener noreferrer">#blazingmeansgood</a></p>
<p>Ось деякі з Jest 23 новинок і принципових змін.</p>
<p>For a full list see the <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md" target="_blank" rel="noopener noreferrer">changelog</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="і�нтерактивний-режим-знімка">Інтерактивний режим знімка<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D1%96%D0%BD%D1%82%D0%B5%D1%80%D0%B0%D0%BA%D1%82%D0%B8%D0%B2%D0%BD%D0%B8%D0%B9-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC-%D0%B7%D0%BD%D1%96%D0%BC%D0%BA%D0%B0" class="hash-link" aria-label="Direct link to Інтерактивний режим знімка" title="Direct link to Інтерактивний режим знімка" translate="no">​</a></h2>
<p>Ми додали нову опцію меню спостереження за замовчуванням під назвою Інтерактивний режим знімка. Цей новий режим дозволяє вам проходитись через кожен невдалий знімок в кожному провальному наборі, аби переглянути та обрати оновити або пропустити кожен окремо.</p>
<p><img decoding="async" loading="lazy" alt="Interactive snapshot mode in action" src="https://jestjs.io/uk/assets/images/23-interactive-3b2c2f9ec0fecc4effbc03fbc3ad1963.gif" width="1004" height="732" class="img_SS3x"></p>
<p>See the Interactive Snapshot Mode docs <a href="https://jestjs.io/uk/docs/snapshot-testing#interactive-snapshot-mode">here</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="матчери-властивостей-знімків">Матчери властивостей знімків<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D0%BC%D0%B0%D1%82%D1%87%D0%B5%D1%80%D0%B8-%D0%B2%D0%BB%D0%B0%D1%81%D1%82%D0%B8%D0%B2%D0%BE%D1%81%D1%82%D0%B5%D0%B9-%D0%B7%D0%BD%D1%96%D0%BC%D0%BA%D1%96%D0%B2" class="hash-link" aria-label="Direct link to Матчери властивостей знімків" title="Direct link to Матчери властивостей знімків" translate="no">​</a></h2>
<p>Часто об'єкти, які ви знімаєте, містять згенеровані значення, такі як дати та ID. Jest тепер дозволяє передавати властивості в матчери знімків, які визначають структуру даних замість конкретних значень. Ці матчери властивостей будуть перевірені перш ніж серіалізувати тип матчера (замість значення), надаючи вам послідовні результати знімків виконання тестів.</p>
<p><img decoding="async" loading="lazy" alt="Snapshot Property Matchers" src="https://jestjs.io/uk/assets/images/23-snapshot-matchers-aa63fd590f453650a67eaa0d99f678e3.png" width="2236" height="1177" class="img_SS3x"></p>
<p>See the updated <code>toMatchSnapshot</code> <a href="https://jestjs.io/uk/docs/expect#tomatchsnapshotpropertymatchers-snapshotname">docs</a> or the Property Matcher <a href="https://jestjs.io/uk/docs/snapshot-testing#property-matchers">guide</a> for more information.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="користувальницькі-асинхронні-матчери">Користувальницькі асинхронні матчери<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D1%83%D0%B2%D0%B0%D0%BB%D1%8C%D0%BD%D0%B8%D1%86%D1%8C%D0%BA%D1%96-%D0%B0%D1%81%D0%B8%D0%BD%D1%85%D1%80%D0%BE%D0%BD%D0%BD%D1%96-%D0%BC%D0%B0%D1%82%D1%87%D0%B5%D1%80%D0%B8" class="hash-link" aria-label="Direct link to Користувальницькі асинхронні матчери" title="Direct link to Користувальницькі асинхронні матчери" translate="no">​</a></h2>
<p>We now support asynchronous matchers with <code>expect.extends</code>! Async matchers return a Promise so that you can <code>await</code> for the matcher to resolve. Для прикладу:</p>
<p><img decoding="async" loading="lazy" alt="Custom asynchronous matchers in action" src="https://jestjs.io/uk/assets/images/23-async-matchers-91183e14fbce836540d2079f145dbe97.png" width="2230" height="876" class="img_SS3x"></p>
<p>Docs available <a href="https://jestjs.io/uk/docs/expect#expectextendmatchers">here</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="користувацькі-асиметричні-матчери">Користувацькі асиметричні матчери<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D1%83%D0%B2%D0%B0%D1%86%D1%8C%D0%BA%D1%96-%D0%B0%D1%81%D0%B8%D0%BC%D0%B5%D1%82%D1%80%D0%B8%D1%87%D0%BD%D1%96-%D0%BC%D0%B0%D1%82%D1%87%D0%B5%D1%80%D0%B8" class="hash-link" aria-label="Direct link to Користувацькі асиметричні матчери" title="Direct link to Користувацькі асиметричні матчери" translate="no">​</a></h2>
<p>Асиметричні матчери є відмінним інструментом, якщо ви дбаєте тільки про асиметричну рівність. Наприклад, коли ліва сторона повинна бути об'єктом з деяким підмножиною властивостей праворуч замість точного збігу. Jest надає ряд вбудованих асиметричних матчерів, і в цьому релізі ми додаємо користувацькі асиметричні матчери.</p>
<p><img decoding="async" loading="lazy" alt="Custom asymmetric matchers in action" src="https://jestjs.io/uk/assets/images/23-asymmetric-matchers-12a593708f9e4cec91225d63c49e959e.png" width="2230" height="1012" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="jest-each">Jest Each<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#jest-each" class="hash-link" aria-label="Direct link to Jest Each" title="Direct link to Jest Each" translate="no">​</a></h2>
<p><a href="https://twitter.com/mattphillipsio" target="_blank" rel="noopener noreferrer">@mattphillipsio</a> has donated the <code>jest-each</code> package to Jest Core (thanks Matt!). <code>jest-each</code> is a library inspired by <a href="https://yarnpkg.com/en/package/mocha-each" target="_blank" rel="noopener noreferrer"><code>mocha-each</code></a> and <a href="http://spockframework.org/spock/docs/1.1/data_driven_testing.html#data-tables" target="_blank" rel="noopener noreferrer">Spock Data Tables</a> which allows you to define a table of test cases, and then run a test for each row with the specified column values. We support both array types and template literals for all flavors of <code>describe</code> and <code>test</code>. Docs are available <a href="https://jestjs.io/uk/docs/api#testeachtable-name-fn">here</a>, and for those not on Jest 23 yet, we're still publishing <a href="https://yarnpkg.com/en/package/jest-each" target="_blank" rel="noopener noreferrer"><code>jest-each</code></a> separately!</p>
<p><img decoding="async" loading="lazy" alt="jest-each in action" src="https://jestjs.io/uk/assets/images/23-jest-each-3d938745102750ad491139ea700842ab.png" width="2230" height="1304" class="img_SS3x"></p>
<p>Huge shout out to Prettier for <a href="https://github.com/prettier/prettier/pull/4423" target="_blank" rel="noopener noreferrer">fixing</a> the table formatting so quickly (<a href="https://prettier.io/blog/2018/05/23/1.13.0.html#format-new-describeeach-table-in-jest-23-4423-by-ikatyang" target="_blank" rel="noopener noreferrer">see Prettier 1.13</a>)!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="нові-матчери">Нові матчери<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D0%BD%D0%BE%D0%B2%D1%96-%D0%BC%D0%B0%D1%82%D1%87%D0%B5%D1%80%D0%B8" class="hash-link" aria-label="Direct link to Нові матчери" title="Direct link to Нові матчери" translate="no">​</a></h2>
<p>We only add matchers to core if we believe they will be useful to a large amount of people in the Jest community, and leave the majority of matchers to the community (see <a href="https://yarnpkg.com/en/package/jest-extended" target="_blank" rel="noopener noreferrer">jest-extended</a>). Деякі матчери потрапили в основний склад з Jest 23:</p>
<ul>
<li>nthCalledWith</li>
<li>toReturn</li>
<li>toReturnTimes</li>
<li>toReturnWith</li>
<li>lastReturnedWith</li>
<li>nthReturnedWith</li>
<li>toStrictEqual</li>
</ul>
<p><img decoding="async" loading="lazy" alt="New matchers in action" src="https://jestjs.io/uk/assets/images/23-new-matchers-8aaaad14f7dc524a46b99503b6ede43b.png" width="2230" height="1276" class="img_SS3x"></p>
<p>See the updated expect docs <a href="https://jestjs.io/uk/docs/expect">here</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="налагодження-зависання-тестів">Налагодження зависання тестів<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D0%BD%D0%B0%D0%BB%D0%B0%D0%B3%D0%BE%D0%B4%D0%B6%D0%B5%D0%BD%D0%BD%D1%8F-%D0%B7%D0%B0%D0%B2%D0%B8%D1%81%D0%B0%D0%BD%D0%BD%D1%8F-%D1%82%D0%B5%D1%81%D1%82%D1%96%D0%B2" class="hash-link" aria-label="Direct link to Нал�агодження зависання тестів" title="Direct link to Налагодження зависання тестів" translate="no">​</a></h2>
<p>Розповсюджена проблема, яку ми помітили, стосується моменту зависання Jest після виконання тестів. Зазвичай, це стається через програмний код, який залишає відкриті елементи керування, заважаючи завершенню роботи Jest. In the past, users have resorted to <code>--forceExit</code> to fix (not recommended).</p>
<p>Аби допомогти відстежувати подібні проблеми, відтепер ми знаходимо моменти, на яких Jest не завершує свою роботу:</p>
<p><img decoding="async" loading="lazy" alt="Detecting hanging tests" src="https://jestjs.io/uk/assets/images/23-hanging-before-867f8f3cfd6d67bb5ce37bf11f053749.png" width="2236" height="780" class="img_SS3x"></p>
<p>And we offer a new flag <code>--detectOpenHandles</code> to help find the open handles:</p>
<p><img decoding="async" loading="lazy" alt="Running detectOpenHandles" src="https://jestjs.io/uk/assets/images/23-hanging-after-4f446e62ff117f6ae7f669d56057d206.png" width="2236" height="1106" class="img_SS3x"></p>
<p>See the updated CLI docs <a href="https://jestjs.io/uk/docs/cli#detectopenhandles">here</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="плагіни-режиму-спостереження">Плагіни режиму спостереження<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D0%BF%D0%BB%D0%B0%D0%B3%D1%96%D0%BD%D0%B8-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC%D1%83-%D1%81%D0%BF%D0%BE%D1%81%D1%82%D0%B5%D1%80%D0%B5%D0%B6%D0%B5%D0%BD%D0%BD%D1%8F" class="hash-link" aria-label="Direct link to Плагіни режиму спостереження" title="Direct link to Плагіни режиму спостереження" translate="no">​</a></h2>
<p>Ми повністю переписали систему режиму спостереження, що дозволить додавати користувацькі плагіни в цей режим. Тепер плагіни режиму спостереження дозволяють підключатись в події Jest та надавати користувацькі опції в Меню режиму спостереження. All of the default Watch Mode prompts are implemented as plugins in this system, and the docs to create your own are available <a href="https://jestjs.io/uk/docs/watch-plugins">here</a>.</p>
<p>With this change, we're also now able to bring back typeahead support as a Watch Mode Plugin via <a href="https://yarnpkg.com/en/package/jest-watch-typeahead" target="_blank" rel="noopener noreferrer">jest-watch-typeahead</a>!</p>
<p><img decoding="async" loading="lazy" alt="Typeahead plugin in action" src="https://jestjs.io/uk/assets/images/23-typeahead-b16e5a1f51f3b3852df9fcc508c920d1.gif" width="1001" height="731" class="img_SS3x"></p>
<p>See <a href="https://github.com/jest-community/jest-watch-typeahead" target="_blank" rel="noopener noreferrer">jest-watch-typeahead</a> for documentation and install instructions. Huge thank you to <a href="https://twitter.com/rogeliog" target="_blank" rel="noopener noreferrer">@rogeliog</a> for the new watch mode plugin system and the jest-watch-typeahead plugin!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="важливі-зміни">Важливі Зміни<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D0%B2%D0%B0%D0%B6%D0%BB%D0%B8%D0%B2%D1%96-%D0%B7%D0%BC%D1%96%D0%BD%D0%B8" class="hash-link" aria-label="Direct link to Важливі Зміни" title="Direct link to Важливі Зміни" translate="no">​</a></h2>
<p>Як і в кожному великому релізі, ми здійснюємо кілька змін для внесення більших змін в майбутньому, а також для того, щоб вивести досвід тестування на новий рівень. Ось список найбільших змін:</p>
<ul>
<li><strong>Require test descriptions and functions</strong>: We're now failing tests that do not include both a function and a description.</li>
<li><strong>Remove undefined props from React snapshots</strong>: Smaller snapshots and proper React behavior.</li>
<li><strong>Remove deprecations</strong>: We removed mapCoverage since it's no longer needed. Additionally, we removed <code>jest.genMockFunction</code> and <code>jest.genMockFn</code> since these are the same as <code>jest.fn</code>.</li>
<li><strong>Add snapshot names to failures</strong>: We added the snapshot name (if provided) to the snapshot failure message so it's easier to find the snapshot that's failing.</li>
<li><strong>Replace mock timestamps</strong>: We replaced mock timestamps with invocationCallOrder since two or mocks may often have the same timestamp, making it impossible to test the call order.</li>
<li><strong>Add results to mock snapshots</strong>: We added mock function call results to snapshots so that both the calls and the results of the invocation are tracked.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="інші-покращення">Інші покращення<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D1%96%D0%BD%D1%88%D1%96-%D0%BF%D0%BE%D0%BA%D1%80%D0%B0%D1%89%D0%B5%D0%BD%D0%BD%D1%8F" class="hash-link" aria-label="Direct link to Інші покращення" title="Direct link to Інші покращення" translate="no">​</a></h2>
<ul>
<li><strong>Watch mode coverage</strong>: Coverage is now limited to only the files tested in watch mode or when using <code>--onlyChanged</code> and <code>--findRelatedTests</code>.</li>
<li><strong>Version documentation</strong>: We added docs for each minor release back to Jest 22, and have removed all of the “Requires Jest X.X+” from the docs.</li>
<li><strong>Better snapshot summaries</strong>: We overhauled the Snapshot Summary output to make obsolete snapshots more informative.</li>
<li><strong>Better stack traces</strong>: We added stack traces to asynchronous errors, timeout errors, expect.assertions, and thrown non-errors. Також ми вказуємо стовпець в коді фрейму!</li>
<li><strong>Better React 16 support</strong>: Adds snapshot support for <code>React.Fragment</code>, <code>React.forwardRef</code>, and <code>React.createContext</code>.</li>
<li><strong>Track mock return and throw values</strong>: Adds <code>mock.results</code> that contains the return value or thrown value for each mock call.</li>
<li><strong>Blazing 🔥</strong>: We've added a blazing badge to the README to indicate that Jest is blazing good.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="саміт-jest">Саміт Jest<a href="https://jestjs.io/uk/blog/2018/05/29/jest-23-blazing-fast-delightful-testing#%D1%81%D0%B0%D0%BC%D1%96%D1%82-jest" class="hash-link" aria-label="Direct link to Саміт Jest" title="Direct link to Саміт Jest" translate="no">​</a></h2>
<p>Минулого тижня команда Jest зустрілася на саміті Jest у Facebook, Лондон, де розробляли та випустили Jest 23, оголосивши про Jest Open Collective та виступивши з кількома промовами:</p>
<ul>
<li><strong>Christoph Nakazawa</strong> – <a href="https://www.youtube.com/watch?v=cAKYQpTC7MA" target="_blank" rel="noopener noreferrer">Intro</a></li>
<li><strong>Aaron Abramov</strong> – <a href="https://youtu.be/cAKYQpTC7MA?t=440" target="_blank" rel="noopener noreferrer">Writing Meaningful Tests</a></li>
<li><strong>Rick Hanlon II</strong> – <a href="https://youtu.be/cAKYQpTC7MA?t=1881" target="_blank" rel="noopener noreferrer">Blazing Fast Snapshot Testing in Jest 23</a></li>
<li><strong>Simen Bekkhus</strong> – <a href="https://youtu.be/cAKYQpTC7MA?t=2990" target="_blank" rel="noopener noreferrer">Jest's Delightful Error Messages</a></li>
<li><strong>Matt Phillips</strong> – <a href="https://youtu.be/cAKYQpTC7MA?t=3852" target="_blank" rel="noopener noreferrer">Level up your Jest experience with community packages</a></li>
<li><strong>Michele Bertoli</strong> – <a href="https://youtu.be/cAKYQpTC7MA?t=4582" target="_blank" rel="noopener noreferrer">Snapshot all the things</a></li>
<li><strong>Jordan Eldredge</strong> – <a href="https://youtu.be/cAKYQpTC7MA?t=5185" target="_blank" rel="noopener noreferrer">Webamp: Learn by imitating</a></li>
</ul>
<p>Full talk is available <a href="https://www.youtube.com/watch?v=cAKYQpTC7MA" target="_blank" rel="noopener noreferrer">here</a>.</p>
<p>Все пройшло чудово, ми змогли персонально зустрітись з лондонською частиною спільноти. Дякуємо усім, хто долучився, за вашу постійну підтримку! Очікуйте наш наступний допис щодо Jest Open Collective та планів на майбутнє.</p>
<p><em>As always, this release couldn't have been possible without you, the JavaScript community. Ми безмежно вдячні за можливість покращувати тестування JavaScript разом з вами. If you'd like to contribute to Jest, please don't hesitate to reach out to us on</em> <em><a href="https://github.com/jestjs/jest" target="_blank" rel="noopener noreferrer">GitHub</a> or on</em> <em><a href="https://discord.gg/j6FKKQQrW9" target="_blank" rel="noopener noreferrer">Discord</a>.</em></p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 22: Refinements & Custom Runners]]></title>
            <link>https://jestjs.io/uk/blog/2017/12/18/jest-22</link>
            <guid>https://jestjs.io/uk/blog/2017/12/18/jest-22</guid>
            <pubDate>Mon, 18 Dec 2017 00:00:00 GMT</pubDate>
            <description><![CDATA[Сьогодні ми анонсуємо нову версію Jest, в якій вдосконалено майже всі частини Jest з метою забезпечення міцнішої бази для тестування. Разом зі спільнотою, ми внесли широкий ряд змін, які допоможуть вам отримати більше від Jest. We are also graduating the custom runners feature out of the experimental stage and added a new package, jest-worker, for parallelizing work across multiple processes. We have compiled a list of highlights below but make sure to check out the (as always) massive changelog.]]></description>
            <content:encoded><![CDATA[<p>Сьогодні ми анонсуємо нову версію Jest, в якій вдосконалено майже всі частини Jest з метою забезпечення міцнішої бази для тестування. Разом зі спільнотою, ми внесли широкий ряд змін, які допоможуть вам отримати більше від Jest. We are also graduating the custom runners feature out of the experimental stage and added a new package, <code>jest-worker</code>, for parallelizing work across multiple processes. We have compiled a list of highlights below but make sure to check out the (as always) <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md" target="_blank" rel="noopener noreferrer">massive changelog</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="good-bye-node-4--welcome-jsdom-11">Good bye Node 4 &amp; welcome JSDOM 11<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#good-bye-node-4--welcome-jsdom-11" class="hash-link" aria-label="Direct link to Good bye Node 4 &amp; welcome JSDOM 11" title="Direct link to Good bye Node 4 &amp; welcome JSDOM 11" translate="no">​</a></h2>
<p>Цього релізу ми припиняємо підтримку Node 4, головним чином тому, що завершує їх підтримку одна з наших головних залежностей JSDOM. Jest now comes out of the box with JSDOM 11 which features better support for SVGs, <code>requestAnimationFrame</code>, <code>URL</code> and <code>URLSearchParams</code> built in, and <a href="https://github.com/jsdom/jsdom/blob/master/Changelog.md" target="_blank" rel="noopener noreferrer">much more</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="custom-runners--easy-parallelization-with-jest-worker">Custom Runners + Easy parallelization with <code>jest-worker</code><a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#custom-runners--easy-parallelization-with-jest-worker" class="hash-link" aria-label="Direct link to custom-runners--easy-parallelization-with-jest-worker" title="Direct link to custom-runners--easy-parallelization-with-jest-worker" translate="no">​</a></h2>
<p>В Jest 21 ми представили концепцію користувацьких виконавців Jest. Since then, Rogelio, one of Jest's core contributors, built a number of useful runners: If you have many existing tests written using another framework but you'd like to immediately benefit from Jest's features, check out <a href="https://yarnpkg.com/en/package/jest-runner-mocha" target="_blank" rel="noopener noreferrer">jest-runner-mocha</a>. If you have a large codebase that needs linting, <a href="https://twitter.com/lencioni/status/907398856756695040" target="_blank" rel="noopener noreferrer">you may get a significant speedup</a> if you run eslint within Jest using <a href="https://yarnpkg.com/en/package/jest-runner-eslint" target="_blank" rel="noopener noreferrer">jest-runner-eslint</a>.</p>
<p>Щоб отримати глибинний контроль над важкими завданнями паралелізації (наприклад, перетворення файлів або спостереження за файловою системою), ми розробили нову відповідну бібліотеку. We developed a modern, Promise-based module with an approachable API, called <code>jest-worker</code>, that allows you to delegate to child processes those intensive functions. As <code>jest-worker</code>, like any other Jest package, is a part of the Jest platform, you can use it however you like even without ever using Jest itself. You'll find more in the documentation <a href="https://yarnpkg.com/en/package/jest-worker" target="_blank" rel="noopener noreferrer">here</a>.</p>
<p>To get a better understanding of custom runners and Jest as a platform, make sure to check out Rogelio's talk from Reactive Conf 2017: <a href="https://www.youtube.com/watch?v=NtjyeojAOBs" target="_blank" rel="noopener noreferrer">Jest as a Platform</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="код-фрейму-в-тестових-помилках">Код фрейму в тестових помилках<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#%D0%BA%D0%BE%D0%B4-%D1%84%D1%80%D0%B5%D0%B9%D0%BC%D1%83-%D0%B2-%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2%D0%B8%D1%85-%D0%BF%D0%BE%D0%BC%D0%B8%D0%BB%D0%BA%D0%B0%D1%85" class="hash-link" aria-label="Direct link to Код фрейму в тестових помилках" title="Direct link to Код фрейму в тестових помилках" translate="no">​</a></h2>
<p>Щоб легше визначити, яке твердження є провальним для вашого тесту, ми додали код фрейму, який показує твердження, що має допомогти сфокусуватися на вашому коді. Приклад тесту:</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#6b2e85">test</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'some test'</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:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword" style="color:#297a29">function</span><span class="token plain"> </span><span class="token function" style="color:#6b2e85">someFunctionWhichShouldThrow</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></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token keyword control-flow" style="color:#297a29">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token boolean" style="color:#36acaa">false</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></span><span class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token keyword control-flow" style="color:#297a29">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#297a29">new</span><span class="token plain"> </span><span class="token class-name">Error</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></span><span 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></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token keyword control-flow" style="color:#297a29">return</span><span class="token plain"> </span><span class="token string" style="color:#c21325">'success!'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span 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></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#6b2e85">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">someFunctionWhichShouldThrow</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:#6b2e85">toThrow</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></span><span 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></span></code></pre></div></div>
<p>В Jest 21, ми виводили наступну помилку:</p>
<p><img decoding="async" loading="lazy" alt="failure in Jest 21" src="https://jestjs.io/uk/assets/images/22-failure-21-a7eb296a994d13405234955abd946adc.png" width="972" height="650" class="img_SS3x"></p>
<p>В Jest 22, ми додали код фрейму, який дає більше контексту провальному твердженню. Ми також очистили стекові сліди, частково прибравши безлад.</p>
<p><img decoding="async" loading="lazy" alt="failure in Jest 22" src="https://jestjs.io/uk/assets/images/22-failure-22-2dfad8dd25ea9b4b87a9359658f5eab4.png" width="938" height="744" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="полегшене-тестування-помилок-в-асинхронному-коді">Полегшене тестування помилок в асинхронному коді<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#%D0%BF%D0%BE%D0%BB%D0%B5%D0%B3%D1%88%D0%B5%D0%BD%D0%B5-%D1%82%D0%B5%D1%81%D1%82%D1%83%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F-%D0%BF%D0%BE%D0%BC%D0%B8%D0%BB%D0%BE%D0%BA-%D0%B2-%D0%B0%D1%81%D0%B8%D0%BD%D1%85%D1%80%D0%BE%D0%BD%D0%BD%D0%BE%D0%BC%D1%83-%D0%BA%D0%BE%D0%B4%D1%96" class="hash-link" aria-label="Direct link to Полегшене тестування помилок в асинхронному коді" title="Direct link to Полегшене тестування помилок в асинхронному коді" translate="no">​</a></h2>
<p>You can now use <code>toThrow</code> and <code>toThrowErrorMatchingSnapshot</code> on promise rejections in the same way you can on synchronous errors.</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#297a29">async</span><span class="token plain"> </span><span class="token keyword" style="color:#297a29">function</span><span class="token plain"> </span><span class="token function" style="color:#6b2e85">throwingFunction</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></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#297a29">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#297a29">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'This failed'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span 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></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#6b2e85">test</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'asynchronous rejection'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#297a29">async</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:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#297a29">await</span><span class="token plain"> </span><span class="token function" style="color:#6b2e85">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token function" style="color:#6b2e85">throwingFunction</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 punctuation" style="color:#393A34">.</span><span class="token property-access">rejects</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">toThrowErrorMatchingSnapshot</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></span><span 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></span></code></pre></div></div>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="асинхронні-тестові-середовища">Асинхронні тестові середовища<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#%D0%B0%D1%81%D0%B8%D0%BD%D1%85%D1%80%D0%BE%D0%BD%D0%BD%D1%96-%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2%D1%96-%D1%81%D0%B5%D1%80%D0%B5%D0%B4%D0%BE%D0%B2%D0%B8%D1%89%D0%B0" class="hash-link" aria-label="Direct link to Асинхронні тестові середовища" title="Direct link to Асинхронні тестові середовища" translate="no">​</a></h2>
<p>When <a href="https://github.com/GoogleChrome/puppeteer/" target="_blank" rel="noopener noreferrer">Puppeteer</a>, a way of programmatically interacting with a real Chromium Browser, was announced by the Google Chrome team in August, many wanted to be able to use Jest to write their tests running them in Chrome. Спільнота допомогла нам зробити це можливим завдяки асинхронному тестовому середовищу. We are still working on making this experience as good as possible, but please see <a href="https://jestjs.io/uk/docs/puppeteer">this guide</a> for how to use Puppeteer with Jest, starting today.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="експериментальна-діагностика-витоку">Експериментальна діагностика витоку<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#%D0%B5%D0%BA%D1%81%D0%BF%D0%B5%D1%80%D0%B8%D0%BC%D0%B5%D0%BD%D1%82%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0-%D0%B4%D1%96%D0%B0%D0%B3%D0%BD%D0%BE%D1%81%D1%82%D0%B8%D0%BA%D0%B0-%D0%B2%D0%B8%D1%82%D0%BE%D0%BA%D1%83" class="hash-link" aria-label="Direct link to Експериментальна діагностика витоку" title="Direct link to Експериментальна діагностика витоку" translate="no">​</a></h2>
<p>We added an experimental <code>--detectLeaks</code> setting to Jest that will let you know if your internal environment instance is leaked after a test execution. Також буде попередження, коли ваш набір тестів вимагає файл після завершення тесту; це означає, що ви не дочекались всіх асинхронних операцій або залишили щось, що не було належним чином очищено. This will however not discover leaks in user land code, only in test land code; although the technology used behind it can help you (see <code>jest-leak-detector</code>). If you are reporting a bug about Jest's memory usage, please provide a repro where <code>--detectLeaks</code> will make the test suite fail. We <a href="https://github.com/jestjs/jest/pull/4970" target="_blank" rel="noopener noreferrer">started building a better sandboxing mechanism</a> for Jest but it's not ready yet to be enabled by default. Якщо ви хотіли б допомогти, будь ласка, зв'яжіться з нами через discord!</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="покращення-режиму-спостереження">Покращення режиму спостереження<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#%D0%BF%D0%BE%D0%BA%D1%80%D0%B0%D1%89%D0%B5%D0%BD%D0%BD%D1%8F-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC%D1%83-%D1%81%D0%BF%D0%BE%D1%81%D1%82%D0%B5%D1%80%D0%B5%D0%B6%D0%B5%D0%BD%D0%BD%D1%8F" class="hash-link" aria-label="Direct link to Покращення режиму спостереження" title="Direct link to Покращення режиму спостереження" translate="no">​</a></h2>
<p>When using watch mode, there is now a way to <a href="https://github.com/jestjs/jest/pull/4886" target="_blank" rel="noopener noreferrer">focus only on tests that previously failed</a>. В цьому режимі Jest не буде повторно запускати успішні тести, що повинно допомогти вам усунути всі проблеми в тестах. Additionally, <a href="https://github.com/jestjs/jest/pull/4841" target="_blank" rel="noopener noreferrer">we added a plugin system to watch mode</a>. By adding modules to <code>watchPlugins</code> in your configuration you can extend the features of the watch mode.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="підтримка-babel-7">Підтримка Babel 7<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#%D0%BF%D1%96%D0%B4%D1%82%D1%80%D0%B8%D0%BC%D0%BA%D0%B0-babel-7" class="hash-link" aria-label="Direct link to Підтримка Babel 7" title="Direct link to Підтримка Babel 7" translate="no">​</a></h2>
<p>Jest використовує Babel, щоб робити покриття коду та покращені функції імітації. Jest 22 також підтримує майбутній Babel 7. You'll find more in the documentation <a href="https://jestjs.io/uk/docs/getting-started#using-babel">here</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="вдосконалення-функцій-імітацій">Вдосконалення функцій-імітацій<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#%D0%B2%D0%B4%D0%BE%D1%81%D0%BA%D0%BE%D0%BD%D0%B0%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D1%96%D0%B9-%D1%96%D0%BC%D1%96%D1%82%D0%B0%D1%86%D1%96%D0%B9" class="hash-link" aria-label="Direct link to Вдосконалення функцій-імітацій" title="Direct link to Вдосконалення функцій-імітацій" translate="no">​</a></h2>
<p>Jest 22 вносить декілька змін в функції-імітації, що робить їх ще простішими. Firstly, we added a <a href="https://jestjs.io/uk/docs/mock-function-api#mockfnmocknamevalue"><code>mockName</code></a> property allowing you to name your mocks, which is useful in assertion failures. We have also made the Jest mock function serializable in <code>pretty-format</code>, meaning that you can snapshot test mocks. In Jest 21, <code>expect(jest.fn()).toMatchSnapshot()</code> would serialize to <code>[Function]</code>, in Jest 22, you might get something like this:</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#6b2e85">test</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'my mocking test'</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:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword" style="color:#297a29">const</span><span class="token plain"> mock </span><span class="token operator" style="color:#888">=</span><span class="token plain"> jest</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">fn</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:#6b2e85">mockName</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'myMock'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#6b2e85">mock</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'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 literal-property property" style="color:#82772c">foo</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token string" style="color:#c21325">'bar'</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></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#6b2e85">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">mock</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:#6b2e85">toMatchSnapshot</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></span><span 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></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Serializes to:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">exports</span><span class="token punctuation" style="color:#393A34">[</span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token template-string string" style="color:#c21325">my mocking test 1</span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#888">=</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token template-string string" style="color:#c21325"></span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">[MockFunction myMock] {</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  "calls": Array [</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">    Array [</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">      "hello",</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">      Object {</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">        "foo": "bar",</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">      },</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">    ],</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  ],</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">}</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325"></span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre></div></div>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="деталі-jest-21">Деталі Jest 21<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#%D0%B4%D0%B5%D1%82%D0%B0%D0%BB%D1%96-jest-21" class="hash-link" aria-label="Direct link to Деталі Jest 21" title="Direct link to Деталі Jest 21" translate="no">​</a></h2>
<p>Jest 21 був випущений у вересні, і ми, на жаль, не випустили відповідний допис. Тож тримайте короткий огляд основних змін версії 21:</p>
<ol>
<li><strong>Use expect and jest-mock in the browser:</strong> <a href="https://github.com/mjackson" target="_blank" rel="noopener noreferrer">Michael Jackson</a> donated his excellent <a href="https://github.com/mjackson/expect" target="_blank" rel="noopener noreferrer"><code>expect</code></a> package to the Jest project. As part of that transition, the Jest core team, with much help from <a href="https://github.com/skovhus/" target="_blank" rel="noopener noreferrer">Kenneth Skovhus</a>, made both <code>jest-matchers</code> (renamed to <code>expect</code>) and <code>jest-mock</code> work in browsers. This means that while you cannot use Jest itself in browsers (<a href="https://github.com/jestjs/jest/issues/848" target="_blank" rel="noopener noreferrer">yet</a>), you can use its awesome assertions and mocks for instance as replacements for Chai and Sinon running in Mocha tests. If you are migrating from earlier <code>expect</code> to the new Jest-powered <code>expect</code>, you can use <a href="https://github.com/skovhus/jest-codemods/" target="_blank" rel="noopener noreferrer"><code>jest-codemods</code></a> to automate the migration.</li>
<li><strong>MIT License:</strong> We changed Jest's license to MIT. <em>Yay!</em></li>
<li><strong>Fail test suites on async errors:</strong> Jest used to have a bug that made it crash when errors were thrown in certain parts of async code. Це було виправлено розробниками спільноти.</li>
<li><strong>Faster startup:</strong> With Jest 21 we fine tuned Jest's startup to be more than 50% faster. Для малих тестів завжди були проблемою великі витрати часу Jest, але тепер це не має стримувати вас від використання Jest.</li>
</ol>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="jest-community">Jest Community<a href="https://jestjs.io/uk/blog/2017/12/18/jest-22#jest-community" class="hash-link" aria-label="Direct link to Jest Community" title="Direct link to Jest Community" translate="no">​</a></h2>
<p>Спільнота Jest тяжко працює, щоб забезпечувати ще кращий досвід тестування. Це окремі проєкти від основного Jest, але ми хочемо виділити деяких наших особистих улюбленців.</p>
<ul>
<li><a href="https://github.com/americanexpress/jest-image-snapshot" target="_blank" rel="noopener noreferrer">jest-image-snapshot</a> – custom matcher to compare images with snapshots by American Express developers</li>
<li><a href="https://github.com/kulshekhar/ts-jest" target="_blank" rel="noopener noreferrer">ts-jest</a> – all you need to successfully run Jest within TypeScript project by <a href="https://github.com/kulshekhar/ts-jest" target="_blank" rel="noopener noreferrer">@kulshekhar</a></li>
<li><a href="https://github.com/skovhus/jest-codemods/" target="_blank" rel="noopener noreferrer">jest-codemods</a> – migrate your tests from other frameworks to Jest with ease</li>
<li><a href="https://github.com/negativetwelve/jest-plugins" target="_blank" rel="noopener noreferrer">jest-plugins</a> – a new community project oriented around simplifying setting up test environment for specific tools, like React, or providing some handy utilities</li>
</ul>
<p>We'd also like to announce that recently we launched a new place for high quality Jest additions – <a href="https://github.com/jest-community" target="_blank" rel="noopener noreferrer">jest-community</a>. It's a new GitHub organization already featuring our favorite projects, like <a href="https://github.com/jest-community/vscode-jest" target="_blank" rel="noopener noreferrer">vscode-jest</a>, <a href="https://github.com/jest-community/jest-extended" target="_blank" rel="noopener noreferrer">jest-extended</a>, to name a few, curated by Jest maintainers and collaborators. We've even migrated our <a href="https://github.com/jest-community/eslint-plugin-jest" target="_blank" rel="noopener noreferrer">eslint-plugin-jest</a> there, and already see some great contributions, which are published independently at a faster pace.</p>
<p><img decoding="async" loading="lazy" alt="Jest Community" src="https://jestjs.io/uk/assets/images/22-community-2b148613668cb789c0215015bfbc10c7.png" width="2004" height="1090" class="img_SS3x"></p>
<p>Спільні проєкти єдиної організації є чудовим способом експериментувати в таких речах, як автоматизований реліз, який ми б хотіли розглянути в контексті Jest. Вони також дають нам змогу вносити в них однакові речі, як то формат README (дякуємо спільноті webpack за ідею), спрощуючи їх вивчення та використання.</p>
<p>Якщо у вас є щось круте щоб поділитися, ви можете зв'язатися з нами! Ми були б раді розділити з вами ваш проєкт.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 20: 💖 Delightful Testing & 🏃🏽 Multi-Project-Runner]]></title>
            <link>https://jestjs.io/uk/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner</link>
            <guid>https://jestjs.io/uk/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner</guid>
            <pubDate>Sat, 06 May 2017 00:00:00 GMT</pubDate>
            <description><![CDATA[A few months ago we announced Jest 19 which came with major new features and was the biggest Jest release until today. Jest 20 має подвійну кількість змін у порівнянні з попередньою версією та містить повністю перероблений виконавець тестів, додається новий тестовий API. Новий реліз надає новий рівень персоналізації та конфігурації проєктів, при цьому оновлення не забере багато часу. Beyond Painless JavaScript Testing, we believe Jest is now delivering a Delightful JavaScript Testing experience. Розглянемо глибше найкращі нові функції та зміни:]]></description>
            <content:encoded><![CDATA[<p>A few months ago we announced <a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements">Jest 19</a> which came with major new features and was the biggest Jest release until today. Jest 20 має подвійну кількість змін у порівнянні з попередньою версією та містить повністю перероблений виконавець тестів, додається новий тестовий API. Новий реліз надає новий рівень персоналізації та конфігурації проєктів, при цьому оновлення не забере багато часу. Beyond Painless JavaScript Testing, we believe Jest is now delivering a <strong>Delightful JavaScript Testing experience</strong>. Розглянемо глибше найкращі нові функції та зміни:</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="multi-project-runner--configuration-overhaul">Multi-Project-Runner &amp; Configuration Overhaul<a href="https://jestjs.io/uk/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner#multi-project-runner--configuration-overhaul" class="hash-link" aria-label="Direct link to Multi-Project-Runner &amp; Configuration Overhaul" title="Direct link to Multi-Project-Runner &amp; Configuration Overhaul" translate="no">​</a></h2>
<p>До сьогодні, Jest міг працювати лише в одному проєкті за раз. Це може перевантажувати процес, якщо ви працюєте над багатьма малими проєктами, кожен з яких має власні налаштування та конфігурацію. В Jest 20, ми повністю переписали виконавець тестів для одночасного запуску багато проєктів в одному екземплярі Jest; наприклад, якщо ви працюєте з фронтом React frontend і беком node.js. Here is a video of Jest running tests for <a href="https://github.com/facebook/react" target="_blank" rel="noopener noreferrer">React</a>, <a href="https://github.com/facebook/relay" target="_blank" rel="noopener noreferrer">Relay</a>, <a href="https://github.com/yarnpkg/yarn" target="_blank" rel="noopener noreferrer">Yarn</a> and Jest all at the same time:</p>
<p><img decoding="async" loading="lazy" alt="multi-runner" src="https://jestjs.io/uk/assets/images/20-multi-runner-bca686433b2cb63c147951eedce67538.gif" width="839" height="520" class="img_SS3x"></p>
<p>Наразі Jest згортає інструкцію використання після першого запуску тестів, щоб зберегти вертикальний простір в терміналі.</p>
<p>Також, ми повністю змінили спосіб роботи конфігураційної системи всередині Jest. Тепер ви можете передати будь-який параметр конфігурації через консоль для перезапису тих, що зазначені у вашому файлі конфігурації. Along with that, we changed Jest to look for a <code>jest.config.js</code> file by default which means you are now able to define a Jest configuration using JavaScript as well as being able to configure it through <code>package.json</code> like before. Після додавання всіх цих нових функцій, ви тепер можете поєднувати Jest ще більш дієвими способами. Наприклад, якщо ви хочете дізнатись, які тести з вказаного набору змінених файлів з декількох проєктів в монорепозиторії Jest буде запускати, ви можете поєднати аргументи командного рядка наступним чином:</p>
<div class="language-bash codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-bash codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token plain">$ jest </span><span class="token parameter variable" style="color:#1373c2">--projects</span><span class="token plain"> projectA projectB </span><span class="token parameter variable" style="color:#1373c2">--listTests</span><span class="token plain"> </span><span class="token parameter variable" style="color:#1373c2">--findRelatedTests</span><span class="token plain"> projectA/banana.js projectB/kiwi.js</span><br></span><span 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></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token string" style="color:#c21325">"projectA/banana.test.js"</span><span class="token plain">,</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token string" style="color:#c21325">"projectB/kiwi.test.js"</span><span class="token plain">,</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token string" style="color:#c21325">"projectB/pineapple.test.js"</span><span class="token plain">,</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre></div></div>
<p>Це особливо корисно для систем безперервної інтеграції (CI), де ви можете запустити лише підмножину тестів для запитів на злиття, аби запобігти виконанню тисячі тестів при кожній маленькій зміні.</p>
<p>Нарешті, тепер покриття коду зіставляється належним чином при використанні TypeScript; діє запуск неперевірених файлів у робочих процесах, що значно прискорює цю функцію.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="new--improved-testing-apis">New &amp; Improved Testing APIs<a href="https://jestjs.io/uk/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner#new--improved-testing-apis" class="hash-link" aria-label="Direct link to New &amp; Improved Testing APIs" title="Direct link to New &amp; Improved Testing APIs" translate="no">​</a></h2>
<p>Ми зробили низку доповнень та вдосконалень до API тестів, що допоможе з написанням ефективніших тестів. Ми хотіли б зазначити, що всі ці вдосконалення були повністю зроблені членами спільноти!</p>
<ul>
<li><strong>Better async testing:</strong> Added new async/Promise support through resolves/rejects modifiers on expect: <code>expect(Promise(…)).resolves.toEqual(…)</code>. <a href="https://jestjs.io/uk/docs/expect#resolves">See documentation</a>.</li>
<li><strong>Expect <code>n</code> assertions:</strong> Along with the existing <code>expect.assertions(n)</code>, the new <code>expect.hasAssertions()</code> can be used to ensure a test has at least one assertion.</li>
<li><strong>Lint Plugin:</strong> A <code>valid-expect</code> rule was added to <code>eslint-plugin-jest</code> to ensure that an assertion is called after invoking <code>expect</code>. This will prevent mistakes like a stray <code>expect(banana);</code> with a missing assertion call.</li>
<li><strong>Pretty-Format Plugins:</strong> A number of new pretty-format plugins were added to Jest. We now pretty-print <a href="https://github.com/facebook/immutable-js/" target="_blank" rel="noopener noreferrer">Immutable.js</a> data structures and HtmlElements in assertion failures and snapshots.</li>
<li><strong>Custom Environment:</strong> It is now possible to add a <code>@jest-environment node|jsdom</code> annotation to the doc-block comment of a test file to use a test environment different from the default for individual tests.</li>
</ul>
<p>Ось приклад того, як всі нові API разом покращують процес тестування:</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token doc-comment comment" style="color:#999988;font-style:italic">/**</span><br></span><span class="token-line" style="color:#393A34"><span class="token doc-comment comment" style="color:#999988;font-style:italic"> * </span><span class="token doc-comment comment keyword" style="color:#297a29;font-style:italic">@jest-environment</span><span class="token doc-comment comment" style="color:#999988;font-style:italic"> node</span><br></span><span class="token-line" style="color:#393A34"><span class="token doc-comment comment" style="color:#999988;font-style:italic"> */</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#6b2e85">test</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'compares apples and bananas'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#297a29">async</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:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  expect</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">hasAssertions</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><span class="token comment" style="color:#999988;font-style:italic">// Ensure this test has at least one assertion.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#297a29">await</span><span class="token plain"> </span><span class="token function" style="color:#6b2e85">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token known-class-name class-name">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">resolve</span><span class="token punctuation" style="color:#393A34">(</span><span class="token maybe-class-name">Immutable</span><span class="token punctuation" style="color:#393A34">.</span><span class="token known-class-name class-name">Map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token literal-property property" style="color:#82772c">apples</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token number" style="color:#1373c2">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#82772c">bananas</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token number" style="color:#1373c2">2</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 punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span 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 property-access">resolves</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">toEqual</span><span class="token punctuation" style="color:#393A34">(</span><span class="token maybe-class-name">Immutable</span><span class="token punctuation" style="color:#393A34">.</span><span class="token known-class-name class-name">Map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token literal-property property" style="color:#82772c">apples</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token number" style="color:#1373c2">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#82772c">bananas</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token number" style="color:#1373c2">3</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 punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#6b2e85">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'banana'</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 comment" style="color:#999988;font-style:italic">// valid-expect in eslint-plugin-jest will show an error.</span><span class="token plain"></span><br></span><span 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></span></code></pre></div></div>
<p>Цей приклад виведе подібну помилку:</p>
<p><img decoding="async" loading="lazy" alt="testing-apis" src="https://jestjs.io/uk/assets/images/20-testing-apis-d1ff5d93e72e0aedc768bd40bd179e96.png" width="2164" height="1638" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="важливі-зміни">Важливі Зміни<a href="https://jestjs.io/uk/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner#%D0%B2%D0%B0%D0%B6%D0%BB%D0%B8%D0%B2%D1%96-%D0%B7%D0%BC%D1%96%D0%BD%D0%B8" class="hash-link" aria-label="Direct link to Важливі Зміни" title="Direct link to Важливі Зміни" translate="no">​</a></h2>
<p>Як і в кожному великому релізі, ми здійснюємо ряд змін для внесення більших змін в майбутньому, а також для того, щоб вивести досвід тестування на новий рівень. Цього разу ми спробували зламати лише API, які не мають вплинути на більшості користувачів Jest:</p>
<ul>
<li><strong>Fork of Jasmine 2.5:</strong> We finally decided to fork Jasmine itself and take ownership over Jest's own test runner. Це дозволить нам поліпшити усі аспекти досвіду модульного тестування у майбутньому, але зараз ми зосереджені на поступовому переписі та зменшенні API. If you see a test breaking as a result of a Jasmine API that is now missing, there should be an equivalent feature on the <code>jest</code> or <code>expect</code> objects. Ми видалили багато функцій, які зазвичай не використовуються в більшості баз коду.</li>
<li><strong>New Snapshots on CI:</strong> Snapshots must always be committed along with the test and the modules they are testing. We changed Jest to not save new snapshots automatically in Continuous Integration (CI) environments or when the <code>--ci</code> flag is specified. To overwrite this behavior, which is generally not recommended, the <code>--updateSnapshot</code> flag can be used.</li>
<li><strong>Babel-Polyfill:</strong> Jest used to load <code>babel-polyfill</code> automatically when using babel-jest which resulted in memory leaks inside of Jest. In most versions of node, it is not necessary to load <code>babel-polyfill</code> so we removed this auto-inclusion and instead changed Jest to only include <code>regenerator-runtime</code> by default, which is commonly used to support async/await in older versions of Node.js. If you need <code>babel-polyfill</code>, you can manually require it in your setup files.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="інші-покращення">Інші покращення<a href="https://jestjs.io/uk/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner#%D1%96%D0%BD%D1%88%D1%96-%D0%BF%D0%BE%D0%BA%D1%80%D0%B0%D1%89%D0%B5%D0%BD%D0%BD%D1%8F" class="hash-link" aria-label="Direct link to Інші покращення" title="Direct link to Інші покращення" translate="no">​</a></h2>
<ul>
<li><strong>Documentation:</strong> Documentation is critical to share best practices and teach everyone how to write effective tests which will lead to better software. За останні кілька тижнів ми також розширили документацію Jest розділом Часті запитання щодо тестування знімками, керівництвом з інформацією про використання Jest з поширеними JavaScript бібліотеками, а також задокументованими новими функціями, описаними вище.</li>
<li><strong>Translations:</strong> We are now asking for your help to <a href="https://crowdin.com/project/jest-v2" target="_blank" rel="noopener noreferrer">translate the Jest documentation</a> to make it easier for people to learn how to use Jest.</li>
<li><strong>Custom Reporters:</strong> Jest now supports custom test reporters through the <code>reporters</code> configuration option. Ви нарешті можете налаштувати вивід Jest та інтегрувати його з іншими інструментами, генеруючи звіти в різних форматах, як-то XML. <a href="https://jestjs.io/uk/docs/configuration#reporters-array-modulename-modulename-options">See documentation</a>.</li>
<li><strong>Codebase Health:</strong> It was only possible iterate so quickly in Jest because we spent a significant amount of time on the health of the codebase. We were one of the early adopters of <a href="https://github.com/prettier/prettier" target="_blank" rel="noopener noreferrer">prettier</a>, we notably increased flow coverage, forked Jasmine to improve our test runner library and we rewrote and refactored significant portions of Jest itself to set up Jest for success in the future.</li>
<li><strong>Bugfixes:</strong> As always, we made plenty of bugfixes in Jest. The full changelog can be found in the <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md#jest-2000" target="_blank" rel="noopener noreferrer">Jest repository</a>.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="дискусії-щодо-jest">Дискусії щодо Jest<a href="https://jestjs.io/uk/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner#%D0%B4%D0%B8%D1%81%D0%BA%D1%83%D1%81%D1%96%D1%97-%D1%89%D0%BE%D0%B4%D0%BE-jest" class="hash-link" aria-label="Direct link to Дискусії щодо Jest" title="Direct link to Дискусії щодо Jest" translate="no">​</a></h2>
<p>Останнім часом основна команда Jest та інші розробники почали більше розповідати про Jest та досвід роботи на конференціях:</p>
<ul>
<li>Rogelio Guzman did a talk about <a href="https://www.youtube.com/watch?time_continue=416&amp;v=HAuXJVI_bUs" target="_blank" rel="noopener noreferrer">Jest Snapshots and Beyond</a> at React Conf.</li>
<li>I spoke about <a href="https://developers.facebook.com/videos/f8-2017/building-high-quality-javascript-tools/" target="_blank" rel="noopener noreferrer">Building High-Quality JavaScript Tools</a> at Facebook's F8 conference.</li>
</ul>
<p><em>As always, this release couldn't have been possible without you, the JavaScript community. Ми безмежно вдячні за можливість покращувати тестування JavaScript разом з вами. If you'd like to contribute to Jest, please don't hesitate to reach out to us on <a href="https://github.com/jestjs/jest" target="_blank" rel="noopener noreferrer">GitHub</a> or on <a href="https://discord.gg/j6FKKQQrW9" target="_blank" rel="noopener noreferrer">Discord</a>.</em></p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[🃏 Jest 19: Immersive Watch Mode & Test Platform Improvements]]></title>
            <link>https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements</link>
            <guid>https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements</guid>
            <pubDate>Tue, 21 Feb 2017 00:00:00 GMT</pubDate>
            <description><![CDATA[Сьогодні ми із задоволенням публікуємо версію 19 платформи для тестування Jest. Це найбільший реліз Jest, який ми коли-небудь публікували, і ми дуже раді показати вам, що ми створили за останні два місяці:]]></description>
            <content:encoded><![CDATA[<p>Сьогодні ми із задоволенням публікуємо версію 19 платформи для тестування Jest. Це найбільший реліз Jest, який ми коли-небудь публікували, і ми дуже раді показати вам, що ми створили за останні два місяці:</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="поглиблений-режим-спостереження">Поглиблений режим спостереження<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#%D0%BF%D0%BE%D0%B3%D0%BB%D0%B8%D0%B1%D0%BB%D0%B5%D0%BD%D0%B8%D0%B9-%D1%80%D0%B5%D0%B6%D0%B8%D0%BC-%D1%81%D0%BF%D0%BE%D1%81%D1%82%D0%B5%D1%80%D0%B5%D0%B6%D0%B5%D0%BD%D0%BD%D1%8F" class="hash-link" aria-label="Direct link to Поглиблений режим спостереження" title="Direct link to Поглиблений режим спостереження" translate="no">​</a></h2>
<p>We <a href="https://github.com/jestjs/jest/pull/2362" target="_blank" rel="noopener noreferrer">completely rewrote the watch mode</a> to make it instant and more extensible. В результаті, отримуємо поглиблений досвід використання: тести одразу перезапускаються після змін у файлі та ми полегшили вибір правильних тестів.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="�оновлення-знімків">Оновлення знімків<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#%D0%BE%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D0%B7%D0%BD%D1%96%D0%BC%D0%BA%D1%96%D0%B2" class="hash-link" aria-label="Direct link to Оновлення знімків" title="Direct link to Оновлення знімків" translate="no">​</a></h2>
<p>Ми зробили декілька змін у форматі знімку. Ми не вносимо такі зміни часто і розглядаємо їх додавання, лише якщо вони дійсно покращать роботу знімків. Так само як додавання номера версії знімку, ми акумулювали ряд змін, які ми вже деякий час хотіли внести до формату:</p>
<ul>
<li>We dropped the “test” prefix in snapshot names from top level <code>test</code> or <code>it</code> calls.</li>
<li>Ми покращили вивід елементів React, аби отримувати менше змін при змінах властивостей елементу.</li>
<li>Ми покращили механізм обходження символів для кращої захищеності.</li>
</ul>
<p>До цього:</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token plain">exports</span><span class="token punctuation" style="color:#393A34">[</span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token template-string string" style="color:#c21325">test snap 1</span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#888">=</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token template-string string" style="color:#c21325"></span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">&lt;header&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  &lt;h1&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">    Jest \"19\"</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  &lt;/h1&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  &lt;Subtitle</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">    name="Painless JavaScript Testing" /&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">&lt;/header&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325"></span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre></div></div>
<p>Після (немає префікса "test", кращий JSX рендеринг, заголовок версії):</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Jest Snapshot v1, https://goo.gl/fbAQLP</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">exports</span><span class="token punctuation" style="color:#393A34">[</span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token template-string string" style="color:#c21325">snap 1</span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#888">=</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token template-string string" style="color:#c21325"></span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">&lt;header&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  &lt;h1&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">    Jest "19"</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  &lt;/h1&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  &lt;Subtitle</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">    name="Painless JavaScript Testing"</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  /&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">&lt;/header&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325"></span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre></div></div>
<p>Ми вирішили, що прийшов час ввести версії знімків, щоб гарантувати, що всі розробники використовують сумісні версії Jest. Ось як ми попереджаємо вас про необхідність оновлення вашого знімку:</p>
<p><img decoding="async" loading="lazy" alt="snapshot-version" src="https://jestjs.io/uk/assets/images/19-snapshot-version-457ba31d60bb428bee970eb1ed529408.png" width="1396" height="311" class="img_SS3x"></p>
<p>Переконайтеся, що ви скасували всі локальні зміни перед оновленням, аби зробити перехід безпроблемним і переконатись, що жодні небажані зміни від провальних тестів не були додані в нові знімки.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="вдосконалений-вивід-пропущених-тестів">Вдосконалений вивід пропущених тестів<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#%D0%B2%D0%B4%D0%BE%D1%81%D0%BA%D0%BE%D0%BD%D0%B0%D0%BB%D0%B5%D0%BD%D0%B8%D0%B9-%D0%B2%D0%B8%D0%B2%D1%96%D0%B4-%D0%BF%D1%80%D0%BE%D0%BF%D1%83%D1%89%D0%B5%D0%BD%D0%B8%D1%85-%D1%82%D0%B5%D1%81%D1%82%D1%96%D0%B2" class="hash-link" aria-label="Direct link to Вдосконалений вивід пропущених тестів" title="Direct link to Вдосконалений вивід пропущених тест�ів" translate="no">​</a></h2>
<p>Пропущені тести виводяться єдиним рядком замість виводу кожного окремого тесту при тестуванні в детальному режимі або одному наборі. Сподіваємось, це дозволить вам сфокусуватися на важливих тестах. Також це займає значно менше простору!</p>
<p><img decoding="async" loading="lazy" alt="skipped-tests" src="https://jestjs.io/uk/assets/images/19-skipped-tests-a51df1988c39d164bc52200a71459ec6.png" width="616" height="341" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="нові-аргументи-cli">Нові аргументи CLI<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#%D0%BD%D0%BE%D0%B2%D1%96-%D0%B0%D1%80%D0%B3%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D0%B8-cli" class="hash-link" aria-label="Direct link to Нові аргументи CLI" title="Direct link to Нові аргументи CLI" translate="no">​</a></h2>
<p>Jest 19 публікується з двома новими аргументами покриття, які ви можете запустити з командного рядка:</p>
<ul>
<li><code>--collectCoverageFrom</code></li>
<li><code>--coverageDirectory</code></li>
</ul>
<p>Тепер ми також виводимо неприпустимі аргументи CLI, не ігноруючи їх. But we've got your back with helpful error message like the one below, e.g. when you try running <code>jest --watc</code>:</p>
<p><img decoding="async" loading="lazy" alt="cli-error" src="https://jestjs.io/uk/assets/images/19-cli-error-0a7455fcb6a1a01013633cc34575a1b8.png" width="738" height="214" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="expect-improvements"><code>expect</code> Improvements<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#expect-improvements" class="hash-link" aria-label="Direct link to expect-improvements" title="Direct link to expect-improvements" translate="no">​</a></h2>
<ul>
<li><a href="https://jestjs.io/uk/docs/expect#expectaddsnapshotserializerserializer"><code>expect.addSnapshotSerializer</code></a></li>
<li><a href="https://jestjs.io/uk/docs/expect#expectstringcontainingstring"><code>expect.stringContaining</code></a></li>
<li><a href="https://jestjs.io/uk/docs/jest-object#jestspyonobject-methodname"><code>jest.spyOn</code></a></li>
</ul>
<p>We're close to almost full feature parity with the <code>expect</code> npm package. <a href="https://twitter.com/mjackson" target="_blank" rel="noopener noreferrer">Michael Jackson</a>, the author of the package, agreed to <a href="https://github.com/jestjs/jest/issues/1679" target="_blank" rel="noopener noreferrer">donate</a> it to the Jest project, which means that <code>jest-matchers</code> will be renamed to <code>expect</code>. Since our version of <code>expect</code> is not intended to be fully compatible, <a href="https://twitter.com/Vjeux" target="_blank" rel="noopener noreferrer">Christopher Chedeau</a> is working on a codemod to make the transition painless. Christopher also worked on a number of improvements to <code>jest-matchers</code> which enables it to be used outside of Jest and even <a href="https://github.com/jestjs/jest/pull/2795" target="_blank" rel="noopener noreferrer">works inside browsers</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="eslint-plugin-jest--our-very-own-eslint-plugin"><a href="https://github.com/jest-community/eslint-plugin-jest" target="_blank" rel="noopener noreferrer">eslint-plugin-jest</a> – our very own ESLint plugin<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#eslint-plugin-jest--our-very-own-eslint-plugin" class="hash-link" aria-label="Direct link to eslint-plugin-jest--our-very-own-eslint-plugin" title="Direct link to eslint-plugin-jest--our-very-own-eslint-plugin" translate="no">​</a></h2>
<p>Thanks to <a href="https://twitter.com/jonnykim" target="_blank" rel="noopener noreferrer">Jonathan Kim</a> Jest finally has its own official ESLint plugin. Він містить три правила:</p>
<ul>
<li><a href="https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-disabled-tests.md" target="_blank" rel="noopener noreferrer">no-disabled-tests</a> - this rule prevents you from accidentally committing disabled tests.</li>
<li><a href="https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-focused-tests.md" target="_blank" rel="noopener noreferrer">no-focused-tests</a> - this rule prevents you from committing focused tests which would disable all other tests in the same suite.</li>
<li><a href="https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-identical-title.md" target="_blank" rel="noopener noreferrer">no-identical-title</a> - disallows identical titles in test names.</li>
</ul>
<p>You can install it using <code>npm install --save-dev eslint-plugin-jest</code> or <code>yarn add --dev eslint eslint-plugin-jest</code> and it can be enabled by adding <code>{"plugins": ["jest"]}</code> to your eslint configuration.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="new-public-package-jest-validate">New public package: <a href="https://github.com/jestjs/jest/tree/main/packages/jest-validate" target="_blank" rel="noopener noreferrer">jest-validate</a><a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#new-public-package-jest-validate" class="hash-link" aria-label="Direct link to new-public-package-jest-validate" title="Direct link to new-public-package-jest-validate" translate="no">​</a></h2>
<p>Коли ми переробили код перевірки та нормалізації для конфігурації Jest, ми були настільки задоволені новими повідомленнями про помилки, що ми виділили його в окремий модуль, щоб поділитися з іншими. With Jest 19 we welcome <code>jest-validate</code> to our self-sustained packages family.</p>
<p><code>jest-validate</code> is a generic configuration validation tool that helps you with warnings, errors and deprecation messages in your JavaScript tool. Він також здатен показувати зручні для користувачів приклади правильних налаштувань та надає простий, але потужний API. Сподіваємось, це стане гарним доповненням до ваших проєктів!</p>
<p><img decoding="async" loading="lazy" alt="validate" src="https://jestjs.io/uk/assets/images/19-validate-68120eda9a55dbbb0325ea6deea0e973.png" width="1200" height="729" class="img_SS3x"></p>
<p>We're happy to announce that <code>jest-validate</code> is validating config options of <a href="https://github.com/jlongster/prettier" target="_blank" rel="noopener noreferrer">prettier</a> since <a href="https://github.com/jlongster/prettier/blob/main/CHANGELOG.md#0120" target="_blank" rel="noopener noreferrer">v0.12</a>. Додавайте його до свого проєкту, спробуйте, надішліть нам відгук та допомагайте з покращенням, роблячи запити на ухвалення змін на GitHub.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="вдосконалені-асиметричні-матчери">Вдосконалені асиметричні матчери<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#%D0%B2%D0%B4%D0%BE%D1%81%D0%BA%D0%BE%D0%BD%D0%B0%D0%BB%D0%B5%D0%BD%D1%96-%D0%B0%D1%81%D0%B8%D0%BC%D0%B5%D1%82%D1%80%D0%B8%D1%87%D0%BD%D1%96-%D0%BC%D0%B0%D1%82%D1%87%D0%B5%D1%80%D0%B8" class="hash-link" aria-label="Direct link to Вдосконалені асиметричні матчери" title="Direct link to Вдосконалені асиметричні матчери" translate="no">​</a></h2>
<p>Ми перемістили асиметричну реалізацію матчерів з Jasmine в Jest, що дало змогу надалі покращувати користувацький досвід. As a result, asymmetric matchers are now pretty-printed nicely, we added the new <a href="https://jestjs.io/uk/docs/expect#expectstringcontainingstring"><code>expect.stringContaining()</code></a> matcher and we also paired them with <a href="https://jestjs.io/uk/docs/expect#tomatchobjectobject"><code>expect.toMatchObject()</code></a> so you can use the best of both:</p>
<p><img decoding="async" loading="lazy" alt="asymmetric-matchers" src="https://jestjs.io/uk/assets/images/19-asymmetric-matchers-a96ddf170a7a1cdf31a7ffe36374d172.png" width="586" height="222" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="кращі-ручні-імітації">Кращі ручні імітації<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#%D0%BA%D1%80%D0%B0%D1%89%D1%96-%D1%80%D1%83%D1%87%D0%BD%D1%96-%D1%96%D0%BC%D1%96%D1%82%D0%B0%D1%86%D1%96%D1%97" class="hash-link" aria-label="Direct link to Кращі ручні імітації" title="Direct link to Кращі ручні імітації" translate="no">​</a></h2>
<p>З останнім релізом, ручні імітації нарешті працюють з вкладеними каталогами. For example <code>__mocks__/react-native/Libraries/Text/Text.js</code> will now work as expected and mock the correct module. We also fixed issues with virtual mocks and transitive dependencies and improved <code>moduleNameMapper</code> to not overwrite mocks when many patterns map to the same file.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="важливі-зміни">Важливі Зміни<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#%D0%B2%D0%B0%D0%B6%D0%BB%D0%B8%D0%B2%D1%96-%D0%B7%D0%BC%D1%96%D0%BD%D0%B8" class="hash-link" aria-label="Direct link to Важливі Зміни" title="Direct link to Важливі Зміни" translate="no">​</a></h2>
<p>As a part of our cleanups and fixes we removed the <code>mocksPattern</code> configuration option which was never officially supported. We also renamed the <code>testPathDirs</code> configuration option to <code>roots</code> which better explains what the option can be used for. The default configuration for <code>roots</code> is <code>["&lt;rootDir&gt;"]</code> and can be customized to include any number of directories. Параметр конфігурації rootDir завжди використовувався в основному як маркер для інших параметрів, тож це перейменування має зробити процес налаштування Jest зрозумілішим.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="оновлена-документація">Оновлена документація<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#%D0%BE%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B0-%D0%B4%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D0%B0%D1%86%D1%96%D1%8F" class="hash-link" aria-label="Direct link to Оновлена документація" title="Direct link to Оновлена документація" translate="no">​</a></h2>
<p>As you may have already seen, <a href="https://twitter.com/hectorramos" target="_blank" rel="noopener noreferrer">Hector Ramos</a> and <a href="https://twitter.com/lacker" target="_blank" rel="noopener noreferrer">Kevin Lacker</a> gave Jest's documentation a fresh new look. Ми змінили спосіб організації сайту, тепер Документація та API представлені окремими сторінками:</p>
<ul>
<li>Under <a href="https://jestjs.io/uk/docs/getting-started#content">Docs</a> you can find an introduction to Jest, including <a href="https://jestjs.io/uk/docs/getting-started#content">Getting Started</a> or <a href="https://jestjs.io/uk/docs/asynchronous#content">Testing Asynchronous Code</a> and handy guides like <a href="https://jestjs.io/uk/docs/snapshot-testing#content">Snapshot Testing</a>, <a href="https://jestjs.io/uk/docs/tutorial-react-native#content">Testing React Native App</a>, <a href="https://jestjs.io/uk/docs/webpack#content">Using with webpack</a> or <a href="https://jestjs.io/uk/docs/migration-guide#content">Migrating to Jest</a> and many more!</li>
<li>The <a href="https://jestjs.io/uk/docs/api">API</a> section on the other hand lists all available methods exposed by Jest: the <code>expect</code> and <code>jest</code> objects, mock functions, globals, along with configuration options from <em>package.json</em> and from the CLI.</li>
</ul>
<p>The homepage was completely redesigned to be more descriptive of what Jest is about: “<em>Zero configuration testing platform</em>”. Ми також переконані, що новий вигляд зручніший для мобільних пристроїв. And for those using RSS – we finally provide a <a href="https://jestjs.io/blog/feed.xml" target="_blank" rel="noopener noreferrer">feed for our blog</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="оновлення-спільноти">Оновлення спільноти<a href="https://jestjs.io/uk/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements#%D0%BE%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D1%81%D0%BF%D1%96%D0%BB%D1%8C%D0%BD%D0%BE%D1%82%D0%B8" class="hash-link" aria-label="Direct link to Оновлення спільноти" title="Direct link to Оновлення спільноти" translate="no">​</a></h2>
<ul>
<li>We really loved this talk: “<a href="https://www.youtube.com/watch?v=tvy0bSgwtTo" target="_blank" rel="noopener noreferrer">Introduction to Jest</a>“ by Vas Boroviak.</li>
<li>Follow <a href="http://twitter.com/jestjs_" target="_blank" rel="noopener noreferrer">@jestjs_ on Twitter</a>.</li>
<li>Команда Jest Core збирається раз на тиждень, щоб обговорити поточні та майбутні проблеми. Якщо ви б хотіли працювати над Jest, надішліть нам декілька запитів на злиття і приєднуйтеся до наших щотижневих командних зустрічей.</li>
<li>The awesome engineers at Artsy wrote <a href="http://artsy.github.io/blog/2017/02/05/Front-end-JavaScript-at-Artsy-2017/" target="_blank" rel="noopener noreferrer">about Jest as part of their 2017 frontend stack</a>.</li>
<li>Stephen Scott wrote a detailed article about <a href="https://medium.freecodecamp.com/the-right-way-to-test-react-components-548a4736ab22" target="_blank" rel="noopener noreferrer">testing React components</a> in which he weighs the pros and cons of different approaches.</li>
<li><a href="https://medium.com/@kentaromiura_the_js_guy/jest-for-all-episode-1-vue-js-d616bccbe186#.r8ryxlw98" target="_blank" rel="noopener noreferrer">Using Jest with vue.js</a> got a lot easier after reading Cristian Carlesso's blog post.</li>
<li><a href="https://twitter.com/cpojer/status/825004258219130880" target="_blank" rel="noopener noreferrer">Michele Bertoli wrote a book about React Design Patterns and Best Practices</a> which features an entire section about Jest.</li>
<li>Improved <code>--notify</code> command that shows an operating system notification which <a href="https://github.com/jestjs/jest/pull/2727" target="_blank" rel="noopener noreferrer">can now also re-run tests from the notification</a>. Насправді це просто функція Jest, ми просто перевіряємо, чи ви все ще читаєте цей допис.</li>
<li>Jest is now part of <a href="https://twitter.com/mxstbr/status/820326656439177217" target="_blank" rel="noopener noreferrer">react-boilerplate</a>.</li>
<li>Read about the <a href="https://medium.com/@boriscoder/the-hidden-power-of-jest-matchers-f3d86d8101b0#.pn10z1pzx" target="_blank" rel="noopener noreferrer">hidden powers of Jest's matchers</a>.</li>
</ul>
<p>Finally, we are happy to announce that the <a href="https://github.com/avajs/ava" target="_blank" rel="noopener noreferrer">ava</a> test runner has adopted parts of the Jest platform and is now shipping with basic <a href="https://github.com/avajs/ava#snapshot-testing" target="_blank" rel="noopener noreferrer">snapshot support</a> and is using <a href="https://github.com/jestjs/jest/tree/main/packages/pretty-format" target="_blank" rel="noopener noreferrer">pretty-format</a>. Об'єднання тестової інфраструктури спрощує вивчення тестування додатків і дає нам змогу ділитися найкращими практиками. Ми з нетерпінням очікуємо побачити, чого ми можемо навчитись з наявних тестових бібліотек в майбутньому.</p>
<p>The full <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md#jest-1900" target="_blank" rel="noopener noreferrer">changelog can be found on GitHub</a>. Jest 19 was a true JavaScript community effort with <a href="https://github.com/jestjs/jest/graphs/contributors?from=2016-12-23&amp;to=2017-02-21&amp;type=c" target="_blank" rel="noopener noreferrer">17 people who contributed</a> to this release. Ми дякуємо кожному з вас за вашу допомогу в покращенні цього проєкту.</p>
<p><em>This blog post was written by <a href="https://twitter.com/rogeliog" target="_blank" rel="noopener noreferrer">Rogelio Guzman</a> and <a href="https://twitter.com/thymikee" target="_blank" rel="noopener noreferrer">Michał Pierzchała</a>.</em></p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Чудовий досвід для розробників]]></title>
            <link>https://jestjs.io/uk/blog/2017/01/30/a-great-developer-experience</link>
            <guid>https://jestjs.io/uk/blog/2017/01/30/a-great-developer-experience</guid>
            <pubDate>Mon, 30 Jan 2017 00:00:00 GMT</pubDate>
            <description><![CDATA[Ми віримо, що чудова документація має вирішальне значення для забезпечення позитивного досвіду для розробників. Документація має бути чіткою, лаконічною та корисною як для нових користувачів, так і для знавців технології. З думкою про це, нещодавно ми витратили деякий час на перероблення сайту Jest.]]></description>
            <content:encoded><![CDATA[<p>Ми віримо, що чудова документація має вирішальне значення для забезпечення позитивного досвіду для розробників. Документація має бути чіткою, лаконічною та корисною як для нових користувачів, так і для знавців технології. З думкою про це, нещодавно ми витратили деякий час на перероблення сайту Jest.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="покращені-документи">Покращені документи<a href="https://jestjs.io/uk/blog/2017/01/30/a-great-developer-experience#%D0%BF%D0%BE%D0%BA%D1%80%D0%B0%D1%89%D0%B5%D0%BD%D1%96-%D0%B4%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D0%B8" class="hash-link" aria-label="Direct link to Покращені документи" title="Direct link to Покращені документи" translate="no">​</a></h2>
<p>Одна з помітних змін - оновлена бічна панель. Документація тепер розподілена на три основні розділи: вступ до Jest, детальні посібники для функціонала та універсальна API довідка.</p>
<p>The <strong>Introduction</strong> section will guide you from installing Jest and writing your first case, to using Jest's matchers and testing async code. Якщо ви новачок в Jest або хочете швидко освіжити знання, ця частина швидко в цьому допоможе. If you've used Jest before and only need a quick reference on how it's installed, you need to go no further than the <a href="https://jestjs.io/uk/docs/getting-started">Getting Started</a> guide.</p>
<p>Once you feel comfortable using Jest, proceed to the advanced <strong>Guides</strong> section. The new <a href="https://jestjs.io/uk/docs/snapshot-testing">Snapshot Testing guide</a> covers everything you need to know about creating and maintaining snapshot test cases.</p>
<p>Також, ми повністю змінили нашу документацію API. You can now find detailed information on all of Jest's <a href="https://jestjs.io/uk/docs/api">Globals</a>, <a href="https://jestjs.io/uk/docs/expect">matchers</a>, and <a href="https://jestjs.io/uk/docs/cli">every flag</a> supported by the <code>jest</code> CLI.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="new-colors--website">New colors &amp; website<a href="https://jestjs.io/uk/blog/2017/01/30/a-great-developer-experience#new-colors--website" class="hash-link" aria-label="Direct link to New colors &amp; website" title="Direct link to New colors &amp; website" translate="no">​</a></h2>
<p>Кольори логотипу та сайту Jest вже давно здавались нам застарілими. Ми змінили кольори теми, яку ми використовуємо для Jest і суттєво змінили основну сторінку, зробивши її більш привабливою. Ми сподіваємось, що вам подобаються нові кольори та приклад сильних сторін Jest.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="хто-використовує-jest">Хто використовує Jest?<a href="https://jestjs.io/uk/blog/2017/01/30/a-great-developer-experience#%D1%85%D1%82%D0%BE-%D0%B2%D0%B8%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D0%BE%D0%B2%D1%83%D1%94-jest" class="hash-link" aria-label="Direct link to Хто використовує Jest?" title="Direct link to Хто використовує Jest?" translate="no">​</a></h2>
<p>We have created a <a href="https://jestjs.io/uk/">showcase of users</a> to highlight some of the companies that are using Jest. Ми вдячні усім цим компаніям за використання Jest для тестування власних вебсайтів, мобільних додатків та API. Якщо ви використовуєте Jest, перегляньте рекомендації на GitHub і надішліть нам свої запити на ухвалення змін!</p>
<div class="productShowcaseSection"><div class="logos"><img src="https://jestjs.io/img/logos/twitter.png" title="Twitter"><img src="https://jestjs.io/img/logos/pinterest.png" title="Pinterest"><img src="https://jestjs.io/img/logos/paypal.png" title="PayPal"><img src="https://jestjs.io/img/logos/ibm.png" title="IBM"><img src="https://jestjs.io/img/logos/spotify.png" title="Spotify"></div></div>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="jest-в-браузері">Jest в браузері<a href="https://jestjs.io/uk/blog/2017/01/30/a-great-developer-experience#jest-%D0%B2-%D0%B1%D1%80%D0%B0%D1%83%D0%B7%D0%B5%D1%80%D1%96" class="hash-link" aria-label="Direct link to Jest в браузері" title="Direct link to Jest в браузері" translate="no">​</a></h2>
<p>As highlighted <a href="https://jestjs.io/uk/blog/2016/12/15/2016-in-jest">last month</a>, it is now possible to use Jest directly in the browser using <a href="https://repl.it/languages/jest" target="_blank" rel="noopener noreferrer">repl.it</a>. Якщо ви бажаєте спробувати Jest перед встановленням, ви можете легко зробити це нижче або безпосередньо з головної сторінки Jest. Спробуйте!</p>
<div class="jest-repl"><iframe src="https://repl.it/@amasad/try-jest?lite=true"></iframe></div>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="як-долучитись">Як долучитись<a href="https://jestjs.io/uk/blog/2017/01/30/a-great-developer-experience#%D1%8F%D0%BA-%D0%B4%D0%BE%D0%BB%D1%83%D1%87%D0%B8%D1%82%D0%B8%D1%81%D1%8C" class="hash-link" aria-label="Direct link to Як долучитись" title="Direct link to Як долучитись" translate="no">​</a></h2>
<p>Це лише початок. Перегляньте документацію та не соромтеся надіслати нам свій відгук. If you find a mistake in the docs or you just want to let us know what needs to be documented better, please tweet at us at <a href="https://twitter.com/jestjs_" target="_blank" rel="noopener noreferrer">@jestjs_</a>, <a href="https://github.com/jestjs/jest/issues" target="_blank" rel="noopener noreferrer">open an issue on GitHub</a>, or send us a PR by clicking "Edit on GitHub" at the top of the doc.</p>
<p>Ми з нетерпінням чекаємо наступний рік та раді чути вас!</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2016 в Jest]]></title>
            <link>https://jestjs.io/uk/blog/2016/12/15/2016-in-jest</link>
            <guid>https://jestjs.io/uk/blog/2016/12/15/2016-in-jest</guid>
            <pubDate>Thu, 15 Dec 2016 00:00:00 GMT</pubDate>
            <description><![CDATA[2016 рік був дуже важливим для JavaScript тестування з Jest. Перші пів року ми переписували Jest і створювали надійну основу для значного підвищення продуктивності та допомоги в тестуванні JavaScript коду. We flow-typed the entire codebase, built a ton of integration tests for Jest itself and adopted lerna to turn Jest from a framework into a Painless JavaScript Testing platform.]]></description>
            <content:encoded><![CDATA[<p>2016 рік був дуже важливим для JavaScript тестування з Jest. Перші пів року ми переписували Jest і створювали надійну основу для значного підвищення продуктивності та допомоги в тестуванні JavaScript коду. We flow-typed the entire codebase, built a ton of integration tests for Jest itself and adopted <a href="https://lernajs.io/" target="_blank" rel="noopener noreferrer">lerna</a> to turn Jest from a framework into a <a href="https://github.com/jestjs/jest/tree/main/packages" target="_blank" rel="noopener noreferrer"><em>Painless JavaScript Testing platform</em></a>.</p>
<p>The newly created <a href="https://yarnpkg.com/en/package/react-test-renderer" target="_blank" rel="noopener noreferrer">react-test-renderer</a> finally enabled testing of react-native components. Through the jest-react-native preset (now merged directly into react-native) Jest now works out of the box for any React project and comes pre-configured in <a href="https://github.com/facebookincubator/create-react-app" target="_blank" rel="noopener noreferrer">create-react-app</a> and <a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer">react-native</a> projects. We integrated core pieces of Jest into <a href="https://github.com/facebook/react-native/tree/main/packager/react-packager/src" target="_blank" rel="noopener noreferrer">react-native's packager</a> and the completely new snapshot testing feature has since been used outside of Jest: It was integrated with React Storybook as “<a href="https://github.com/storybooks/storyshots" target="_blank" rel="noopener noreferrer">storyshots</a>” and is being adopted by other test runners like <a href="https://github.com/avajs/ava/pull/1113" target="_blank" rel="noopener noreferrer">ava</a>.</p>
<p>The <a href="https://github.com/jestjs/jest/tree/main/packages/pretty-format" target="_blank" rel="noopener noreferrer">pretty-format</a> project was rewritten with performance in mind to drive Jest's snapshot feature, was recently merged into Jest's monorepo and is also helpful in other <a href="https://github.com/avajs/ava/pull/1154" target="_blank" rel="noopener noreferrer">test runners</a>. На цей момент Jest презентує збірник різних ідей та рішень для тестування, а не єдину конкретну реалізацію тестового фреймворку.</p>
<p>I'd like to deeply thank all the people that have <a href="https://github.com/jestjs/jest/graphs/contributors?from=2016-01-01&amp;to=2016-12-14&amp;type=c" target="_blank" rel="noopener noreferrer">contributed to Jest this year</a>, both from the open source community and at Facebook: Dmitrii Abramov, Cristian Carlesso, Dan Abramov, Daniel Lo Nigro, Maxim Derbin, Evan Scott, Forbes Lindesay, Keyan Zhang and 60 more people. We'd also like to welcome <a href="https://twitter.com/thymikee" target="_blank" rel="noopener noreferrer">Michał Pierzchała (@thymikee)</a> as first official external contributor to Jest. Він провів чудову роботу з управління проблемами та PR-ами репозиторію. If you'd like to start contributing to Jest, we have a bunch of <a href="https://github.com/jestjs/jest/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+bug%22" target="_blank" rel="noopener noreferrer">good first tasks</a> and we are always happy to help on our <a href="https://discord.gg/j6FKKQQrW9" target="_blank" rel="noopener noreferrer">discord channel</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="replit-with-jest-integration"><a href="http://repl.it/" target="_blank" rel="noopener noreferrer">repl.it</a> with Jest integration<a href="https://jestjs.io/uk/blog/2016/12/15/2016-in-jest#replit-with-jest-integration" class="hash-link" aria-label="Direct link to replit-with-jest-integration" title="Direct link to replit-with-jest-integration" translate="no">​</a></h2>
<p>Amjad Massad <a href="https://repl.it/languages/jest" target="_blank" rel="noopener noreferrer">built a Jest container</a> so you can now try out Jest directly in the browser. З цього моменту, ви можете використовувати його при створенні проблем на GitHub, що має допомогти швидше розв'язувати проблеми. Amjad and Haya are building <a href="http://repl.it/" target="_blank" rel="noopener noreferrer">repl.it</a> to democratize programming by building powerful yet simple tools and platforms for educators, learners, and developers. They are also <a href="https://repl.it/site/jobs" target="_blank" rel="noopener noreferrer">hiring talented engineers</a>!</p>
<div class="jest-repl"><iframe src="https://repl.it/languages/jest?lite=true"></iframe></div>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="оновлення-спільноти">Оновлення спільноти<a href="https://jestjs.io/uk/blog/2016/12/15/2016-in-jest#%D0%BE%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D1%81%D0%BF%D1%96%D0%BB%D1%8C%D0%BD%D0%BE%D1%82%D0%B8" class="hash-link" aria-label="Direct link to Оновлення спільноти" title="Direct link to Оновлення спільноти" translate="no">​</a></h2>
<p>We feel incredibly humbled that 100+ companies <a href="https://twitter.com/cpojer/status/803965499407290369" target="_blank" rel="noopener noreferrer">have adopted Jest</a> in the last six months. Такі компанії, як Twitter, Pinterest, Paypal, nytime, IBM (Watson), Spotify, eBay, SoundCloud, Intuit, FormidableLabs, Automattic, Trivago та Microsoft повністю або частково перейшли на Jest через потреби в тестуванні JavaScript. Ми вдячні за шанс, який ви дали цьому проєкту. Ми також хотіли б подякувати всім, хто відвідував конференції та зустрічі для презентації Jest і усім, хто створює дописи в блогах про власний досвід з Jest!</p>
<p>Ось що сталося у спільноті за останні два місяці:</p>
<ul>
<li>Jason Bonta and Dmitrii Abramov <a href="https://twitter.com/abramov_dmitrii/status/805913874704674816" target="_blank" rel="noopener noreferrer">redefined the “testing pyramid”</a> we were talking a lot about at Facebook.</li>
<li><a href="https://github.com/skovhus/jest-codemods#jest-codemods" target="_blank" rel="noopener noreferrer">jest-codemods</a> now allows you to painlessly migrate from Mocha, Tape and Ava to Jest.</li>
<li>The React team announced <a href="https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html" target="_blank" rel="noopener noreferrer">improvements to the react-test-renderer</a> in 15.4.0.</li>
<li>Orta Therox build an amazing <a href="https://github.com/orta/vscode-jest#the-aim" target="_blank" rel="noopener noreferrer">vscode-jest integration</a> and donated the code for editor support to Jest.</li>
<li>Pavithra Kodmad is documenting <a href="http://pksjce.github.io/2016/12/08/notes-on-jest" target="_blank" rel="noopener noreferrer">Flipkarts adoption of Jest</a> and shares some getting started tips.</li>
<li>Kent C. Dodds wrote about <a href="https://medium.com/@kentcdodds/migrating-to-jest-881f75366e7e#.ticf0wchu" target="_blank" rel="noopener noreferrer">migrating to Jest at Paypal</a> and Jason Brown <a href="http://browniefed.com/blog/migrating-ava-to-jest/" target="_blank" rel="noopener noreferrer">wrote about migrating to Jest as well</a>.</li>
<li>Ben McCormick wrote about <a href="http://benmccormick.org/2016/12/10/saving-time-with-jest/" target="_blank" rel="noopener noreferrer">saving time with Jest</a>.</li>
<li>Eric Clemmons wrote about <a href="https://medium.com/@ericclemmons/jest-snapshots-for-storybook-5bf36b5e5a3a" target="_blank" rel="noopener noreferrer">snapshots and storybook integration</a>.</li>
<li>Edvin Erikson wrote about <a href="https://medium.com/@edvinerikson/getting-jest-output-in-tap-format-6e07dc2c484c#.1l4edixhl" target="_blank" rel="noopener noreferrer">getting Tap output in Jest</a>.</li>
<li><a href="https://github.com/guigrpa/jest-html#jest-html--" target="_blank" rel="noopener noreferrer">jest-html</a> can bring snapshot diffing to your browser.</li>
<li>There were a few <a href="https://news.ycombinator.com/item?id=13128146" target="_blank" rel="noopener noreferrer">great conversations on hackernews</a> about Jest.</li>
<li>The community started a great discussion about the <a href="https://github.com/airbnb/enzyme/issues/715" target="_blank" rel="noopener noreferrer">future of enzyme</a>.</li>
<li>Ruben Oostinga wrote about <a href="https://medium.com/@RubenOostinga/combining-chai-and-jest-matchers-d12d1ffd0303#.87si0ra2h" target="_blank" rel="noopener noreferrer">combining chai and Jest matchers</a>.</li>
<li>Emil Ong wrote about why <a href="https://engineering.haus.com/why-tdding-your-frontend-feels-pointless-5f710fea7325#.pql79knnm" target="_blank" rel="noopener noreferrer">“TDD'ing your frontend seems pointless”</a>.</li>
<li>Nate Hunzaker wrote about <a href="https://www.viget.com/articles/acceptance-testing-react-apps-with-jest-and-nightmare" target="_blank" rel="noopener noreferrer">end-to-end testing with Jest and Nightmare</a>.</li>
<li><a href="https://medium.com/aya-experience/testing-an-angularjs-app-with-jest-3029a613251#.h9badqevy" target="_blank" rel="noopener noreferrer">Using Jest with Angular just works</a> according to Matthieu Lux.</li>
<li>A fantastic conversation about the <a href="https://github.com/jestjs/jest/issues/2197" target="_blank" rel="noopener noreferrer">purpose of snapshot testing</a> is happening right now.</li>
<li>Dmitrii made a new <a href="https://twitter.com/abramov_dmitrii/status/806613542447157248" target="_blank" rel="noopener noreferrer">music video with his metal band</a>.</li>
<li><a href="https://yarnpkg.com/en/package/lazyspec" target="_blank" rel="noopener noreferrer">lazyspec</a> can help you create smoke tests quickly if you are introducing tests to an existing codebase.</li>
<li>Patrick Stapfer did a lightning talk about <a href="https://twitter.com/ryyppy/status/803871975995277312" target="_blank" rel="noopener noreferrer">vim and Jest</a>.</li>
<li>Mark Dalgleish was <a href="https://twitter.com/markdalgleish/status/806608159527747584" target="_blank" rel="noopener noreferrer">commenting on the value of snapshot testing</a>.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="new-features-changes-and-fixes-in-jest-17--18">New features, changes and fixes in Jest 17 &amp; 18<a href="https://jestjs.io/uk/blog/2016/12/15/2016-in-jest#new-features-changes-and-fixes-in-jest-17--18" class="hash-link" aria-label="Direct link to New features, changes and fixes in Jest 17 &amp; 18" title="Direct link to New features, changes and fixes in Jest 17 &amp; 18" translate="no">​</a></h2>
<p>Jest був створений понад п'ять років тому, тож, як старий фреймворк, він накопичив технічний борг. Ось чому ми рішуче робимо великі зміни частіше, ніж може здатися необхідним: ми вважаємо за потрібне поступово зменшувати технічний борг, аби забезпечити Jest повноцінною довгостроковою підтримкою. We didn't announce Jest 17 in a blog post and if you haven't upgraded to it in the last month you may find the <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md" target="_blank" rel="noopener noreferrer">changelog</a> useful.</p>
<ul>
<li><strong>Breaking:</strong> Removed <code>pit</code> in favor of <code>it</code> or <code>test</code> and <code>mockImpl</code> in favor of <code>jest.fn()</code> or <code>mockImplementation</code> .</li>
<li><strong>Breaking:</strong> Renamed <code>--jsonOutputFile</code> to <code>--outputFile</code>.</li>
<li><strong>Breaking:</strong> Updated <code>testRegex</code> to include <code>test.js</code> and <code>spec.js</code> files.</li>
<li><strong>Breaking:</strong> Replaced <code>scriptPreprocessor</code> with the new <code>transform</code> option.</li>
<li><strong>Breaking:</strong> The <code>testResultsProcessor</code> function is now required to return the modified results.</li>
<li><strong>Potentially Breaking:</strong> Properly resolve <code>snapshotSerializers</code>, <code>setupFiles</code>, <code>transform</code>, <code>testRunner</code> and <code>testResultsProcessor</code> with a resolution algorithm instead of using <code>path.resolve</code>. This mainly means that <code>&lt;rootDir&gt;</code> is no longer needed for these options.</li>
<li><strong>Added:</strong> <code>pretty-format</code> and <code>jest-editor-support</code> were merged into Jest.</li>
<li><strong>Added:</strong> <code>expect.any</code>, <code>expect.anything</code>, <code>expect.objectContaining</code>, <code>expect.arrayContaining</code>, <code>expect.stringMatching</code>.</li>
<li><strong>Added:</strong> <code>--testResultsProcessor</code> is now exposed through the cli.</li>
<li><strong>Added:</strong> Implemented file watching in <code>jest-haste-map</code>.</li>
<li><strong>Added:</strong> Usage of Jest in watch mode can be hidden through <code>JEST_HIDE_USAGE</code>.</li>
<li><strong>Added:</strong> <code>expect.assertions(number)</code> which will ensure that a specified amount of assertions is made in one test.</li>
<li><strong>Added:</strong> <code>.toMatchSnapshot(?string)</code> feature to give snapshots a name.</li>
<li><strong>Added:</strong> <code>toMatchObject</code>, <code>toHaveProperty</code> , <code>toHaveLength</code> matchers.</li>
<li><strong>Added:</strong> <code>expect.extend</code>.</li>
<li><strong>Added:</strong> Added support for custom snapshots serializers.</li>
<li><strong>Added:</strong> Big diffs are now collapsed by default in snapshots and assertions. Added <code>--expand</code> (or <code>-e</code>) to show the full diff.</li>
<li><strong>Added:</strong> <code>jest.resetAllMocks</code> which replaces <code>jest.clearAllMocks</code>.</li>
<li><strong>Added:</strong> <code>--json</code> now includes information about individual tests inside a file.</li>
<li><strong>Fixed:</strong> <code>test.concurrent</code> unhandled promise rejections.</li>
<li><strong>Fixed:</strong> <code>babel-plugin-jest-hoist</code> when using <code>jest.mock</code> with three arguments.</li>
<li><strong>Fixed:</strong> The <code>JSON</code> global in <code>jest-environment-node</code> now comes from the vm context instead of the parent context.</li>
<li><strong>Fixed:</strong> Jest does not print stack traces from babel any longer.</li>
<li><strong>Fixed:</strong> Fake timers are reset when <code>FakeTimers.useTimers()</code> is called.</li>
<li><strong>Fixed:</strong> Regular expressions are properly escaped in snapshots.</li>
<li><strong>Fixed:</strong> Improved pretty printing of large objects.</li>
<li><strong>Fixed:</strong> <code>NaN% Failed</code> in the OS notification when using <code>--notify</code>.</li>
<li><strong>Fixed:</strong> The first test run without cached timings will now use separate processes instead of running in band.</li>
<li><strong>Fixed:</strong> <code>Map</code>/<code>Set</code> comparisons.</li>
<li><strong>Fixed:</strong> <code>test.concurrent</code> now works with <code>--testNamePattern</code>.</li>
<li><strong>Fixed:</strong> Improved <code>.toContain</code> matcher.</li>
<li><strong>Fixed:</strong> Properly resolve modules with platform extensions on react-native.</li>
<li><strong>Fixed:</strong> global built in objects in <code>jest-environment-node</code> now work properly.</li>
<li><strong>Fixed:</strong> Create mock objects in the vm context instead of the parent context.</li>
<li><strong>Fixed:</strong> <code>.babelrc</code> is now part of the transform cache key in <code>babel-jest</code>.</li>
<li><strong>Fixed:</strong> docblock parsing with haste modules.</li>
<li><strong>Fixed:</strong> Exit with the proper code when the coverage threshold is not reached.</li>
<li><strong>Fixed:</strong> Jest now clears the entire scrollback in watch mode.</li>
<li><strong>Deprecated:</strong> <code>jest-react-native</code> was deprecated and now forwards <code>react-native</code>.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="плани-jest-на-першу-половину-2017">Плани Jest на першу половину 2017<a href="https://jestjs.io/uk/blog/2016/12/15/2016-in-jest#%D0%BF%D0%BB%D0%B0%D0%BD%D0%B8-jest-%D0%BD%D0%B0-%D0%BF%D0%B5%D1%80%D1%88%D1%83-%D0%BF%D0%BE%D0%BB%D0%BE%D0%B2%D0%B8%D0%BD%D1%83-2017" class="hash-link" aria-label="Direct link to Плани Jest на першу половину 2017" title="Direct link to Плани Jest на першу половину 2017" translate="no">​</a></h2>
<p>Six months ago <a href="https://jestjs.io/uk/blog/2016/07/27/jest-14#what-s-next-for-jest">we shared our plans for Jest</a> and we are happy that we were able to execute well on almost all of them. Наші плани на наступні шість місяців:</p>
<ul>
<li><strong>Instant feedback:</strong> <a href="https://nuclide.io/" target="_blank" rel="noopener noreferrer">Nuclide</a> integration and an improved and <a href="https://github.com/jestjs/jest/pull/2324#issuecomment-267149669" target="_blank" rel="noopener noreferrer">faster watch mode</a>.</li>
<li><strong>Improved developer experience:</strong> new mocking APIs and improved assertions.</li>
<li><strong>Better performance and memory usage:</strong> analyze Jest and be more conscious about efficiency.</li>
<li><strong>Snapshot Improvements:</strong> snapshot approval mode, syntax highlighting and improved <code>react-test-renderer</code> APIs.</li>
<li><strong>Website:</strong> We'll overhaul the website and documentation and add a Jest cheat sheet.</li>
</ul>
<p>Ми не надаватимемо графіків та розрахунків для цих нововведень, може так статись, що не все вдасться реалізувати. Якщо ви хочете допомогти з реалізацією, надішліть нам задачі та запроси на злиття з вашими ідеями; працюватимемо над покращенням Jest у 2017 році разом.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 16.0: Turbocharged CLI & Community Update]]></title>
            <link>https://jestjs.io/uk/blog/2016/10/03/jest-16</link>
            <guid>https://jestjs.io/uk/blog/2016/10/03/jest-16</guid>
            <pubDate>Mon, 03 Oct 2016 00:00:00 GMT</pubDate>
            <description><![CDATA[Пройшов місяць з моменту останнього великого релізу, а ми вже значно покращили роботу Jest. Цього великого релізу ми оновлюємо формат знімків, що може вимагати оновлення існуючих знімків при оновленні Jest. Ми не вносимо ці зміни бездумно та не розраховуємо робити їх часто, але вважаємо за необхідне час від часу покращувати формат.]]></description>
            <content:encoded><![CDATA[<p>Пройшов місяць з моменту останнього великого релізу, а ми вже значно покращили роботу Jest. Цього великого релізу ми оновлюємо формат знімків, що може вимагати оновлення існуючих знімків при оновленні Jest. Ми не вносимо ці зміни бездумно та не розраховуємо робити їх часто, але вважаємо за необхідне час від часу покращувати формат.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="оновлений-cli">Оновлений CLI<a href="https://jestjs.io/uk/blog/2016/10/03/jest-16#%D0%BE%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B9-cli" class="hash-link" aria-label="Direct link to Оновлений CLI" title="Direct link to Оновлений CLI" translate="no">​</a></h2>
<p><img decoding="async" loading="lazy" alt="reporter" src="https://jestjs.io/uk/assets/images/16-reporter-578f46980efc5766386bed963d75e333.gif" width="858" height="575" class="img_SS3x"></p>
<p>Jest 16 включає новий інтерфейс генератора звітів, який показує запущені тести, а також оновлюваний підсумок і смугу прогресу на основі розрахункового часу виконання з попередніх запусків. Ми також покращили вивід CLI для кращої роботи з різними кольоровими схемами. Якщо в попередньому виконанні в тестах були помилки, нині Jest буде запускати ці тести першими, щоб якомога швидше надати корисні дані користувачам.</p>
<p>Також ми додали безліч нових функцій, які вам можуть знадобитись:</p>
<ul>
<li>New CLI flags were added: A <code>--testNamePattern=pattern</code> or <code>-t &lt;pattern&gt;</code> option was added to filter tests from the command line much like <code>it.only</code> or <code>fit</code> does in tests.</li>
<li>Попередньо провальні тести тепер завжди виконуються першими.</li>
<li><code>jest &lt;pattern&gt;</code> is now case-insensitive to make it easier to filter test files.</li>
<li>Запуск тестів у режимі спостереження тепер можна переривати. During a test run, simply press any of the keys used for input during watch mode (<code>a</code>, <code>o</code>, <code>p</code>, <code>q</code> or <code>enter</code>) to abort a test run and start a new one.</li>
<li>The <code>--bail</code> flag now also works in watch mode. Враховуючи першочерговий запуск попередньо невдалих тестів, режим спостерігання Jest буде відчуватись надмоторним!</li>
<li>Jest now automatically considers files and tests with the <code>jsx</code> extension.</li>
<li>Jest попереджає про повторні ручні файли імітацій та ми вдосконалили автоматично створені імітації для ES модулів, скомпільованих за допомогою babel.</li>
<li>A <code>jest.clearAllMocks</code> function was added to clear all mocks in between tests.</li>
<li>We improved module resolution when <code>moduleNameMapper</code> is used.</li>
<li>Finally, a <code>--findRelatedTests &lt;fileA&gt; &lt;fileB&gt;</code> cli option was added to run tests related to the specified files. Це особливо корисно як хук перед комітом, якщо ви хочете запустити тести лише з вказаних файлів з відповідними тестами.</li>
</ul>
<p>This is what Jest looks like when a test run is interrupted in watch mode: <img decoding="async" loading="lazy" alt="watch" src="https://jestjs.io/uk/assets/images/16-watch-db5e0e957c19a9b2499e018c81762993.gif" width="858" height="575" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="оновлення-знімків">Оновлення знімків<a href="https://jestjs.io/uk/blog/2016/10/03/jest-16#%D0%BE%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D0%B7%D0%BD%D1%96%D0%BC%D0%BA%D1%96%D0%B2" class="hash-link" aria-label="Direct link to Оновлення знімків" title="Direct link to Оновлення знімків" translate="no">​</a></h2>
<p>Реалізація знімків Jest була повністю переписана. The new version of the <code>jest-snapshot</code> package is now structured in a way that allows for easier integration into other test runners and enables more cool integrations like with <a href="https://voice.kadira.io/snapshot-testing-in-react-storybook-43b3b71cec4f#.qh4lzcadb" target="_blank" rel="noopener noreferrer">React Storybook</a>. Jest не позначає знімки як застарілі в файлі з пропущеними або помилковими тестами. Ми також зробили ряд змін у форматі знімку:</p>
<ul>
<li>Об'єкти та масиви друкуються з комами в кінці, щоб мінімізувати майбутні зміни знімків.</li>
<li>Ми видалили імена функцій зі знімків. Вони спричиняли проблеми з різними версіями Node, з інструментарієм покриття коду; ми, як правило, вважали, що зміна імені функції не входить до корисних даних для показу користувачеві.</li>
<li>Знімки сортуються в звичайному порядку сортування всередині файлі.</li>
</ul>
<p>When upgrading to Jest 16, the diff might look similar to this one: <img decoding="async" loading="lazy" alt="snapshots" src="https://jestjs.io/uk/assets/images/16-snapshots-3d7a3fd47cdb15728ac038948a21d2b7.png" width="1924" height="1360" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="оновлення-тестових-бібліотек">Оновлення тестових бібліотек<a href="https://jestjs.io/uk/blog/2016/10/03/jest-16#%D0%BE%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2%D0%B8%D1%85-%D0%B1%D1%96%D0%B1%D0%BB%D1%96%D0%BE%D1%82%D0%B5%D0%BA" class="hash-link" aria-label="Direct link to Оновлення тестових бібліотек" title="Direct link to Оновлення тестових бібліотек" translate="no">​</a></h2>
<p>Ми завершили міграцію тверджень з Jasmine в нові матчери Jest. We added three new matchers: <code>toBeInstanceOf</code>, <code>toContainEqual</code> and <code>toThrowErrorMatchingSnapshot</code> . We have more readable failure messages for the spy/mock matchers <code>toHaveBeenLastCalledWith</code>, <code>toHaveBeenCalledWith</code>, <code>lastCalledWith</code> and <code>toBeCalledWith</code>. Тепер, коли ми переписали всі твердження та розділили їх в окремі пакети, ми будемо працювати над тим, щоб зробити їх автономними, щоб вони могли бути інтегровані в будь-який тестовий фреймворк, якщо ви хочете використовувати їх поза Jest.</p>
<p>Також на прохання спільноти було додано нові псевдоніми. To make Jest focus on a single test you can now use either <code>it.only</code> or <code>test.only</code> or keep using <code>fit</code>; For skipping a test, <code>it.skip</code> or <code>test.skip</code> are now available alongside of <code>xit</code>; finally to define a test as concurrent you can use <code>test.concurrent</code> which is useful in case your test accesses network resources or databases.</p>
<p>Finally, if you'd like to overwrite the <code>expect</code> global with a different assertion library like <a href="http://chaijs.com/" target="_blank" rel="noopener noreferrer">chai</a>, this can now be done using the <code>setupTestFrameworkScriptFile</code> configuration option.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="оновлення-спільноти">Оновлення спільноти<a href="https://jestjs.io/uk/blog/2016/10/03/jest-16#%D0%BE%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D1%81%D0%BF%D1%96%D0%BB%D1%8C%D0%BD%D0%BE%D1%82%D0%B8" class="hash-link" aria-label="Direct link to Оновлення спільноти" title="Direct link to Оновлення спільноти" translate="no">​</a></h2>
<p>За останній місяць було написано багато статей про функцію тестування знімками Jest, як мігрувати до Jest і як почати писати тести. Також я провів декілька відео стрімів, щоб пояснити, як працюють Jest та тестування знімками:</p>
<ul>
<li><a href="https://www.facebook.com/react/videos/1035427199869020/" target="_blank" rel="noopener noreferrer">FB Live Video about Snapshot Testing</a>.</li>
<li><a href="https://www.youtube.com/watch?v=i31VtyJSM-I&amp;feature=youtu.be" target="_blank" rel="noopener noreferrer">JavaScript &amp; React Testing with Kent C. Dodds</a>.</li>
</ul>
<p>Багато людей написали статті про тестування знімками. The most opinionated article that resonated with the Jest team was “<a href="http://benmccormick.org/2016/09/19/testing-with-jest-snapshots-first-impressions/" target="_blank" rel="noopener noreferrer">Testing with Jest Snapshots: First Impressions</a>”. У своєму дописі, Ben відмітив три чудових моменти:</p>
<ol>
<li>Тестування знімками є доповненням для звичайних тестів, а не заміною.</li>
<li>Тестування знімками є кориснішим в поєднанні зі здорових процесом перевірки коду.</li>
<li>Тестування знімками добре співпрацює з автоімітацією.</li>
</ol>
<p>Ми дуже рекомендуємо прочитати весь допис у блозі. Ben провів фантастичну роботу, пояснюючи причини, через які ми створили тестування знімками. Важливо відзначити, що ми не впроваджували тестування знімками на заміну всіх інших форм тестування, а скоріш як спосіб залучити розробників до написання тестів, які вони в іншому випадку не написали б. Воно добре працює для таких речей, як React компоненти, вивід командного рядка, повідомлення про помилки та багато інших, але не вирішує всіх проблем. Мета Jest - надати багато різних способів написання ефективних тестів без погіршення продуктивності чи простоти підтримки проєкту.</p>
<p>Інші пункти по тестуванню знімками:</p>
<ul>
<li>A React Native testing series: <a href="https://blog.callstack.io/unit-testing-react-native-with-the-new-jest-i-snapshots-come-into-play-68ba19b1b9fe" target="_blank" rel="noopener noreferrer">Part 1: Jest – Snapshot come into play</a> and <a href="https://blog.callstack.io/unit-testing-react-native-with-the-new-jest-ii-redux-snapshots-for-your-actions-and-reducers-8559f6f8050b#.putt9eipm" target="_blank" rel="noopener noreferrer">Part 2: Jest – Redux Snapshots for your Actions and Reducers</a>.</li>
<li><a href="https://blog.grommet.io/post/2016/09/01/how-we-landed-on-jest-snapshot-testing-for-javascript" target="_blank" rel="noopener noreferrer">How we landed on Jest snapshot testing for JavaScript</a>.</li>
<li><a href="http://guigrpa.github.io/2016/09/27/picture-this-snapshot-testing/" target="_blank" rel="noopener noreferrer">Picture This: Snapshot Testing</a>.</li>
<li><a href="https://voice.kadira.io/snapshot-testing-in-react-storybook-43b3b71cec4f" target="_blank" rel="noopener noreferrer">Snapshot testing with React Storybook</a>.</li>
<li><a href="https://medium.com/@ryancollinsio/testing-react-redux-applications-fee79ac0087f#.lyjl7st1n" target="_blank" rel="noopener noreferrer">Testing React and Redux Applications</a>.</li>
<li>If you are using the popular <a href="https://github.com/airbnb/enzyme" target="_blank" rel="noopener noreferrer">enzyme</a> testing utility, there is now a project <a href="https://github.com/trayio/enzyme-to-json" target="_blank" rel="noopener noreferrer">enzyme-to-json</a> which makes it possible to use Jest's snapshot testing feature together with enzyme.</li>
</ul>
<p><a href="https://github.com/reactjs/redux/commit/7296d3cba1f5f899bdee5ef6695a8d21149f8d6c" target="_blank" rel="noopener noreferrer">Redux itself now uses Jest</a> and Max Stoiber wrote a <a href="http://academy.plot.ly/react/6-testing/" target="_blank" rel="noopener noreferrer">tutorial on how to test code written with redux</a>. There is also a great <a href="https://semaphoreci.com/community/tutorials/how-to-test-react-and-mobx-with-jest" target="_blank" rel="noopener noreferrer">guide on how to write tests for MobX</a>. If you are using <a href="https://github.com/facebookincubator/create-react-app" target="_blank" rel="noopener noreferrer">create-react-app</a>, Jest is now included by default. Kent C. Dodds created a ton of <a href="https://egghead.io/lessons/javascript-use-jest-s-snapshot-testing-feature?pl=testing-javascript-with-jest-a36c4074" target="_blank" rel="noopener noreferrer">videos on egghead.io</a> that will help you get started with Jest.</p>
<p>If you are using other test runners, Kenneth Skovhus built an awesome <a href="https://github.com/skovhus/jest-codemods" target="_blank" rel="noopener noreferrer">jest-codemods</a> library that will automate the conversion for you. Codemods прекрасні: вони дозволять вам швидко оцінити, чи буде Jest працювати у вашому випадку. Спробуйте!</p>
<p>The full <a href="https://github.com/jestjs/jest/blob/main/CHANGELOG.md#jest-1600" target="_blank" rel="noopener noreferrer">changelog can be found on GitHub</a>. Jest 16 це дійсно результат зусиль спільноти JavaScript і проєкт зараз налічує понад 220 учасників. Ми дякуємо кожному з вас за вашу допомогу в покращенні цього проєкту.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 15.0: Нові значення за замовчуванням для Jest]]></title>
            <link>https://jestjs.io/uk/blog/2016/09/01/jest-15</link>
            <guid>https://jestjs.io/uk/blog/2016/09/01/jest-15</guid>
            <pubDate>Thu, 01 Sep 2016 00:00:00 GMT</pubDate>
            <description><![CDATA[We spent the past year making Jest faster, easier to configure, added tons of features and built snapshot testing. Однак було дві сфери, в яких ми замало інвестували ми можемо дуже швидко рухатись та покращувати фреймворк для Facebook і спільноти відкритого вихідного коду. Мета Jest - максимальне налаштування за замовчуванням, аби вимагати якомога менше необхідної конфігурації. We recently got a chance to explain our philosophy on a create-react-app issue.]]></description>
            <content:encoded><![CDATA[<p>We spent the past year making Jest <a href="https://jestjs.io/uk/blog/2016/03/11/javascript-unit-testing-performance">faster</a>, <a href="https://jestjs.io/uk/blog/2016/04/12/jest-11">easier to configure</a>, <a href="https://jestjs.io/uk/blog/2016/06/22/jest-13">added tons of features</a> and built <a href="https://jestjs.io/uk/blog/2016/07/27/jest-14">snapshot testing</a>. Однак було дві сфери, в яких ми замало інвестували: вивід командного рядка та користувацький досвід. В Jest 15 ми радикально змінюємо фреймворк, щоб полегшити використання початківцями та досвідченими користувачами. Ми задоволені результатами наших інвестицій у Jest: ми можемо дуже швидко рухатись та покращувати фреймворк для Facebook і спільноти відкритого вихідного коду. Мета Jest - максимальне налаштування за замовчуванням, аби вимагати якомога менше необхідної конфігурації. We recently got a chance to explain our philosophy on a <a href="https://github.com/facebookincubator/create-react-app/pull/250#issuecomment-237098619" target="_blank" rel="noopener noreferrer">create-react-app issue</a>.</p>
<p>The most important change to talk about is a set of <a href="https://github.com/jestjs/jest/pull/1511" target="_blank" rel="noopener noreferrer">new defaults</a>. Якщо ви вже користуєтесь Jest, то, швидше за все, вам знадобиться оновити вашу конфігурацію для Jest 15. У більшості випадків налаштування спроститься та Jest надасть корисні повідомлення про помилки під час оновлення. Всі нові значення за замовчуванням можуть бути відключені відповідно до ваших потреб, але ми все ще вважаємо відключені функції критичними для Jest в певних ситуаціях, тож надалі довгостроково використовуватимемо та підтримуватимемо їх для Facebook. Our <a href="https://jestjs.io/uk/docs/api">API documentation</a> was also completely rewritten to reflect these changes. <a href="https://github.com/facebook/react/pull/7625/files" target="_blank" rel="noopener noreferrer">This pull request for React</a> highlights some of the changes necessary for existing projects.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="нові-повідомлення-про-помилки-та-підсумок-cli">Нові повідомлення про помилки та підсумок CLI<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D0%BD%D0%BE%D0%B2%D1%96-%D0%BF%D0%BE%D0%B2%D1%96%D0%B4%D0%BE%D0%BC%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D0%BF%D1%80%D0%BE-%D0%BF%D0%BE%D0%BC%D0%B8%D0%BB%D0%BA%D0%B8-%D1%82%D0%B0-%D0%BF%D1%96%D0%B4%D1%81%D1%83%D0%BC%D0%BE%D0%BA-cli" class="hash-link" aria-label="Direct link to Нові повідомлення про помилки та підсумок CLI" title="Direct link to Нові повідомлення про помилки та підсумок CLI" translate="no">​</a></h2>
<p>В процесі поступового видалення Jasmine з Jest, майже завершено заміну всі матчерів Jasmine. Багато часу було витрачено на налаштування кожного повідомлення про помилку, аби кожен матчер якнайкраще сигналізував падіння тестів - момент, коли Jest є найбільш важливим. In addition to printing the expected and received values, a diff is printed for the <code>toBe</code> and <code>toEqual</code> matchers to help spot mistakes. Додано більше кольорів, відповідні файли зі стеку більш виділяються.</p>
<p>Here is a comparison of the before and after on a light terminal: <img decoding="async" loading="lazy" alt="failure1" src="https://jestjs.io/uk/assets/images/15-failure1-18a216b24eb5641ffe2f700795be8738.png" width="2414" height="1422" class="img_SS3x"> It also works well with darker colors: <img decoding="async" loading="lazy" alt="failure2" src="https://jestjs.io/uk/assets/images/15-failure2-0638fb4e0e8ef964763fab8c4bebd23c.png" width="2442" height="850" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="нова-команда-watch">Нова команда watch<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D0%BD%D0%BE%D0%B2%D0%B0-%D0%BA%D0%BE%D0%BC%D0%B0%D0%BD%D0%B4%D0%B0-watch" class="hash-link" aria-label="Direct link to Нова команда watch" title="Direct link to Нова команда watch" translate="no">​</a></h2>
<p>We completely rewrote <code>jest --watch</code> to be more interactive. It can now switch between running all tests or only test files related to changed files by pressing <code>a</code> or <code>o</code>. By pressing <code>p</code> a prompt appears that allows to specify a test pattern to focus on a specific set of files. Snapshot tests can be updated by pressing <code>u</code>.</p>
<p><img decoding="async" loading="lazy" alt="watch" src="https://jestjs.io/uk/assets/images/15-watch-951ac33b263d3ee8522e35b8836b1f88.gif" width="858" height="575" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="вдосконалення-jest-react-native">Вдосконалення jest-react-native<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D0%B2%D0%B4%D0%BE%D1%81%D0%BA%D0%BE%D0%BD%D0%B0%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-jest-react-native" class="hash-link" aria-label="Direct link to Вдосконалення jest-react-native" title="Direct link to Вдосконалення jest-react-native" translate="no">​</a></h2>
<p>Mocks for <code>ListView</code>, <code>TextInput</code>, <code>ActivityIndicator</code>, <code>ScrollView</code> and more were added. Наявні імітації були оновлені для використання реальних реалізацій, тож наявні знімки, ймовірно, повинні бути оновлені при оновленні до Jest 15. A <code>mockComponent</code> function was added to <code>jest-react-native</code> that can be used to mock native components:</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token plain">jest</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">mock</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'MyNativeComponent'</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:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword" style="color:#297a29">const</span><span class="token plain"> jestReactNative </span><span class="token operator" style="color:#888">=</span><span class="token plain"> </span><span class="token function" style="color:#6b2e85">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'jest-react-native'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword control-flow" style="color:#297a29">return</span><span class="token plain"> jestReactNative</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">mockComponent</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'MyNativeComponent'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span 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></span></code></pre></div></div>
<p>Також додалось багато покращень імітацій зображень, модулю fetch та інших вбудованих API.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="буферизовані-повідомлення-консолі">Буферизовані повідомлення консолі<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D0%B1%D1%83%D1%84%D0%B5%D1%80%D0%B8%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D1%96-%D0%BF%D0%BE%D0%B2%D1%96%D0%B4%D0%BE%D0%BC%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F-%D0%BA%D0%BE%D0%BD%D1%81%D0%BE%D0%BB%D1%96" class="hash-link" aria-label="Direct link to Буферизовані повідомлення консолі" title="Direct link to Буферизовані повідомлення консолі" translate="no">​</a></h2>
<p>Jest розпаралелює запуски тестів між робочими процесами, щоб підвищити продуктивність. Раніше Jest пересилав консольні повідомлення з робочих процесів батьківським об'єктам і виводив їх негайно. При виконанні декількох тестів одночасно, часто було важко дізнатись, який тест в якому модулі викликав функцію журналу. У Jest 15, всі повідомлення консолі буферизуються та виводяться разом з результатами окремих тестів. Також виводяться файл та номер рядка виклику журналу, аби код можна було легко перевірити.</p>
<p>Compare the output of the previous version of Jest and Jest 15: <img decoding="async" loading="lazy" alt="console" src="https://jestjs.io/uk/assets/images/15-console-5050b2c2d39cedc5bff49baa56bb78a3.png" width="2358" height="1162" class="img_SS3x"></p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="автоматична-імітація-вимкнена">Автоматична імітація вимкнена<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D0%B0%D0%B2%D1%82%D0%BE%D0%BC%D0%B0%D1%82%D0%B8%D1%87%D0%BD%D0%B0-%D1%96%D0%BC%D1%96%D1%82%D0%B0%D1%86%D1%96%D1%8F-%D0%B2%D0%B8%D0%BC%D0%BA%D0%BD%D0%B5%D0%BD%D0%B0" class="hash-link" aria-label="Direct link to Автоматична імітація вимкнена" title="Direct link to Автоматична імітація вимкнена" translate="no">​</a></h2>
<p>Наразі у Jest автоматичну імітацію вимкнено за замовчуванням. Ця функція найбільше плутає нових користувачів і в більшості не має сенсу для малих проєктів. Ми ввели автоімітацію у Facebook і для нас вона чудово працювала, коли впроваджувалось модульне тестування великої існуючої бази коду з небагатьма існуючими тестами, але з часом стало здаватись, нібито люди витрачали більше часу на проблеми імітованиї/неімітованих модулів, ніж витратилось би на звичайне написання тесту. Також ми помітили, що автори бібліотек часто вимагають великої кількості основних модулів, які завжди мають бути вручну виставлені як неімітовані. Навіть щодо самого Jest ми усвідомили, що більшість тестів відключають автоімітацію вручну. Ми все ще вважаємо, що явна автоімітація може бути надзвичайно корисною. This change simply trades implicit mocks for explicit mocks via calls to <code>jest.mock(moduleName)</code>.</p>
<p>If you would still like to use automocking by default, enable the <code>automock</code> setting in your configuration or manually call <code>jest.enableAutomock()</code> in your test or setup file.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="шаблони-тестових-файлів">Шаблони тестових файлів<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD%D0%B8-%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2%D0%B8%D1%85-%D1%84%D0%B0%D0%B9%D0%BB%D1%96%D0%B2" class="hash-link" aria-label="Direct link to Шаблони тестових файлів" title="Direct link to Шаблони тестових файлів" translate="no">​</a></h2>
<p>Not everyone uses the same convention of using a <code>__tests__</code> folder to store tests. Jest 15 also looks for files ending in <code>.spec.js</code> or <code>.test.js</code>, two popular community standards. Jest 15 also removes the <code>testDirectoryName</code> and <code>testFileExtensions</code> configuration options and asks users to switch to the <code>testRegex</code> option when the old configuration options are used.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="постійність-реєстру-модулів">Постійність реєстру модулів<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D0%BF%D0%BE%D1%81%D1%82%D1%96%D0%B9%D0%BD%D1%96%D1%81%D1%82%D1%8C-%D1%80%D0%B5%D1%94%D1%81%D1%82%D1%80%D1%83-%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D1%96%D0%B2" class="hash-link" aria-label="Direct link to Постійність реєстру модулів" title="Direct link to Постійність реєстру модулів" translate="no">​</a></h2>
<p>Jest used to implicitly reset all modules before each test and we recommended requiring modules in <code>beforeEach</code> or inside of tests. Це корисно, якщо модулі мають локальний стан, який не повинен поширюватися між тестами. However, two big shifts happened: ES modules with the top-level <code>import</code> syntax and a renewed interest in writing stateless functional modules.</p>
<p>Це призвело до численних несумісностей. Ми також помітили, що в Facebook неявне очищення навіть не використовується. Instead we relied on explicit calls to <code>jest.resetModules()</code> which puts engineers in control on when to wipe away all state.</p>
<p>До прикладу:</p>
<div class="language-js codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-js codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#297a29">const</span><span class="token plain"> </span><span class="token maybe-class-name">React1</span><span class="token plain"> </span><span class="token operator" style="color:#888">=</span><span class="token plain"> </span><span class="token function" style="color:#6b2e85">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'react'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">jest</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">resetModules</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></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#297a29">const</span><span class="token plain"> </span><span class="token maybe-class-name">React2</span><span class="token plain"> </span><span class="token operator" style="color:#888">=</span><span class="token plain"> </span><span class="token function" style="color:#6b2e85">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'react'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">React1</span><span class="token plain"> </span><span class="token operator" style="color:#888">!==</span><span class="token plain"> </span><span class="token maybe-class-name">React2</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Дві окремі копії React.</span><br></span></code></pre></div></div>
<p>The call to <code>resetModules</code> wipes away the require cache. Другий виклик того самого модулю призведе до створення нових екземплярів модуля та всіх його залежностей. This feature is especially useful when dealing with modules that have side effects, like <a href="https://github.com/jestjs/jest/blob/3bbf32a239fc4aad8cc6928a787f235bd86fecac/packages/jest-haste-map/src/__tests__/index-test.js#L64" target="_blank" rel="noopener noreferrer">jest-haste-map</a>.</p>
<p>Ми вважаємо, що краще передати контроль користувачам, тож ми вимкнули неявне очищення. Modules can be reset using <code>jest.resetModules()</code> in code and the <code>resetModules</code> option can be enabled in the configuration to bring back the previous behavior.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="справжні-або-імітовані-таймери">Справжні або імітовані таймери<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D1%81%D0%BF%D1%80%D0%B0%D0%B2%D0%B6%D0%BD%D1%96-%D0%B0%D0%B1%D0%BE-%D1%96%D0%BC%D1%96%D1%82%D0%BE%D0%B2%D0%B0%D0%BD%D1%96-%D1%82%D0%B0%D0%B9%D0%BC%D0%B5%D1%80%D0%B8" class="hash-link" aria-label="Direct link to Справжні або імітовані таймери" title="Direct link to Справжні або імітовані таймери" translate="no">​</a></h2>
<p>By default Jest used to mock all timer functions like <code>setTimeout</code> or <code>process.nextTick</code> and provided an API <code>jest.runAllTimers()</code> to advance timers programmatically. Це корисно, коли частина коду встановлює довгий тайм-аут, на який ми не хочемо чекати в тесті.</p>
<p>Однак ми дізналися, що більшість випадків застосування є доволі ізольованими. <a href="https://jestjs.io/uk/docs/tutorial-async">Async programming</a> has also become much simpler in our test runner. Наразі Jest використовує реальні таймери за замовчуванням.</p>
<p>You can still override this by specifying <code>"timers": "fake"</code> in the configuration or by calling <code>jest.useRealTimers()</code> and <code>jest.useFakeTimers()</code> global switches.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="setupenvscriptfile-vs-setupfiles">setupEnvScriptFile vs setupFiles<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#setupenvscriptfile-vs-setupfiles" class="hash-link" aria-label="Direct link to setupEnvScriptFile vs setupFiles" title="Direct link to setupEnvScriptFile vs setupFiles" translate="no">​</a></h2>
<p>The <code>setupEnvScriptFile</code> configuration option has been deprecated for a while. Jest 15 removes it completely and replaces it with <code>setupFiles</code>. Цей параметр очікує масив шляхів файлів, завантажених перед виконанням тестового файлу.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="підтримка-покриття-переписаного-коду">Підтримка покриття переписаного коду<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D0%BF%D1%96%D0%B4%D1%82%D1%80%D0%B8%D0%BC%D0%BA%D0%B0-%D0%BF%D0%BE%D0%BA%D1%80%D0%B8%D1%82%D1%82%D1%8F-%D0%BF%D0%B5%D1%80%D0%B5%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%BE%D0%B3%D0%BE-%D0%BA%D0%BE%D0%B4%D1%83" class="hash-link" aria-label="Direct link to Підтримка покриття переписаного коду" title="Direct link to Підтримка покриття переписаного коду" translate="no">​</a></h2>
<p>Code coverage in Jest can be used through <code>jest --coverage</code> and requires no additional packages or configuration. Code coverage support was completely rewritten and a new <code>collectCoverageFrom</code> option was added to collect code coverage information from entire projects, including <strong>untested files</strong>. Зверніть увагу, що ця опція використовує шаблони пошуку файлів, бо в майбутньому ми сподіваємося ще більше спростити параметри конфігурації та надати простішу альтернативу регулярним виразам. See Jest's <a href="https://github.com/jestjs/jest/blob/9088f6517813f6c089cf52e980d6579511dcde88/package.json#L47" target="_blank" rel="noopener noreferrer">package.json</a> for an example.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="інші-покращення">Інші покращення<a href="https://jestjs.io/uk/blog/2016/09/01/jest-15#%D1%96%D0%BD%D1%88%D1%96-%D0%BF%D0%BE%D0%BA%D1%80%D0%B0%D1%89%D0%B5%D0%BD%D0%BD%D1%8F" class="hash-link" aria-label="Direct link to Інші покращення" title="Direct link to Інші покращення" translate="no">​</a></h2>
<p>Також зроблено велику кількість інших покращень:</p>
<ul>
<li>Покращено продуктивність виконання невеликих тестів.</li>
<li>Jest почав використовувати детальний режим при виконанні єдиного тестового файлу.</li>
<li>Added an <code>--env</code> option to override the configured test environment.</li>
<li><code>moduleNameMapper</code> now uses a resolution algorithm.</li>
<li>Jest тепер працює зі шляхами, в яких наявні спеціальні символи; наприклад, дужки.</li>
<li>Added <code>global.global</code> to the node environment.</li>
<li>Fixed <code>babel-plugin-jest-hoist</code>'s invalid error when a random user function was called <code>mock</code>.</li>
<li>Fix <code>testEnvironment</code> resolution to prefer <code>jest-environment-{name}</code> instead of <code>{name}</code> only. This prevents a module collision when using <code>jsdom</code> as test environment.</li>
<li>Покращено власні тести Jest шляхом об'єднання інтеграційних і модульних тестів. Покриття коду тепер збирається для Jest.</li>
</ul>
<p>Ми задоволені всіма змінами, які було зроблено разом з допомогою спільноти, а також з нетерпінням очікуємо наступні кілька місяців, аби зробити Jest ще кращим. Please <a href="https://github.com/jestjs/jest/issues" target="_blank" rel="noopener noreferrer">file an issue</a> if something isn't working as expected and send us pull requests.</p>
<p>Next up: <a href="https://github.com/jestjs/jest/pull/1480" target="_blank" rel="noopener noreferrer">Concurrent Reporter</a>.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 14.0: Тестування знімками React]]></title>
            <link>https://jestjs.io/uk/blog/2016/07/27/jest-14</link>
            <guid>https://jestjs.io/uk/blog/2016/07/27/jest-14</guid>
            <pubDate>Wed, 27 Jul 2016 00:00:00 GMT</pubDate>
            <description><![CDATA[Одним з принципів Jest є надання інтегрованого досвіду "нульової конфігурації". Ми хочемо зробити написання якісних тестів якомога більш безпроблемним. Ми помітили, що коли розробники забезпечені готовими інструментами, вони пишуть більше тестів, що в результаті призводить до стабільної бази коду.]]></description>
            <content:encoded><![CDATA[<p>Одним з принципів Jest є надання інтегрованого досвіду "нульової конфігурації". Ми хочемо зробити написання якісних тестів якомога більш безпроблемним. Ми помітили, що коли розробники забезпечені готовими інструментами, вони пишуть більше тестів, що в результаті призводить до стабільної бази коду.</p>
<p>Одне зі значних відкритих питань полягало в тому, як ефективно писати тести React. There are plenty of tools such as <a href="https://facebook.github.io/react/docs/test-utils.html" target="_blank" rel="noopener noreferrer">ReactTestUtils</a> and <a href="https://enzymejs.github.io/enzyme/" target="_blank" rel="noopener noreferrer">enzyme</a>. Обидва інструменти чудові й активно використовуються. Однак від розробників часто чулось, що вони витрачають більше часу на написання тесту, ніж самого компоненту. В результаті, багато людей взагалі припинили писати тести, що врешті-решт призвело до нестабільності. Розробники пояснили нам: все, чого вони хотіли - це переконатися, що їхні компоненти не змінюються несподівано.</p>
<p>Разом з командою React, ми створили новий відтворювач тестів для React та додали тестування знімками в Jest. Consider this <a href="https://github.com/jestjs/jest/blob/main/examples/snapshot/__tests__/link.test.js" target="_blank" rel="noopener noreferrer">example test</a> for a simple <a href="https://github.com/jestjs/jest/blob/main/examples/snapshot/Link.js" target="_blank" rel="noopener noreferrer">Link component</a>:</p>
<div class="language-javascript codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-javascript codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#297a29">import</span><span class="token plain"> </span><span class="token imports">renderer</span><span class="token plain"> </span><span class="token keyword module" style="color:#297a29">from</span><span class="token plain"> </span><span class="token string" style="color:#c21325">'react-test-renderer'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#6b2e85">test</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#c21325">'Link renders correctly'</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:#888">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token keyword" style="color:#297a29">const</span><span class="token plain"> tree </span><span class="token operator" style="color:#888">=</span><span class="token plain"> renderer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">create</span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#888">&lt;</span><span class="token maybe-class-name">Link</span><span class="token plain"> page</span><span class="token operator" style="color:#888">=</span><span class="token string" style="color:#c21325">"http://www.facebook.com"</span><span class="token operator" style="color:#888">&gt;</span><span class="token maybe-class-name">Facebook</span><span class="token operator" style="color:#888">&lt;</span><span class="token operator" style="color:#888">/</span><span class="token maybe-class-name">Link</span><span class="token operator" style="color:#888">&gt;</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#6b2e85">toJSON</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></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token function" style="color:#6b2e85">expect</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">tree</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:#6b2e85">toMatchSnapshot</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></span><span 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></span></code></pre></div></div>
<p>The first time this test is run, Jest creates a <a href="https://github.com/jestjs/jest/blob/main/examples/snapshot/__tests__/__snapshots__/link.test.js.snap" target="_blank" rel="noopener noreferrer">snapshot file</a> that looks like this:</p>
<div class="language-javascript codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-javascript codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token plain">exports</span><span class="token punctuation" style="color:#393A34">[</span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token template-string string" style="color:#c21325">Link renders correctly 1</span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token operator" style="color:#888">=</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token template-string string" style="color:#c21325"></span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">&lt;a</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  className="normal"</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  href="http://www.facebook.com"</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  onMouseEnter={[Function bound _onMouseEnter]}</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  onMouseLeave={[Function bound _onMouseLeave]}&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">  Facebook</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325">&lt;/a&gt;</span><br></span><span class="token-line" style="color:#393A34"><span class="token template-string string" style="color:#c21325"></span><span class="token template-string template-punctuation string" style="color:#c21325">`</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre></div></div>
<p>Знімок варто додавати в систему контролю версій разом зі змінами коду. We use <a href="https://github.com/thejameskyle/pretty-format" target="_blank" rel="noopener noreferrer">pretty-format</a> to make snapshots human-readable during code review. Під час наступних запусків теста Jest просто порівняє результат роботи компонента зі збереженим знімком. Якщо вони співпадуть, тест пройде. If they don't match, either the implementation has changed and the snapshot needs to be updated with <code>jest -u</code>, or the test runner found a bug in your code that should be fixed.</p>
<p>Якщо ми змінимо адресу, на яку в нашому прикладі вказує компонент Link, Jest виведе на екран:</p>
<p><img decoding="async" loading="lazy" alt="snapshot-testing" src="https://jestjs.io/uk/assets/images/snapshot-8de6b9bafc9754f21e3c61604fc0623c.png" width="1450" height="546" class="img_SS3x"></p>
<p>Now you know that you either need to accept the changes with <code>jest -u</code>, or fix the component if the changes were unintentional. To try out this functionality, please clone the <a href="https://github.com/jestjs/jest/tree/main/examples/snapshot" target="_blank" rel="noopener noreferrer">snapshot example</a>, modify the Link component and run Jest. We updated the <a href="https://jestjs.io/uk/docs/tutorial-react">React Tutorial</a> with a new guide for snapshot testing.</p>
<p>This feature was built by <a href="https://twitter.com/soprano" target="_blank" rel="noopener noreferrer">Ben Alpert</a> and <a href="https://twitter.com/kentaromiura" target="_blank" rel="noopener noreferrer">Cristian Carlesso</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="експериментальна-підтримка-react-native">Експериментальна підтримка React Native<a href="https://jestjs.io/uk/blog/2016/07/27/jest-14#%D0%B5%D0%BA%D1%81%D0%BF%D0%B5%D1%80%D0%B8%D0%BC%D0%B5%D0%BD%D1%82%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0-%D0%BF%D1%96%D0%B4%D1%82%D1%80%D0%B8%D0%BC%D0%BA%D0%B0-react-native" class="hash-link" aria-label="Direct link to Експериментальна підтримка React Native" title="Direct link to Експериментальна підтримка React Native" translate="no">​</a></h2>
<p>Створивши відтворювач тестів, який не націлений на конкретну платформу, ми нарешті мали змогу підтримувати повну, не імітовану версію React Native. We are excited to launch experimental React Native support for Jest through the <code>jest-react-native</code> package.</p>
<p>You can start using Jest with react-native by running <code>yarn add --dev jest-react-native</code> and by adding the preset to your Jest configuration:</p>
<div class="language-json codeBlockContainer_mQmQ theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f6f6"><div class="codeBlockContent_t_Hd"><pre tabindex="0" class="prism-code language-json codeBlock_RMoD thin-scrollbar" style="color:#393A34;background-color:#f6f6f6"><code class="codeBlockLines_AclH"><span class="token-line" style="color:#393A34"><span class="token property" style="color:#82772c">"jest"</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token property" style="color:#82772c">"preset"</span><span class="token operator" style="color:#888">:</span><span class="token plain"> </span><span class="token string" style="color:#c21325">"jest-react-native"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre></div></div>
<ul>
<li><a href="https://jestjs.io/uk/docs/tutorial-react-native#content">Tutorial and setup guide</a></li>
<li><a href="https://github.com/jestjs/jest/tree/main/examples/react-native" target="_blank" rel="noopener noreferrer">Example project</a></li>
<li><a href="https://github.com/bartonhammond/snowflake/pull/110" target="_blank" rel="noopener noreferrer">Example pull request for <em>snowflake</em></a>, a popular react-native open source library.</li>
</ul>
<div class="theme-admonition theme-admonition-info admonition_WCGJ alert alert--info"><div class="admonitionHeading_GCBg"><span class="admonitionIcon_L39b"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>info</div><div class="admonitionContent_pbrs"><p>Наразі, пресет реалізує мінімальний набір конфігурацій, необхідний для початку тестування з React Native. Ми сподіваємося на внески спільноти для покращення цього проєкту. Please try it and file <a href="https://github.com/jestjs/jest/issues" target="_blank" rel="noopener noreferrer">issues</a> or send pull requests!</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="чому-тестування-знімками">Чому тестування знімками?<a href="https://jestjs.io/uk/blog/2016/07/27/jest-14#%D1%87%D0%BE%D0%BC%D1%83-%D1%82%D0%B5%D1%81%D1%82%D1%83%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F-%D0%B7%D0%BD%D1%96%D0%BC%D0%BA%D0%B0%D0%BC%D0%B8" class="hash-link" aria-label="Direct link to Чому тестування знімками?" title="Direct link to Чому тестування знімками?" translate="no">​</a></h2>
<p>Для глобальних програм Facebook ми використовуємо систему під назвою "тестування знімками": тестову систему, що відтворює UI компоненти, робить знімок і згодом порівнює записаний знімок зі змінами, зробленими розробниками. Якщо знімки не збігаються, є два варіанти: зміни є неочікуваними або знімок можна оновити згідно з новою версією UI компонента.</p>
<p>Хоча це було бажане рішення для вебдодатків, ми також знайшли багато проблем системних тестів, які вирішуються тестами з інтеграцією знімків:</p>
<ul>
<li><strong>No flakiness:</strong> Because tests are run in a command line runner instead of a real browser or on a real phone, the test runner doesn't have to wait for builds, spawn browsers, load a page and drive the UI to get a component into the expected state which tends to be flaky and the test results become noisy.</li>
<li><strong>Fast iteration speed:</strong> Engineers want to get results in less than a second rather than waiting for minutes or even hours. Якщо тести запускаються не так швидко, як в більшості системних фреймворків, розробники взагалі їх не запускатимуть або ж не писатимуть в першу чергу.</li>
<li><strong>Debugging:</strong> It's easy to step into the code of an integration test in JS instead of trying to recreate the screenshot test scenario and debugging what happened in the visual diff.</li>
</ul>
<p>Because we believe snapshot testing can be useful beyond Jest we split the feature into a <a href="https://github.com/jestjs/jest/tree/main/packages/jest-snapshot" target="_blank" rel="noopener noreferrer">jest-snapshot</a> package. Ми раді співпрацювати зі спільнотою, щоб зробити її універсальнішою, аби її можна було використовувати з іншими виконавцями тестів, а також ділитися з ними концепціями та інфраструктурою.</p>
<p>Також, хотілося б навести цитату розробника Facebook, який описує як тестування знімками змінило його досвід модульного тестування:</p>
<blockquote>
<p>“Один з найскладніших аспектів мого проєкту - синхронізоване зберігання вхідних і вихідних файлів для кожного тестового випадку. Кожна маленька зміна функціоналу може призвести до зміни всіх вихідних файлів. З тестуванням знімками мені не потрібні вихідні файли, Jest вільно створює знімки! Я можу просто перевіряти, як Jest оновлює знімки, замість внесення змін вручну.” – <a href="https://github.com/kyldvs" target="_blank" rel="noopener noreferrer">Kyle Davis</a> working on <a href="https://github.com/kyldvs/fjs" target="_blank" rel="noopener noreferrer">fjs</a>.</p>
</blockquote>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="що-буде-далі-для-jest">Що буде далі для Jest<a href="https://jestjs.io/uk/blog/2016/07/27/jest-14#%D1%89%D0%BE-%D0%B1%D1%83%D0%B4%D0%B5-%D0%B4%D0%B0%D0%BB%D1%96-%D0%B4%D0%BB%D1%8F-jest" class="hash-link" aria-label="Direct link to Що буде далі для Jest" title="Direct link to Що буде далі для Jest" translate="no">​</a></h2>
<p>Recently <a href="https://twitter.com/aarondjents" target="_blank" rel="noopener noreferrer">Aaron Abramov</a> has joined the Jest team full time to improve our unit and integration test infrastructure for Facebook's ads products. Протягом наступних кількох місяців команда Jest планує значні покращення в наступних сферах:</p>
<ul>
<li><strong>Replace Jasmine:</strong> Jasmine is slowing us down and is not being very actively developed. Ми почали заміну всіх матчерів Jasmin та з нетерпінням очікуємо початку додавань нових функцій, аби видалити цю залежність.</li>
<li><strong>Code Coverage:</strong> When Jest was originally created, tools such as babel didn't exist. Наша підтримка покриття коду має купу крайніх випадків та не завжди працює належним чином. Ми переписуємо цей момент, щоб розв'язати поточні проблеми з покриттям.</li>
<li><strong>Developer Experience:</strong> This ranges from improving the setup process, the debugging experience to CLI improvements and more documentation.</li>
<li><strong>Mocking:</strong> The mocking system, especially around manual mocks, is not working well and is confusing. Ми сподіваємося зробити її більш строгою та зрозумілою.</li>
<li><strong>Performance:</strong> Further performance improvements especially for really large codebases are being worked on.</li>
</ul>
<p>Як завжди, якщо у вас є питання або якщо ви готові допомогти, будь ласка, зв'яжіться з нами!</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jest 13.0: Flow & REPL]]></title>
            <link>https://jestjs.io/uk/blog/2016/06/22/jest-13</link>
            <guid>https://jestjs.io/uk/blog/2016/06/22/jest-13</guid>
            <pubDate>Wed, 22 Jun 2016 00:00:00 GMT</pubDate>
            <description><![CDATA[Сьогодні ми з радістю повідомляємо про наступний великий реліз Jest. Ми внесли значні зміни в Jest, які будуть корисні вам і всій інфраструктурі JavaScript тестування Facebook. Найголовніше, під час останнього Jest хакатону Facebook, ми додали статичні типи для всього коду Jest. Fifteen people worked for a day and night to add Flow types to Jest and to add new features to Jest. Типи Flow виконують дві задачі: по-перше, ми вважаємо, що код пишеться, аби бути прочитаним. Зазвичай, код пишуть лише один раз, але читають десятки людей протягом багатьох років. Додавання статичних типів в проєкт допомагає документувати код і пояснювати архітектуру Jest. По-друге, додавання статичних типів полегшує обслуговування та дозволить нам більш впевнено рефакторити Jest, не ламаючи наявний код.]]></description>
            <content:encoded><![CDATA[<p>Сьогодні ми з радістю повідомляємо про наступний великий реліз Jest. Ми внесли значні зміни в Jest, які будуть корисні вам і всій інфраструктурі JavaScript тестування Facebook. Найголовніше, під час останнього Jest хакатону Facebook, ми додали статичні типи для всього коду Jest. Fifteen people worked for a day and night to add <a href="https://flowtype.org/" target="_blank" rel="noopener noreferrer">Flow</a> types to Jest and to add new features to Jest. Типи Flow виконують дві задачі: по-перше, ми вважаємо, що код пишеться, аби бути прочитаним. Зазвичай, код пишуть лише один раз, але читають десятки людей протягом багатьох років. Додавання статичних типів в проєкт допомагає документувати код і пояснювати архітектуру Jest. По-друге, додавання статичних типів полегшує обслуговування та дозволить нам більш впевнено рефакторити Jest, не ламаючи наявний код.</p>
<p>Проєкт Flow значно розвинувся всередині Facebook й успішно використовується в багатьох наших фреймворках і коді майже всіх наших продуктів. Екземпляри чудово розпаралелюються: процес йде файл за файлом, поки не типізовано достатню кількість бази коду. Потім, Flow надає реальні значення та описові інструкції великих змін. За допомогою цього, було виявлено багато крайніх випадків і помилок.</p>
<p>With the help of <a href="https://github.com/lerna/lerna" target="_blank" rel="noopener noreferrer">lerna</a>, we continued to modularize the Jest project. With just a small <a href="https://github.com/lerna/lerna#lernajson" target="_blank" rel="noopener noreferrer">update to the configuration</a>, Flow and lerna now get along well with each other. Splitting up Jest into packages helped us rethink module boundaries and enabled us to ship useful <a href="https://github.com/jestjs/jest/tree/main/packages" target="_blank" rel="noopener noreferrer">packages</a> standalone: The <code>jest-runtime</code> and <code>jest-repl</code> cli tools now allow you to run scripts in a sandboxed Jest environment, enabling you to run and debug your app from the command line. This is especially helpful for projects that use Facebook's <code>@providesModule</code> module convention. To get started, just install <code>jest-repl</code> and run it in the same folder you normally run your tests in! We also published a <code>jest-changed-files</code> package that finds changed files in version control for either git or hg, a common thing in developer tools.</p>
<h2 class="anchor anchorWithStickyNavbar_JmGV" id="нові-та-покращені-функції">Нові та покращені функції<a href="https://jestjs.io/uk/blog/2016/06/22/jest-13#%D0%BD%D0%BE%D0%B2%D1%96-%D1%82%D0%B0-%D0%BF%D0%BE%D0%BA%D1%80%D0%B0%D1%89%D0%B5%D0%BD%D1%96-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D1%96%D1%97" class="hash-link" aria-label="Direct link to Нові та покращені функції" title="Direct link to Нові та покращені функції" translate="no">​</a></h2>
<ul>
<li>Added a notification plugin that shows a test run notification when using <code>--notify</code>.</li>
<li>Added a <code>browser</code> config option to properly resolve npm packages with a browser field in <code>package.json</code> if you are writing tests for client side apps.</li>
<li>Удосконалено повідомлення "тестів не знайдено", яке тепер повідомляє, які тести були знайдені та як вони фільтрувались.</li>
<li>Added <code>jest.isMockFunction(jest.fn())</code> to test for mock functions.</li>
<li>Поліпшено вивід тестового генератора звітів і додано підсумок тестового звіту помилок під час масового запуску тестів.</li>
<li>Added support for mocking virtual modules through <code>jest.mock('Module', implementation, {virtual: true})</code>.</li>
<li>Removed the <code>.haste_cache</code> folder. Jest тепер використовує тимчасове розташування файлів, якому операційна система надає перевагу.</li>
<li>Додано тривалість окремих тестів у детальний режим.</li>
<li>Додано можливість запису знімків в Jest. Щодо цієї функції, ми скоро опублікуємо окремий допис у блозі.</li>
</ul>
<p>Finally, we have received a complete website redesign done by Matthew Johnston and added documentation for using <a href="https://jestjs.io/uk/docs/webpack">Jest with webpack</a>. Happy Jesting!</p>]]></content:encoded>
        </item>
    </channel>
</rss>