PageSourceSearch

https://jestjs.io/assets/js/037bf965.85f1604d.js

js jestjs.io collected 2026-10-01 07:03:26 UTC 9,646 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkjest_website||=[]).push([[4075],{32081(e,t,a){a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>p,frontMatter:()=>s,metadata:()=>n,toc:()=>u});const n=JSON.parse('{"id":"architecture","title":"Architecture","description":"If you are interested in learning more about how Jest works, understand its architecture, and how Jest is split up into individual reusable packages, check out this video:","source":"@site/versioned_docs/version-30.4/Architecture.md","sourceDirName":".","slug":"/architecture","permalink":"/docs/30.4/architecture","draft":false,"unlisted":false,"editUrl":"https://github.com/jestjs/jest/edit/main/website/versioned_docs/version-30.4/Architecture.md","tags":[],"version":"30.4","lastUpdatedBy":"Simen Bekkhus","lastUpdatedAt":1778179958000,"frontMatter":{"id":"architecture","title":"Architecture"},"sidebar":"docs","previous":{"title":"Troubleshooting","permalink":"/docs/30.4/troubleshooting"},"next":{"title":"Testing React Native Apps","permalink":"/docs/30.4/tutorial-react-native"}}');var o=a(62540),r=a(43023),i=a(59103);const s={id:"architecture",title:"Architecture"},c=void 0,l={},u=[];function d(e){const t={a:"a",p:"p",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.p,{children:"If you are interested in learning more about how Jest works, understand its architecture, and how Jest is split up into individual reusable packages, check out this video:"}),"\n",(0,o.jsx)(i.Ay,{id:"3YDiloj8_d0"}),"\n",(0,o.jsx)(t.p,{children:"If you'd like to learn how to build a testing framework like Jest from scratch, check out this video:"}),"\n",(0,o.jsx)(i.Ay,{id:"B8FbUK0WpVU"}),"\n",(0,o.jsxs)(t.p,{children:["There is also a ",(0,o.jsx)(t.a,{href:"https://cpojer.net/posts/building-a-javascript-testing-framework",children:"written guide you can follow"}),". It teaches the fundamental concepts of Jest and explains how various parts of Jest can be used to compose a custom testing framework."]})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},43023(e,t,a){a.d(t,{R:()=>i,x:()=>s});var n=a(63696);const o={},r=n.createContext(o);function i(e){const t=n.useContext(r);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:t},e.children)}},59103(e,t,a){var n=a(62540),o=a(63696);const r={default:120,mqdefault:320,hqdefault:480,sddefault:640,maxresdefault:1280};function i(e,t,a,n,o){const r={"@context":"https://schema.org","@type":"VideoObject",name:o?.name||t,thumbnailUrl:[o?.thumbnailUrl||a],embedUrl:o?.embedUrl||`${n}/embed/${e}`,contentUrl:o?.contentUrl||`https://www.youtube.com/watch?v=${e}`,...o?.description&&{description:o.description},...o?.uploadDate&&{uploadDate:o.uploadDate},...o?.duration&&{duration:o.duration}};return JSON.stringify(r)}const s=o.forwardRef(function(e,t){const[a,s]=o.useState(!1),[c,l]=o.useState(e.alwaysLoadIframe||e.autoplay||!1),u=encodeURIComponent(e.id),d="string"==typeof e.playlistCoverId?encodeURIComponent(e.playlistCoverId):null,p=e.title,h=e.poster||"hqdefault",m=e.announce||"Watch",y=!e.alwaysLoadIframe&&!e.autoplay||e.autoplay&&e.muted,f=o.useMemo(()=>{const t=new URLSearchParams({...e.muted?{mute:"1"}:{},...y?{autoplay:"1"}:{},...e.enableJsApi?{enablejsapi:"1"}:{},...e.enableJsApi&&typeof window<"u"?{origin:window.location.origin}:{},...e.playlist?{list:u}:{}});return e.params&&("string"==typeof e.params?new URLSearchParams(e.params.startsWith("&")?e.params.slice(1):e.params).forEach((e,a)=>{t.append(a,e)}):Object.entries(e.params).forEach(([e,a])=>{t.append(e,String(a))})),t},[e.muted,y,e.enableJsApi,e.playlist,u,e.params]),b=o.useMemo(()=>e.cookie?"https://www.youtube.com":"https://www.youtube-nocookie.com",[e.cookie]),g=o.useMemo(()=>e.playlist?`${b}/embed/videoseries?${f.toString()}`:`${b}/embed/${u}?${f.toString()}`,[e.playlist,b,u,f]),w=!e.thumbnail&&!e.playlist&&"maxresdefault"===h,k=e.webp?"webp":"jpg",v=e.webp?"vi_webp":"vi",j=w?((e,t,a,n="maxresdefault")=>{const[i,s]=(0,o.useState)("");return(0,o.useEffect)(()=>{const o=`https://img.youtube.com/${t}/${e}/${n}.${a}`,i=`https://img.youtube.com/${t}/${e}/hqdefault.${a}`,c=r[n],l=new Image;l.onload=()=>{l.width<c?s(i):s(o)},l.onerror=()=>s(i),l.src=o},[e,t,a,n]),i})(e.id,v,k,h):null,x=o.useMemo(()=>e.thumbnail||j||`https://i.ytimg.com/${v}/${e.playlist?d:u}/${h}.${k}`,[e.thumbnail,j,v,e.playlist,d,u,h,k]),C=e.activatedClass||"lyt-activated",$=e.adNetwork||!1,E=e.aspectHeight||9,S=e.aspectWidth||16,P=e.iframeClass||"",R=e.playerClass||"lty-playbtn",A=e.wrapperClass||"yt-lite",I=o.useCallback(e.onIframeAdded||function(){}
1,[e.onIframeAdded]),T=e.rel?"prefetch":"preload",N=e.containerElement||"article",J=!1!==e.noscriptFallback,L=()=>{c||l(!0)};return o.useEffect(()=>{c&&(I(),e.focusOnLoad&&"object"==typeof t&&t?.current&&t.current.focus())},[c,I,e.focusOnLoad,t]),o.useEffect(()=>{if(!c||!e.enableJsApi||!(e.onReady||e.onStateChange||e.onError||e.onPlay||e.onPause||e.onEnd||e.onBuffering||e.onPlaybackRateChange||e.onPlaybackQualityChange))return;let a=!1,n=!1;const o=n=>{if("https://www.youtube.com"!==n.origin&&"https://www.youtube-nocookie.com"!==n.origin)return;let o;try{o="string"==typeof n.data?JSON.parse(n.data):n.data}catch{return}switch(o.event){case"onReady":a||(a=!0,e.onReady&&e.onReady({videoId:e.id,title:p}));break;case"infoDelivery":if(void 0!==o.info?.playerState){const a=o.info.playerState;switch(e.onStateChange&&e.onStateChange({state:a,currentTime:o.info.currentTime,duration:o.info.duration}),a){case 1:e.onPlay?.();break;case 2:e.onPause?.();break;case 0:e.onEnd?.(),e.stopOnEnd&&"object"==typeof t&&t?.current?.contentWindow&&t.current.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*");break;case 3:e.onBuffering?.()}}void 0!==o.info?.playbackRate&&e.onPlaybackRateChange?.(o.info.playbackRate),void 0!==o.info?.playbackQuality&&e.onPlaybackQualityChange?.(o.info.playbackQuality);break;case"onStateChange":if(void 0!==o.info?.playerState){const a=o.info.playerState;switch(e.onStateChange&&e.onStateChange({state:a,currentTime:o.info.currentTime,duration:o.info.duration}),a){case 1:e.onPlay?.();break;case 2:e.onPause?.();break;case 0:e.onEnd?.(),e.stopOnEnd&&"object"==typeof t&&t?.current?.contentWindow&&t.current.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*");break;case 3:e.onBuffering?.()}}break;case"onError":{const t=o.info;let a;if("number"==typeof t||"string"==typeof t){const e=Number(t);Number.isNaN(e)||(a=e)}else null!==t&&"object"==typeof t&&"errorCode"in t&&"number"==typeof t.errorCode&&(a=t.errorCode);void 0!==a&&e.onError&&e.onError(a);break}case"onPlaybackRateChange":void 0!==o.info?.playbackRate&&e.onPlaybackRateChange?.(o.info.playbackRate);break;case"onPlaybackQualityChange":void 0!==o.info?.playbackQuality&&e.onPlaybackQualityChange?.(o.info.playbackQuality)}};window.addEventListener("message",o);const r=[],i=()=>{"object"==typeof t&&t?.current?.contentWindow&&t.current.contentWindow.postMessage('{"event":"listening","id":"'+u+'"}',"*")},s=()=>{n||(n=!0,i(),[100,300,600,1200,2400].forEach(e=>{r.push(setTimeout(i,e))}))};return"object"==typeof t&&t?.current?(t.current.addEventListener("load",s),"complete"===t.current.contentDocument?.readyState&&s()):[200,500,1e3,2e3,3e3].forEach(e=>{r.push(setTimeout(i,e))}),()=>{window.removeEventListener("message",o),r.forEach(clearTimeout),"object"==typeof t&&t?.current&&t.current.removeEventListener("load",s)}},[c,e.enableJsApi,e.onReady,e.onStateChange,e.onError,e.onPlay,e.onPause,e.onEnd,e.onBuffering,e.onPlaybackRateChange,e.onPlaybackQualityChange,e.stopOnEnd,e.id,u,p,t]),(0,n.jsxs)(n.Fragment,{children:[!e.lazyLoad&&(0,n.jsx)("link",{rel:T,href:x,as:"image"}),(0,n.jsx)(n.Fragment,{children:a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("link",{rel:"preconnect",href:b}),(0,n.jsx)("link",{rel:"preconnect",href:"https://www.google.com"}),$&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("link",{rel:"preconnect",href:"https://static.doubleclick.net"}),(0,n.jsx)("link",{rel:"preconnect",href:"https://googleads.g.doubleclick.net"})]})]})}),e.seo&&!e.playlist&&(0,n.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:i(e.id,p,x,b,e.seo)}}),J&&!e.playlist&&(0,n.jsx)("noscript",{children:(0,n.jsxs)("a",{href:`https://www.youtube.com/watch?v=${e.id}`,"aria-label":`Watch ${p} on YouTube`,children:['Watch "',p,'" on YouTube']})}),(0,n.jsxs)(N,{onPointerOver:()=>{a||s(!0)},onClick:L,className:`${A} ${c?C:""}`,"data-title":p,role:c||e.lazyLoad?void 0:"img","aria-label":c?void 0:`${p} - YouTube video preview`,style:{...!e.lazyLoad&&{backgroundImage:`url(${x})`},"--aspect-ratio":E/S*100+"%",...e.style||{}},children:[e.lazyLoad&&!c&&(0,n.jsx)("img",{src:x,alt:`${p}
1 - YouTube thumbnail`,className:"lty-thumbnail",loading:"lazy"}),e.playlist&&!c&&(0,n.jsx)("div",{className:"lty-playlist-icon","aria-hidden":"true"}),!(e.hideButtonOnActivate&&c)&&(0,n.jsx)("button",{type:"button",className:R,"aria-label":`${m} ${p}`,"aria-hidden":c||void 0,tabIndex:c?-1:0,onClick:L,children:(0,n.jsx)("span",{className:"lty-visually-hidden",children:m})}),c&&(0,n.jsx)("iframe",{ref:t,className:P,title:p,width:"560",height:"315",allow:"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,src:g,referrerPolicy:e.referrerPolicy||"strict-origin-when-cross-origin"})]})]})});a.d(t,["Ay",0,s])}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.