CINXE.COM

<!doctype html> <html lang="en" dir="ltr" class="plugin-pages plugin-id-default" data-has-hydrated="false"> <head> <meta charset="UTF-8"> <meta name="generator" content="Docusaurus v3.3.2"> <title data-rh="true">Jest · 🃏 Delightful JavaScript Testing</title><meta data-rh="true" property="og:title" content="Jest"><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://jestjs.io/img/opengraph.png"><meta data-rh="true" name="twitter:image" content="https://jestjs.io/img/opengraph.png"><meta data-rh="true" property="og:url" content="https://jestjs.io/"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" property="og:locale:alternate" content="ja"><meta data-rh="true" property="og:locale:alternate" content="es_ES"><meta data-rh="true" property="og:locale:alternate" content="fr"><meta data-rh="true" property="og:locale:alternate" content="pt_BR"><meta data-rh="true" property="og:locale:alternate" content="ro"><meta data-rh="true" property="og:locale:alternate" content="ru"><meta data-rh="true" property="og:locale:alternate" content="uk"><meta data-rh="true" property="og:locale:alternate" content="zh_Hans"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docusaurus_tag" content="default"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docsearch:docusaurus_tag" content="default"><link data-rh="true" rel="icon" href="/img/favicon/favicon.ico"><link data-rh="true" rel="canonical" href="https://jestjs.io/"><link data-rh="true" rel="alternate" href="https://jestjs.io/" hreflang="en"><link data-rh="true" rel="alternate" href="https://jestjs.io/ja/" hreflang="ja"><link data-rh="true" rel="alternate" href="https://jestjs.io/es-ES/" hreflang="es-ES"><link data-rh="true" rel="alternate" href="https://jestjs.io/fr/" hreflang="fr"><link data-rh="true" rel="alternate" href="https://jestjs.io/pt-BR/" hreflang="pt-BR"><link data-rh="true" rel="alternate" href="https://jestjs.io/ro/" hreflang="ro"><link data-rh="true" rel="alternate" href="https://jestjs.io/ru/" hreflang="ru"><link data-rh="true" rel="alternate" href="https://jestjs.io/uk/" hreflang="uk"><link data-rh="true" rel="alternate" href="https://jestjs.io/zh-Hans/" hreflang="zh-Hans"><link data-rh="true" rel="alternate" href="https://jestjs.io/" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://HP439UUSOL-dsn.algolia.net" crossorigin="anonymous"><script data-rh="true">function insertBanner(){var n=document.createElement("div");n.id="__docusaurus-base-url-issue-banner-container";n.innerHTML='\n<div id="__docusaurus-base-url-issue-banner" style="border: thick solid red; background-color: rgb(255, 230, 179); margin: 20px; padding: 20px; font-size: 20px;">\n <p style="font-weight: bold; font-size: 30px;">Your Docusaurus site did not load properly.</p>\n <p>A very common reason is a wrong site <a href="https://docusaurus.io/docs/docusaurus.config.js/#baseUrl" style="font-weight: bold;">baseUrl configuration</a>.</p>\n <p>Current configured baseUrl = <span style="font-weight: bold; color: red;">/</span> (default value)</p>\n <p>We suggest trying baseUrl = <span id="__docusaurus-base-url-issue-banner-suggestion-container" style="font-weight: bold; color: green;"></span></p>\n</div>\n',document.body.prepend(n);var e=document.getElementById("__docusaurus-base-url-issue-banner-suggestion-container"),s=window.location.pathname,o="/"===s.substr(-1)?s:s+"/";e.innerHTML=o}document.addEventListener("DOMContentLoaded",(function(){void 0===window.docusaurus&&insertBanner()}))</script><link rel="alternate" type="application/rss+xml" href="/blog/rss.xml" title="Jest RSS Feed"> <link rel="alternate" type="application/atom+xml" href="/blog/atom.xml" title="Jest Atom Feed"> <link rel="preconnect" href="https://www.google-analytics.com"> <link rel="preconnect" href="https://www.googletagmanager.com"> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-44373548-17"></script> <script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-44373548-17",{})</script> <link rel="search" type="application/opensearchdescription+xml" title="Jest" href="/opensearch.xml"> <link rel="icon" href="/img/jest.png"> <link rel="manifest" href="/manifest.json"> <meta name="theme-color" content="#FFF"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="#000"> <link rel="apple-touch-icon" href="/img/jest.png"> <link rel="mask-icon" href="/img/jest.svg" color="#15c213"> <meta name="msapplication-TileImage" content="/img/jest.png"> <meta name="msapplication-TileColor" content="#000"><link rel="stylesheet" href="/assets/css/styles.fc909806.css"> <script src="/assets/js/runtime~main.12e465bd.js" defer="defer"></script> <script src="/assets/js/main.a3db800b.js" defer="defer"></script> </head> <body class="navigation-with-keyboard"> <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const a=new URLSearchParams(window.location.search).entries();for(var[t,e]of a)if(t.startsWith("docusaurus-data-")){var n=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(n,e)}}catch(t){}}(),document.documentElement.setAttribute("data-announcement-bar-initially-dismissed",function(){try{return"true"===localStorage.getItem("docusaurus.announcement.dismiss")}catch(t){}return!1}())</script><div id="__docusaurus"><div role="region" aria-label="Skip to main content"><a class="skipToContent_oPtH" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><div class="announcementBar_zJRd" style="background-color:#20232a;color:#fff" role="banner"><div class="content_bSb_ announcementBarContent_t7IR">Support Ukraine 🇺🇦 <a target="_blank" rel="noopener noreferrer" href="https://opensource.facebook.com/support-ukraine"> Help Provide Humanitarian Aid to Ukraine</a>.</div></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><b class="navbar__title text--truncate">Jest</b></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/docs/getting-started">29.7</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/next/getting-started">Next</a></li><li><a class="dropdown__link" href="/docs/getting-started">29.7</a></li><li><a class="dropdown__link" href="/docs/29.6/getting-started">29.6</a></li><li><a class="dropdown__link" href="/docs/29.5/getting-started">29.5</a></li><li><a class="dropdown__link" href="/docs/29.4/getting-started">29.4</a></li><li><a href="https://jest-archive-august-2023.netlify.app/docs/29.3/getting-started/" target="_blank" rel="noopener noreferrer" class="dropdown__link">29.3<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://jest-archive-august-2023.netlify.app/docs/29.2/getting-started/" target="_blank" rel="noopener noreferrer" class="dropdown__link">29.2<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://jest-archive-august-2023.netlify.app/docs/29.1/getting-started/" target="_blank" rel="noopener noreferrer" class="dropdown__link">29.1<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://jest-archive-august-2023.netlify.app/docs/29.0/getting-started/" target="_blank" rel="noopener noreferrer" class="dropdown__link">29.0<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://jest-archive-august-2023.netlify.app/docs/28.x/getting-started/" target="_blank" rel="noopener noreferrer" class="dropdown__link">28.x<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://jest-archive-august-2023.netlify.app/docs/27.x/getting-started/" target="_blank" rel="noopener noreferrer" class="dropdown__link">27.x<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://jest-archive-august-2023.netlify.app/docs/26.x/getting-started/" target="_blank" rel="noopener noreferrer" class="dropdown__link">26.x<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://jest-archive-august-2023.netlify.app/docs/25.x/getting-started/" target="_blank" rel="noopener noreferrer" class="dropdown__link">25.x<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://archive.jestjs.io/docs/en/24.x/getting-started.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">24.x<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://archive.jestjs.io/docs/en/23.x/getting-started.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">23.x<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://archive.jestjs.io/docs/en/22.x/getting-started.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">22.x<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a class="dropdown__link" href="/versions">All versions</a></li></ul></div></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/docs/getting-started">Docs</a><a class="navbar__item navbar__link" href="/docs/api">API</a><a class="navbar__item navbar__link" href="/help">Help</a><a class="navbar__item navbar__link" href="/blog">Blog</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link"><svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" class="iconLanguage_kvP7"><path fill="currentColor" d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path></svg>English</a><ul class="dropdown__menu"><li><a href="/" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" lang="en">English</a></li><li><a href="/ja/" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="ja">日本語</a></li><li><a href="/es-ES/" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="es-ES">Español</a></li><li><a href="/fr/" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="fr">Français</a></li><li><a href="/pt-BR/" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="pt-BR">Português (Brasil)</a></li><li><a href="/ro/" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="ro">Română</a></li><li><a href="/ru/" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="ru">Русский</a></li><li><a href="/uk/" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="uk">Українська</a></li><li><a href="/zh-Hans/" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="zh-Hans">简体中文</a></li></ul></div><a href="https://github.com/jestjs/jest" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-github-link" aria-label="GitHub repository"></a><div class="toggle_ki11 colorModeToggle_Hewu"><button class="clean-btn toggleButton_MMFG toggleButtonDisabled_Uw7m" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_lgto"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_U96C"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="navbarSearchContainer_bzqh"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_MB5r"><div><div class="wrapperV1"><div class="jest-hero-interactive"><div class="socialLinks_AWWq"><a href="https://twitter.com/intent/follow?screen_name=jestjs_&amp;region=follow_link" target="_blank" class="twitter-follow-button_xhwJ"><div class="twitter-follow-button--icon_gwmX"></div>Follow @jestjs_</a><div class="github-button"><span><a href="https://github.com/jestjs/jest" data-icon="octicon-star" data-size="large" aria-label="Star facebook/jest on GitHub">Star</a></span></div></div><div class="jest-hand"><div class="jest-card-hitslop"><div class="jest-card jest-card-running" data-index="0"><div class="jest-card-front"><div class="jest-card-label">JEST</div><div class="jest-card-logo-container"><div class="jest-card-logo"></div></div><div class="jest-card-label jest-card-label-reverse">JEST</div></div><div class="jest-card-back"><svg viewBox="0 0 200 200" style="height:150px;width:150px"><defs><path d="M100 100 m -75 0 a75 75 0 1 0 150 0 a 75 75 0 1 0 -150 0" id="runs-path"></path></defs><circle cx="100" cy="100" r="88" stroke="#fff" stroke-width="8" fill="#C2A813"></circle><g class="run-circle"><circle cx="100" cy="100" r="50" fill="#fff"></circle><circle cx="100" cy="100" r="45" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="35" fill="#fff" class="run-circle"></circle><circle cx="100" cy="100" r="25" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="15" fill="#fff" class="run-circle"></circle></g><g fill="#fff" font-weight="bold" font-size="26" letter-spacing="0.2em" class="run-text"><text><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(90,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(180,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(270,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text></g></svg></div></div></div><div class="jest-card-hitslop"><div class="jest-card jest-card-running" data-index="1"><div class="jest-card-front"><div class="jest-card-label">JEST</div><div class="jest-card-logo-container"><div class="jest-card-logo"></div></div><div class="jest-card-label jest-card-label-reverse">JEST</div></div><div class="jest-card-back"><svg viewBox="0 0 200 200" style="height:150px;width:150px"><defs><path d="M100 100 m -75 0 a75 75 0 1 0 150 0 a 75 75 0 1 0 -150 0" id="runs-path"></path></defs><circle cx="100" cy="100" r="88" stroke="#fff" stroke-width="8" fill="#C2A813"></circle><g class="run-circle"><circle cx="100" cy="100" r="50" fill="#fff"></circle><circle cx="100" cy="100" r="45" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="35" fill="#fff" class="run-circle"></circle><circle cx="100" cy="100" r="25" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="15" fill="#fff" class="run-circle"></circle></g><g fill="#fff" font-weight="bold" font-size="26" letter-spacing="0.2em" class="run-text"><text><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(90,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(180,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(270,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text></g></svg></div></div></div><div class="jest-card-hitslop"><div class="jest-card jest-card-running" data-index="2"><div class="jest-card-front"><div class="jest-card-label">JEST</div><div class="jest-card-logo-container"><div class="jest-card-logo"></div></div><div class="jest-card-label jest-card-label-reverse">JEST</div></div><div class="jest-card-back"><svg viewBox="0 0 200 200" style="height:150px;width:150px"><defs><path d="M100 100 m -75 0 a75 75 0 1 0 150 0 a 75 75 0 1 0 -150 0" id="runs-path"></path></defs><circle cx="100" cy="100" r="88" stroke="#fff" stroke-width="8" fill="#C2A813"></circle><g class="run-circle"><circle cx="100" cy="100" r="50" fill="#fff"></circle><circle cx="100" cy="100" r="45" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="35" fill="#fff" class="run-circle"></circle><circle cx="100" cy="100" r="25" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="15" fill="#fff" class="run-circle"></circle></g><g fill="#fff" font-weight="bold" font-size="26" letter-spacing="0.2em" class="run-text"><text><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(90,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(180,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(270,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text></g></svg></div></div></div><div class="jest-card-hitslop"><div class="jest-card jest-card-running" data-index="3"><div class="jest-card-front"><div class="jest-card-label">JEST</div><div class="jest-card-logo-container"><div class="jest-card-logo"></div></div><div class="jest-card-label jest-card-label-reverse">JEST</div></div><div class="jest-card-back"><svg viewBox="0 0 200 200" style="height:150px;width:150px"><defs><path d="M100 100 m -75 0 a75 75 0 1 0 150 0 a 75 75 0 1 0 -150 0" id="runs-path"></path></defs><circle cx="100" cy="100" r="88" stroke="#fff" stroke-width="8" fill="#C2A813"></circle><g class="run-circle"><circle cx="100" cy="100" r="50" fill="#fff"></circle><circle cx="100" cy="100" r="45" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="35" fill="#fff" class="run-circle"></circle><circle cx="100" cy="100" r="25" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="15" fill="#fff" class="run-circle"></circle></g><g fill="#fff" font-weight="bold" font-size="26" letter-spacing="0.2em" class="run-text"><text><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(90,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(180,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(270,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text></g></svg></div></div></div><div class="jest-card-hitslop"><div class="jest-card jest-card-running" data-index="4"><div class="jest-card-front"><div class="jest-card-label">JEST</div><div class="jest-card-logo-container"><div class="jest-card-logo"></div></div><div class="jest-card-label jest-card-label-reverse">JEST</div></div><div class="jest-card-back"><svg viewBox="0 0 200 200" style="height:150px;width:150px"><defs><path d="M100 100 m -75 0 a75 75 0 1 0 150 0 a 75 75 0 1 0 -150 0" id="runs-path"></path></defs><circle cx="100" cy="100" r="88" stroke="#fff" stroke-width="8" fill="#C2A813"></circle><g class="run-circle"><circle cx="100" cy="100" r="50" fill="#fff"></circle><circle cx="100" cy="100" r="45" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="35" fill="#fff" class="run-circle"></circle><circle cx="100" cy="100" r="25" fill="#C2A813" class="run-circle"></circle><circle cx="100" cy="100" r="15" fill="#fff" class="run-circle"></circle></g><g fill="#fff" font-weight="bold" font-size="26" letter-spacing="0.2em" class="run-text"><text><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(90,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(180,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text><text transform="rotate(270,100,100)"><textPath xlink:href="#runs-path" href="#runs-path">RUNS</textPath></text></g></svg></div></div></div></div><div class="jest-button-container"><a class="jest-button" href="/docs/getting-started">Get Started</a><a class="jest-button" href="/docs/getting-started">Docs</a><a class="jest-button" href="/docs/configuration">Config</a><a class="jest-button" href="/help">Get help</a></div></div></div><div class="mainContainerV1" style="padding:0"><div class="containerV1 intro lightBackground paddingBottom paddingTop"><div class="wrapperV1"><p>Jest is a delightful JavaScript Testing Framework with a focus on simplicity.</p><p></p><div><span><p>It works with projects using: <a href="https://babeljs.io/" target="_blank" rel="noopener noreferrer">Babel</a>, <a href="https://www.typescriptlang.org/" target="_blank" rel="noopener noreferrer">TypeScript</a>, <a href="https://nodejs.org/" target="_blank" rel="noopener noreferrer">Node</a>, <a href="https://reactjs.org" target="_blank" rel="noopener noreferrer">React</a>, <a href="https://angular.io" target="_blank" rel="noopener noreferrer">Angular</a>, <a href="https://vuejs.org" target="_blank" rel="noopener noreferrer">Vue</a> and more!</p></span></div><p></p></div></div><div class="containerV1 features paddingBottom paddingTop"><div class="wrapperV1"><div class="gridBlockV1"><div class="blockElement yellow alignCenter fourByGridBlock"><div class="blockContent"><h2><div><span><p>Zero config</p></span></div></h2><div><span><p>Jest aims to work out of the box, config free, on most JavaScript projects.</p></span></div></div></div><div class="blockElement yellow alignCenter fourByGridBlock"><div class="blockContent"><h2><div><span><p>Snapshots</p></span></div></h2><div><span><p>Make tests which keep track of large objects with ease. Snapshots live either alongside your tests, or embedded inline.</p></span></div></div></div><div class="blockElement yellow alignCenter fourByGridBlock"><div class="blockContent"><h2><div><span><p>Isolated</p></span></div></h2><div><span><p>Tests are parallelized by running them in their own processes to maximize performance.</p></span></div></div></div><div class="blockElement yellow alignCenter fourByGridBlock"><div class="blockContent"><h2><div><span><p>Great api</p></span></div></h2><div><span><p>From <code>it</code> to <code>expect</code> - Jest has the entire toolkit in one place. Well documented, well maintained, well good.</p></span></div></div></div></div></div></div><div class="containerV1 section-container lightBackground paddingBottom paddingTop"><div class="wrapperV1"><div class="gridBlockV1"><div class="blockElement green imageAlignSide imageAlignLeft twoByGridBlock"><div class="blockImage"><img src="/img/content/feature-fast.png"></div><div class="blockContent"><h2><div><span><p>Fast and safe</p></span></div></h2><div><span><p>By ensuring your tests have unique global state, Jest can reliably run tests in parallel. To make things quick, Jest runs previously failed tests first and re-organizes runs based on how long test files take.</p></span></div></div></div></div></div></div><div class="containerV1 section-container paddingBottom paddingTop"><div class="wrapperV1"><div class="gridBlockV1"><div class="blockElement yellow imageAlignSide imageAlignRight twoByGridBlock"><div class="blockContent"><h2><div><span><p>Code coverage</p></span></div></h2><div><span><p>Generate code coverage by adding the flag <a href="/docs/cli#--coverageboolean"><code>--coverage</code></a>. No additional setup needed. Jest can collect code coverage information from entire projects, including untested files.</p></span></div></div><div class="blockImage"><img src="/img/content/feature-coverage.png"></div></div></div></div></div><div class="containerV1 section-container lightBackground paddingBottom paddingTop"><div class="wrapperV1"><div class="gridBlockV1"><div class="blockElement red imageAlignSide imageAlignLeft twoByGridBlock"><div class="blockImage"><img src="/img/content/feature-mocking.png"></div><div class="blockContent"><h2><div><span><p>Easy Mocking</p></span></div></h2><div><span><p>Jest uses a custom resolver for imports in your tests, making it simple to mock any object outside of your test’s scope. You can use mocked imports with the rich <a href="/docs/mock-functions">Mock Functions</a> API to spy on function calls with readable test syntax.</p></span></div></div></div></div></div></div><div class="containerV1 section-container paddingBottom paddingTop"><div class="wrapperV1"><div class="gridBlockV1"><div class="blockElement green matchers imageAlignSide imageAlignRight twoByGridBlock"><div class="blockContent"><h2><div><span><p>Great Exceptions</p></span></div></h2><div><span><p>Tests fail—when they do, Jest provides rich context why. Here are some examples:</p></span></div></div><div class="blockImage"><img src="/img/content/matchers/toBe.png"></div></div></div></div></div><div class="containerV1 section-container philosophy lightBackground paddingBottom paddingTop"><div class="wrapperV1"><div class="blockElement yellow"><div class="blockContent"><h2>Philosophy</h2></div></div><div class="blockElement imageAlignSide gridBlock threeByGridBlock bottom-margin philosophy"><div class="blockContent"><div><span><p>Jest is a JavaScript testing framework designed to ensure correctness of any JavaScript codebase. It allows you to write tests with an approachable, familiar and feature-rich API that gives you results quickly.</p></span></div></div><div class="blockContent"><div><span><p>Jest is well-documented, requires little configuration and can be extended to match your requirements.</p></span></div><div><span><p>Jest makes testing delightful.</p></span></div><div class="show-small"><p style="font-family:Monaco, Courier, monospace">- Jest Core Team</p></div></div><div class="blockContent flex-end hide-small"><p style="font-family:Monaco, Courier, monospace">- Jest Core Team</p></div></div></div></div><div class="containerV1 section-container bottom-margin docs paddingBottom paddingTop"><div class="wrapperV1"><div class="blockElement imageAlignSide gridBlock video-block"><div class="blockContent"><div class="video"><link rel="preload" href="https://i.ytimg.com/vi/cAKYQpTC7MA/hqdefault.jpg" as="image"><article class="yt-lite" style="background-image:url(https://i.ytimg.com/vi/cAKYQpTC7MA/hqdefault.jpg);--aspect-ratio:56.25%"><button type="button" class="lty-playbtn" aria-label="Watch undefined"></button></article></div></div></div><div class="blockElement red bottom-margin"><div class="blockContent"><h2>Docs and talks</h2><div><span><p>The Jest core team and contributors regularly speak about <a href="https://www.youtube.com/watch?v=cAKYQpTC7MA" target="_blank" rel="noopener noreferrer">Jest and Delightful JavaScript Testing</a>. Check out our talk about <a href="https://www.youtube.com/watch?v=PvabBs_utr8" target="_blank" rel="noopener noreferrer">Building High-Quality JavaScript Tools</a> at jsconf.eu 2017 and our talk about <a href="https://www.youtube.com/watch?v=NtjyeojAOBs" target="_blank" rel="noopener noreferrer">Jest as a Platform</a> at ReactiveConf 2017.</p></span></div></div></div></div></div><div class="containerV1 section-container community imageAlignSide twoByGridBlock lightBackground paddingBottom paddingTop"><div class="wrapperV1"><div class="yellow"><div class="blockContent"><h2>Open Collective</h2><div><span><p>Jest uses Open Collective to support developers contributing to Jest.</p></span></div><div class="opencollective"><h3>Featured Sponsors</h3><div class="opencollective-avatars"><a class="sponsor-item" title="$6200 by Principal Financial Group" target="_blank" rel="nofollow noopener" href="https://www.principal.com/about-us"><img class="sponsor-avatar" src="https://images.opencollective.com/principal/431e690/logo.png" alt="Principal Financial Group&#x27;s avatar"></a><a class="sponsor-item" title="$5970 by Airbnb" target="_blank" rel="nofollow noopener" href="https://www.airbnb.com/"><img class="sponsor-avatar" src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb&#x27;s avatar"></a><a class="sponsor-item" title="$3700 by Katalon, Inc." target="_blank" rel="nofollow noopener" href="https://bit.ly/3zLAcxL"><img class="sponsor-avatar" src="https://images.opencollective.com/katalon_studio/ff84f07/logo.png" alt="Katalon, Inc.&#x27;s avatar"></a><a class="sponsor-item" title="$2900 by Nx (by Nrwl)" target="_blank" rel="nofollow noopener" href="https://nx.dev"><img class="sponsor-avatar" src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)&#x27;s avatar"></a><a class="sponsor-item" title="$700 by Datadog" target="_blank" rel="nofollow noopener" href="https://datadoghq.com"><img class="sponsor-avatar" src="https://images.opencollective.com/datadog/5301801/logo.png" alt="Datadog&#x27;s avatar"></a></div><p><a href="https://opencollective.com/jest#section-contributors" target="_blank" rel="nofollow noopener">Join<!-- --> <!-- -->31<!-- -->+ donors</a> <!-- -->who sponsor Jest for $3 or more per month on<!-- --> <a href="https://opencollective.com/jest#section-contributors" target="_blank" rel="nofollow noopener">opencollective.com</a>.</p></div></div><div class="blockContent yellow"><h2>Who uses Jest?</h2><div><span><p>A lot of people! With <a href="https://www.npmjs.com/package/jest" target="_blank" rel="noopener noreferrer">300+ million</a> downloads in the last month, and used on over <a href="https://github.com/jestjs/jest/network/dependents" target="_blank" rel="noopener noreferrer">11,000,000</a> public repos on GitHub.</p></span></div><div><span><p>Jest is used extensively at these companies:</p></span></div><div class="gridBlockV1 logos"><a class="logo-item" href="https://www.facebook.com"><img src="/img/logos/facebook.png" title="Facebook" alt="Facebook"></a><a class="logo-item" href="https://www.twitter.com"><img src="/img/logos/twitter.png" title="Twitter" alt="Twitter"></a><a class="logo-item" href="http://www.nytimes.com/"><img src="/img/logos/nyt.png" title="The New York Times" alt="The New York Times"></a><a class="logo-item" href="https://www.spotify.com"><img src="/img/logos/spotify.png" title="Spotify" alt="Spotify"></a><a class="logo-item" href="https://www.airbnb.com/"><img src="/img/logos/airbnb.png" title="Airbnb" alt="Airbnb"></a><a class="logo-item" href="https://www.instagram.com/"><img src="/img/logos/instagram.png" title="Instagram" alt="Instagram"></a></div></div></div></div></div></div></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Docs</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="/docs/getting-started">Getting Started</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/snapshot-testing">Guides</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/api">API Reference</a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/jestjs" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stack Overflow<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://www.reactiflux.com" target="_blank" rel="noopener noreferrer" class="footer__link-item">Reactiflux<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://twitter.com/jestjs_" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">More</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="/blog">Blog</a></li><li class="footer__item"><a href="https://github.com/jestjs/jest" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://twitter.com/jestjs_" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">Legal</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://opensource.facebook.com/legal/privacy/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Privacy<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/terms/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Terms<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPrP"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="footer__bottom text--center"><div class="margin-bottom--sm"><a href="https://openjsf.org/" rel="noopener noreferrer" class="footerLogoLink_tutC"><img src="/img/openjs_foundation-logo-horizontal-color-dark_background.svg" alt="OpenJS Foundation Logo" class="footer__logo themedComponent_siVc themedComponent--light_hHel"><img src="/img/openjs_foundation-logo-horizontal-color-dark_background.svg" alt="OpenJS Foundation Logo" class="footer__logo themedComponent_siVc themedComponent--dark_yETr"></a></div><div class="footer__copyright"><p>Copyright <a href="https://openjsf.org">OpenJS Foundation</a> and Jest contributors. All rights reserved. The <a href="https://openjsf.org">OpenJS Foundation</a> has registered trademarks and uses trademarks. For a list of trademarks of the <a href="https://openjsf.org">OpenJS Foundation</a>, please see our <a href="https://trademark-policy.openjsf.org">Trademark Policy</a> and <a href="https://trademark-list.openjsf.org">Trademark List</a>. Trademarks and logos not indicated on the <a href="https://trademark-list.openjsf.org">list of OpenJS Foundation trademarks</a> are trademarks&trade; or registered&reg; trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.</p> <p><a href="https://openjsf.org">The OpenJS Foundation</a> | <a href="https://terms-of-use.openjsf.org">Terms of Use</a> | <a href="https://privacy-policy.openjsf.org">Privacy Policy</a> | <a href="https://bylaws.openjsf.org">Bylaws</a> | <a href="https://code-of-conduct.openjsf.org">Code of Conduct</a> | <a href="https://trademark-policy.openjsf.org">Trademark Policy</a> | <a href="https://trademark-list.openjsf.org">Trademark List</a> | <a href="https://www.linuxfoundation.org/cookies">Cookie Policy</a></p>Built with Docusaurus.</div></div></div></footer></div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10