diff --git a/404.html b/404.html index 6f79daf299..157f8d3610 100644 --- a/404.html +++ b/404.html @@ -2,7 +2,7 @@ - + Page Not Found | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

+
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

\ No newline at end of file diff --git a/assets/css/styles.27f8d049.css b/assets/css/styles.27f8d049.css deleted file mode 100644 index 594479ab17..0000000000 --- a/assets/css/styles.27f8d049.css +++ /dev/null @@ -1 +0,0 @@ -.col,.container{padding:0 var(--ifm-spacing-horizontal);width:100%}.markdown>h2,.markdown>h3,.markdown>h4,.markdown>h5,.markdown>h6{margin-bottom:calc(var(--ifm-heading-vertical-rhythm-bottom)*var(--ifm-leading))}.markdown li,body{word-wrap:break-word}body,ol ol,ol ul,ul ol,ul ul{margin:0}pre,table{overflow:auto}blockquote,pre{margin:0 0 var(--ifm-spacing-vertical)}.breadcrumbs__link,.button{transition-timing-function:var(--ifm-transition-timing-default)}.button,code{vertical-align:middle}.button--outline.button--active,.button--outline:active,.button--outline:hover,:root{--ifm-button-color:var(--ifm-font-color-base-inverse)}.menu__link:hover,a{transition:color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.navbar--dark,:root{--ifm-navbar-link-hover-color:var(--ifm-color-primary)}.menu,.navbar-sidebar{overflow-x:hidden}:root,html[data-theme=dark]{--ifm-color-emphasis-500:var(--ifm-color-gray-500)}*,.DocSearch-Container,.DocSearch-Container *{box-sizing:border-box}.toggleButton_gllP,html{-webkit-tap-highlight-color:transparent}:root{--ifm-color-scheme:light;--ifm-dark-value:10%;--ifm-darker-value:15%;--ifm-darkest-value:30%;--ifm-light-value:15%;--ifm-lighter-value:30%;--ifm-lightest-value:50%;--ifm-contrast-background-value:90%;--ifm-contrast-foreground-value:70%;--ifm-contrast-background-dark-value:70%;--ifm-contrast-foreground-dark-value:90%;--ifm-color-primary:#3578e5;--ifm-color-secondary:#ebedf0;--ifm-color-success:#00a400;--ifm-color-info:#54c7ec;--ifm-color-warning:#ffba00;--ifm-color-danger:#fa383e;--ifm-color-primary-dark:#306cce;--ifm-color-primary-darker:#2d66c3;--ifm-color-primary-darkest:#2554a0;--ifm-color-primary-light:#538ce9;--ifm-color-primary-lighter:#72a1ed;--ifm-color-primary-lightest:#9abcf2;--ifm-color-primary-contrast-background:#ebf2fc;--ifm-color-primary-contrast-foreground:#102445;--ifm-color-secondary-dark:#d4d5d8;--ifm-color-secondary-darker:#c8c9cc;--ifm-color-secondary-darkest:#a4a6a8;--ifm-color-secondary-light:#eef0f2;--ifm-color-secondary-lighter:#f1f2f5;--ifm-color-secondary-lightest:#f5f6f8;--ifm-color-secondary-contrast-background:#fdfdfe;--ifm-color-secondary-contrast-foreground:#474748;--ifm-color-success-dark:#009400;--ifm-color-success-darker:#008b00;--ifm-color-success-darkest:#007300;--ifm-color-success-light:#26b226;--ifm-color-success-lighter:#4dbf4d;--ifm-color-success-lightest:#80d280;--ifm-color-success-contrast-background:#e6f6e6;--ifm-color-success-contrast-foreground:#003100;--ifm-color-info-dark:#4cb3d4;--ifm-color-info-darker:#47a9c9;--ifm-color-info-darkest:#3b8ba5;--ifm-color-info-light:#6ecfef;--ifm-color-info-lighter:#87d8f2;--ifm-color-info-lightest:#aae3f6;--ifm-color-info-contrast-background:#eef9fd;--ifm-color-info-contrast-foreground:#193c47;--ifm-color-warning-dark:#e6a700;--ifm-color-warning-darker:#d99e00;--ifm-color-warning-darkest:#b38200;--ifm-color-warning-light:#ffc426;--ifm-color-warning-lighter:#ffcf4d;--ifm-color-warning-lightest:#ffdd80;--ifm-color-warning-contrast-background:#fff8e6;--ifm-color-warning-contrast-foreground:#4d3800;--ifm-color-danger-dark:#e13238;--ifm-color-danger-darker:#d53035;--ifm-color-danger-darkest:#af272b;--ifm-color-danger-light:#fb565b;--ifm-color-danger-lighter:#fb7478;--ifm-color-danger-lightest:#fd9c9f;--ifm-color-danger-contrast-background:#ffebec;--ifm-color-danger-contrast-foreground:#4b1113;--ifm-color-white:#fff;--ifm-color-black:#000;--ifm-color-gray-0:var(--ifm-color-white);--ifm-color-gray-100:#f5f6f7;--ifm-color-gray-200:#ebedf0;--ifm-color-gray-300:#dadde1;--ifm-color-gray-400:#ccd0d5;--ifm-color-gray-500:#bec3c9;--ifm-color-gray-600:#8d949e;--ifm-color-gray-700:#606770;--ifm-color-gray-800:#444950;--ifm-color-gray-900:#1c1e21;--ifm-color-gray-1000:var(--ifm-color-black);--ifm-color-emphasis-0:var(--ifm-color-gray-0);--ifm-color-emphasis-100:var(--ifm-color-gray-100);--ifm-color-emphasis-200:var(--ifm-color-gray-200);--ifm-color-emphasis-300:var(--ifm-color-gray-300);--ifm-color-emphasis-400:var(--ifm-color-gray-400);--ifm-color-emphasis-600:var(--ifm-color-gray-600);--ifm-color-emphasis-700:var(--ifm-color-gray-700);--ifm-color-emphasis-800:var(--ifm-color-gray-800);--ifm-color-emphasis-900:var(--ifm-color-gray-900);--ifm-color-emphasis-1000:var(--ifm-color-gray-1000);--ifm-color-content:var(--ifm-color-emphasis-900);--ifm-color-content-inverse:var(--ifm-color-emphasis-0);--ifm-color-content-secondary:#525860;--ifm-background-color:#0000;--ifm-background-surface-color:var(--ifm-color-content-inverse);--ifm-global-border-width:1px;--ifm-global-radius:0.4rem;--ifm-hover-overlay:#0000000d;--ifm-font-color-base:var(--ifm-color-content);--ifm-font-color-base-inverse:var(--ifm-color-content-inverse);--ifm-font-color-secondary:var(--ifm-color-content-secondary);--ifm-font-family-base:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ifm-font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--ifm-font-size-base:100%;--ifm-font-weight-light:300;--ifm-font-weight-normal:400;--ifm-font-weight-semibold:500;--ifm-font-weight-bold:700;--ifm-font-weight-base:var(--ifm-font-weight-normal);--ifm-line-height-base:1.65;--ifm-global-spacing:1rem;--ifm-spacing-vertical:var(--ifm-global-spacing);--ifm-spacing-horizontal:var(--ifm-global-spacing);--ifm-transition-fast:200ms;--ifm-transition-slow:400ms;--ifm-transition-timing-default:cubic-bezier(0.08,0.52,0.52,1);--ifm-global-shadow-lw:0 1px 2px 0 #0000001a;--ifm-global-shadow-md:0 5px 40px #0003;--ifm-global-shadow-tl:0 12px 28px 0 #0003,0 2px 4px 0 #0000001a;--ifm-z-index-dropdown:100;--ifm-z-index-fixed:200;--ifm-z-index-overlay:400;--ifm-container-width:1140px;--ifm-container-width-xl:1320px;--ifm-code-background:#f6f7f8;--ifm-code-border-radius:var(--ifm-global-radius);--ifm-code-font-size:90%;--ifm-code-padding-horizontal:0.1rem;--ifm-code-padding-vertical:0.1rem;--ifm-pre-background:var(--ifm-code-background);--ifm-pre-border-radius:var(--ifm-code-border-radius);--ifm-pre-color:inherit;--ifm-pre-line-height:1.45;--ifm-pre-padding:1rem;--ifm-heading-color:inherit;--ifm-heading-margin-top:0;--ifm-heading-margin-bottom:var(--ifm-spacing-vertical);--ifm-heading-font-family:var(--ifm-font-family-base);--ifm-heading-font-weight:var(--ifm-font-weight-bold);--ifm-heading-line-height:1.25;--ifm-h1-font-size:2rem;--ifm-h2-font-size:1.5rem;--ifm-h3-font-size:1.25rem;--ifm-h4-font-size:1rem;--ifm-h5-font-size:0.875rem;--ifm-h6-font-size:0.85rem;--ifm-image-alignment-padding:1.25rem;--ifm-leading-desktop:1.25;--ifm-leading:calc(var(--ifm-leading-desktop)*1rem);--ifm-list-left-padding:2rem;--ifm-list-margin:1rem;--ifm-list-item-margin:0.25rem;--ifm-list-paragraph-margin:1rem;--ifm-table-cell-padding:0.75rem;--ifm-table-background:#0000;--ifm-table-stripe-background:#00000008;--ifm-table-border-width:1px;--ifm-table-border-color:var(--ifm-color-emphasis-300);--ifm-table-head-background:inherit;--ifm-table-head-color:inherit;--ifm-table-head-font-weight:var(--ifm-font-weight-bold);--ifm-table-cell-color:inherit;--ifm-link-color:var(--ifm-color-primary);--ifm-link-decoration:none;--ifm-link-hover-color:var(--ifm-link-color);--ifm-link-hover-decoration:underline;--ifm-paragraph-margin-bottom:var(--ifm-leading);--ifm-blockquote-font-size:var(--ifm-font-size-base);--ifm-blockquote-border-left-width:2px;--ifm-blockquote-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-blockquote-padding-vertical:0;--ifm-blockquote-shadow:none;--ifm-blockquote-color:var(--ifm-color-emphasis-800);--ifm-blockquote-border-color:var(--ifm-color-emphasis-300);--ifm-hr-background-color:var(--ifm-color-emphasis-500);--ifm-hr-height:1px;--ifm-hr-margin-vertical:1.5rem;--ifm-scrollbar-size:7px;--ifm-scrollbar-track-background-color:#f1f1f1;--ifm-scrollbar-thumb-background-color:silver;--ifm-scrollbar-thumb-hover-background-color:#a7a7a7;--ifm-alert-background-color:inherit;--ifm-alert-border-color:inherit;--ifm-alert-border-radius:var(--ifm-global-radius);--ifm-alert-border-width:0px;--ifm-alert-border-left-width:5px;--ifm-alert-color:var(--ifm-font-color-base);--ifm-alert-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-alert-padding-vertical:var(--ifm-spacing-vertical);--ifm-alert-shadow:var(--ifm-global-shadow-lw);--ifm-avatar-intro-margin:1rem;--ifm-avatar-intro-alignment:inherit;--ifm-avatar-photo-size:3rem;--ifm-badge-background-color:inherit;--ifm-badge-border-color:inherit;--ifm-badge-border-radius:var(--ifm-global-radius);--ifm-badge-border-width:var(--ifm-global-border-width);--ifm-badge-color:var(--ifm-color-white);--ifm-badge-padding-horizontal:calc(var(--ifm-spacing-horizontal)*0.5);--ifm-badge-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-breadcrumb-border-radius:1.5rem;--ifm-breadcrumb-spacing:0.5rem;--ifm-breadcrumb-color-active:var(--ifm-color-primary);--ifm-breadcrumb-item-background-active:var(--ifm-hover-overlay);--ifm-breadcrumb-padding-horizontal:0.8rem;--ifm-breadcrumb-padding-vertical:0.4rem;--ifm-breadcrumb-size-multiplier:1;--ifm-breadcrumb-separator:url('data:image/svg+xml;utf8,');--ifm-breadcrumb-separator-filter:none;--ifm-breadcrumb-separator-size:0.5rem;--ifm-breadcrumb-separator-size-multiplier:1.25;--ifm-button-background-color:inherit;--ifm-button-border-color:var(--ifm-button-background-color);--ifm-button-border-width:var(--ifm-global-border-width);--ifm-button-font-weight:var(--ifm-font-weight-bold);--ifm-button-padding-horizontal:1.5rem;--ifm-button-padding-vertical:0.375rem;--ifm-button-size-multiplier:1;--ifm-button-transition-duration:var(--ifm-transition-fast);--ifm-button-border-radius:calc(var(--ifm-global-radius)*var(--ifm-button-size-multiplier));--ifm-button-group-spacing:2px;--ifm-card-background-color:var(--ifm-background-surface-color);--ifm-card-border-radius:calc(var(--ifm-global-radius)*2);--ifm-card-horizontal-spacing:var(--ifm-global-spacing);--ifm-card-vertical-spacing:var(--ifm-global-spacing);--ifm-toc-border-color:var(--ifm-color-emphasis-300);--ifm-toc-link-color:var(--ifm-color-content-secondary);--ifm-toc-padding-vertical:0.5rem;--ifm-toc-padding-horizontal:0.5rem;--ifm-dropdown-background-color:var(--ifm-background-surface-color);--ifm-dropdown-font-weight:var(--ifm-font-weight-semibold);--ifm-dropdown-link-color:var(--ifm-font-color-base);--ifm-dropdown-hover-background-color:var(--ifm-hover-overlay);--ifm-footer-background-color:var(--ifm-color-emphasis-100);--ifm-footer-color:inherit;--ifm-footer-link-color:var(--ifm-color-emphasis-700);--ifm-footer-link-hover-color:var(--ifm-color-primary);--ifm-footer-link-horizontal-spacing:0.5rem;--ifm-footer-padding-horizontal:calc(var(--ifm-spacing-horizontal)*2);--ifm-footer-padding-vertical:calc(var(--ifm-spacing-vertical)*2);--ifm-footer-title-color:inherit;--ifm-footer-logo-max-width:min(30rem,90vw);--ifm-hero-background-color:var(--ifm-background-surface-color);--ifm-hero-text-color:var(--ifm-color-emphasis-800);--ifm-menu-color:var(--ifm-color-emphasis-700);--ifm-menu-color-active:var(--ifm-color-primary);--ifm-menu-color-background-active:var(--ifm-hover-overlay);--ifm-menu-color-background-hover:var(--ifm-hover-overlay);--ifm-menu-link-padding-horizontal:0.75rem;--ifm-menu-link-padding-vertical:0.375rem;--ifm-menu-link-sublist-icon:url('data:image/svg+xml;utf8,');--ifm-menu-link-sublist-icon-filter:none;--ifm-navbar-background-color:var(--ifm-background-surface-color);--ifm-navbar-height:3.75rem;--ifm-navbar-item-padding-horizontal:0.75rem;--ifm-navbar-item-padding-vertical:0.25rem;--ifm-navbar-link-color:var(--ifm-font-color-base);--ifm-navbar-link-active-color:var(--ifm-link-color);--ifm-navbar-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-navbar-padding-vertical:calc(var(--ifm-spacing-vertical)*0.5);--ifm-navbar-shadow:var(--ifm-global-shadow-lw);--ifm-navbar-search-input-background-color:var(--ifm-color-emphasis-200);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-800);--ifm-navbar-search-input-placeholder-color:var(--ifm-color-emphasis-500);--ifm-navbar-search-input-icon:url('data:image/svg+xml;utf8,');--ifm-navbar-sidebar-width:83vw;--ifm-pagination-border-radius:var(--ifm-global-radius);--ifm-pagination-color-active:var(--ifm-color-primary);--ifm-pagination-font-size:1rem;--ifm-pagination-item-active-background:var(--ifm-hover-overlay);--ifm-pagination-page-spacing:0.2em;--ifm-pagination-padding-horizontal:calc(var(--ifm-spacing-horizontal)*1);--ifm-pagination-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-pagination-nav-border-radius:var(--ifm-global-radius);--ifm-pagination-nav-color-hover:var(--ifm-color-primary);--ifm-pills-color-active:var(--ifm-color-primary);--ifm-pills-color-background-active:var(--ifm-hover-overlay);--ifm-pills-spacing:0.125rem;--ifm-tabs-color:var(--ifm-font-color-secondary);--ifm-tabs-color-active:var(--ifm-color-primary);--ifm-tabs-color-active-border:var(--ifm-tabs-color-active);--ifm-tabs-padding-horizontal:1rem;--ifm-tabs-padding-vertical:1rem;--docusaurus-progress-bar-color:var(--ifm-color-primary);--ifm-color-primary:#25c2a0;--ifm-color-primary-dark:#21af90;--ifm-color-primary-darker:#1fa588;--ifm-color-primary-darkest:#1a8870;--ifm-color-primary-light:#46cbae;--ifm-color-primary-lighter:#66d4bd;--ifm-color-primary-lightest:#92e0d0;--ifm-code-font-size:95%;--docusaurus-tag-list-border:var(--ifm-color-emphasis-300);--docsearch-primary-color:#5468ff;--docsearch-text-color:#1c1e21;--docsearch-spacing:12px;--docsearch-icon-stroke-width:1.4;--docsearch-highlight-color:var(--docsearch-primary-color);--docsearch-muted-color:#969faf;--docsearch-container-background:#656c85cc;--docsearch-logo-color:#5468ff;--docsearch-modal-width:560px;--docsearch-modal-height:600px;--docsearch-modal-background:#f5f6f7;--docsearch-modal-shadow:inset 1px 1px 0 0 #ffffff80,0 3px 8px 0 #555a64;--docsearch-searchbox-height:56px;--docsearch-searchbox-background:#ebedf0;--docsearch-searchbox-focus-background:#fff;--docsearch-searchbox-shadow:inset 0 0 0 2px var(--docsearch-primary-color);--docsearch-hit-height:56px;--docsearch-hit-color:#444950;--docsearch-hit-active-color:#fff;--docsearch-hit-background:#fff;--docsearch-hit-shadow:0 1px 3px 0 #d4d9e1;--docsearch-key-gradient:linear-gradient(-225deg,#d5dbe4,#f8f8f8);--docsearch-key-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 2px 1px #1e235a66;--docsearch-footer-height:44px;--docsearch-footer-background:#fff;--docsearch-footer-shadow:0 -1px 0 0 #e0e3e8,0 -3px 6px 0 #45629b1f;--docsearch-primary-color:var(--ifm-color-primary);--docsearch-text-color:var(--ifm-font-color-base);--docusaurus-announcement-bar-height:auto;--docusaurus-collapse-button-bg:#0000;--docusaurus-collapse-button-bg-hover:#0000001a;--doc-sidebar-width:300px;--doc-sidebar-hidden-width:30px}.badge--danger,.badge--info,.badge--primary,.badge--secondary,.badge--success,.badge--warning{--ifm-badge-border-color:var(--ifm-badge-background-color)}.button--link,.button--outline{--ifm-button-background-color:#0000}html{background-color:var(--ifm-background-color);color:var(--ifm-font-color-base);color-scheme:var(--ifm-color-scheme);font:var(--ifm-font-size-base)/var(--ifm-line-height-base) var(--ifm-font-family-base);-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility;-webkit-text-size-adjust:100%;text-size-adjust:100%}iframe{border:0;color-scheme:auto}.container{margin:0 auto;max-width:var(--ifm-container-width)}.container--fluid{max-width:inherit}.row{display:flex;flex-wrap:wrap;margin:0 calc(var(--ifm-spacing-horizontal)*-1)}.margin-bottom--none,.margin-vert--none,.markdown>:last-child{margin-bottom:0!important}.margin-top--none,.margin-vert--none,.tabItem_LNqP{margin-top:0!important}.row--no-gutters{margin-left:0;margin-right:0}.margin-horiz--none,.margin-right--none{margin-right:0!important}.row--no-gutters>.col{padding-left:0;padding-right:0}.row--align-top{align-items:flex-start}.row--align-bottom{align-items:flex-end}.menuExternalLink_NmtK,.row--align-center{align-items:center}.row--align-stretch{align-items:stretch}.row--align-baseline{align-items:baseline}.col{--ifm-col-width:100%;flex:1 0;margin-left:0;max-width:var(--ifm-col-width)}.padding-bottom--none,.padding-vert--none{padding-bottom:0!important}.padding-top--none,.padding-vert--none{padding-top:0!important}.padding-horiz--none,.padding-left--none{padding-left:0!important}.padding-horiz--none,.padding-right--none{padding-right:0!important}.col[class*=col--]{flex:0 0 var(--ifm-col-width)}.col--1{--ifm-col-width:8.33333%}.col--offset-1{margin-left:8.33333%}.col--2{--ifm-col-width:16.66667%}.col--offset-2{margin-left:16.66667%}.col--3{--ifm-col-width:25%}.col--offset-3{margin-left:25%}.col--4{--ifm-col-width:33.33333%}.col--offset-4{margin-left:33.33333%}.col--5{--ifm-col-width:41.66667%}.col--offset-5{margin-left:41.66667%}.col--6{--ifm-col-width:50%}.col--offset-6{margin-left:50%}.col--7{--ifm-col-width:58.33333%}.col--offset-7{margin-left:58.33333%}.col--8{--ifm-col-width:66.66667%}.col--offset-8{margin-left:66.66667%}.col--9{--ifm-col-width:75%}.col--offset-9{margin-left:75%}.col--10{--ifm-col-width:83.33333%}.col--offset-10{margin-left:83.33333%}.col--11{--ifm-col-width:91.66667%}.col--offset-11{margin-left:91.66667%}.col--12{--ifm-col-width:100%}.col--offset-12{margin-left:100%}.margin-horiz--none,.margin-left--none{margin-left:0!important}.margin--none{margin:0!important}.margin-bottom--xs,.margin-vert--xs{margin-bottom:.25rem!important}.margin-top--xs,.margin-vert--xs{margin-top:.25rem!important}.margin-horiz--xs,.margin-left--xs{margin-left:.25rem!important}.margin-horiz--xs,.margin-right--xs{margin-right:.25rem!important}.margin--xs{margin:.25rem!important}.margin-bottom--sm,.margin-vert--sm{margin-bottom:.5rem!important}.margin-top--sm,.margin-vert--sm{margin-top:.5rem!important}.margin-horiz--sm,.margin-left--sm{margin-left:.5rem!important}.margin-horiz--sm,.margin-right--sm{margin-right:.5rem!important}.margin--sm{margin:.5rem!important}.margin-bottom--md,.margin-vert--md{margin-bottom:1rem!important}.margin-top--md,.margin-vert--md{margin-top:1rem!important}.margin-horiz--md,.margin-left--md{margin-left:1rem!important}.margin-horiz--md,.margin-right--md{margin-right:1rem!important}.margin--md{margin:1rem!important}.margin-bottom--lg,.margin-vert--lg{margin-bottom:2rem!important}.margin-top--lg,.margin-vert--lg{margin-top:2rem!important}.margin-horiz--lg,.margin-left--lg{margin-left:2rem!important}.margin-horiz--lg,.margin-right--lg{margin-right:2rem!important}.margin--lg{margin:2rem!important}.margin-bottom--xl,.margin-vert--xl{margin-bottom:5rem!important}.margin-top--xl,.margin-vert--xl{margin-top:5rem!important}.margin-horiz--xl,.margin-left--xl{margin-left:5rem!important}.margin-horiz--xl,.margin-right--xl{margin-right:5rem!important}.margin--xl{margin:5rem!important}.padding--none{padding:0!important}.padding-bottom--xs,.padding-vert--xs{padding-bottom:.25rem!important}.padding-top--xs,.padding-vert--xs{padding-top:.25rem!important}.padding-horiz--xs,.padding-left--xs{padding-left:.25rem!important}.padding-horiz--xs,.padding-right--xs{padding-right:.25rem!important}.padding--xs{padding:.25rem!important}.padding-bottom--sm,.padding-vert--sm{padding-bottom:.5rem!important}.padding-top--sm,.padding-vert--sm{padding-top:.5rem!important}.padding-horiz--sm,.padding-left--sm{padding-left:.5rem!important}.padding-horiz--sm,.padding-right--sm{padding-right:.5rem!important}.padding--sm{padding:.5rem!important}.padding-bottom--md,.padding-vert--md{padding-bottom:1rem!important}.padding-top--md,.padding-vert--md{padding-top:1rem!important}.padding-horiz--md,.padding-left--md{padding-left:1rem!important}.padding-horiz--md,.padding-right--md{padding-right:1rem!important}.padding--md{padding:1rem!important}.padding-bottom--lg,.padding-vert--lg{padding-bottom:2rem!important}.padding-top--lg,.padding-vert--lg{padding-top:2rem!important}.padding-horiz--lg,.padding-left--lg{padding-left:2rem!important}.padding-horiz--lg,.padding-right--lg{padding-right:2rem!important}.padding--lg{padding:2rem!important}.padding-bottom--xl,.padding-vert--xl{padding-bottom:5rem!important}.padding-top--xl,.padding-vert--xl{padding-top:5rem!important}.padding-horiz--xl,.padding-left--xl{padding-left:5rem!important}.padding-horiz--xl,.padding-right--xl{padding-right:5rem!important}.padding--xl{padding:5rem!important}code{background-color:var(--ifm-code-background);border:.1rem solid #0000001a;border-radius:var(--ifm-code-border-radius);font-family:var(--ifm-font-family-monospace);font-size:var(--ifm-code-font-size);padding:var(--ifm-code-padding-vertical) var(--ifm-code-padding-horizontal)}a code{color:inherit}pre{background-color:var(--ifm-pre-background);border-radius:var(--ifm-pre-border-radius);color:var(--ifm-pre-color);font:var(--ifm-code-font-size)/var(--ifm-pre-line-height) var(--ifm-font-family-monospace);padding:var(--ifm-pre-padding)}pre code{background-color:initial;border:none;font-size:100%;line-height:inherit;padding:0}kbd{background-color:var(--ifm-color-emphasis-0);border:1px solid var(--ifm-color-emphasis-400);border-radius:.2rem;box-shadow:inset 0 -1px 0 var(--ifm-color-emphasis-400);color:var(--ifm-color-emphasis-800);font:80% var(--ifm-font-family-monospace);padding:.15rem .3rem}h1,h2,h3,h4,h5,h6{color:var(--ifm-heading-color);font-family:var(--ifm-heading-font-family);font-weight:var(--ifm-heading-font-weight);line-height:var(--ifm-heading-line-height);margin:var(--ifm-heading-margin-top) 0 var(--ifm-heading-margin-bottom) 0}h1{font-size:var(--ifm-h1-font-size)}h2{font-size:var(--ifm-h2-font-size)}h3{font-size:var(--ifm-h3-font-size)}h4{font-size:var(--ifm-h4-font-size)}h5{font-size:var(--ifm-h5-font-size)}h6{font-size:var(--ifm-h6-font-size)}img{max-width:100%}img[align=right]{padding-left:var(--image-alignment-padding)}img[align=left]{padding-right:var(--image-alignment-padding)}.markdown{--ifm-h1-vertical-rhythm-top:3;--ifm-h2-vertical-rhythm-top:2;--ifm-h3-vertical-rhythm-top:1.5;--ifm-heading-vertical-rhythm-top:1.25;--ifm-h1-vertical-rhythm-bottom:1.25;--ifm-heading-vertical-rhythm-bottom:1}.markdown:after,.markdown:before{content:"";display:table}.markdown:after{clear:both}.markdown h1:first-child{--ifm-h1-font-size:3rem;margin-bottom:calc(var(--ifm-h1-vertical-rhythm-bottom)*var(--ifm-leading))}.markdown>h2{--ifm-h2-font-size:2rem;margin-top:calc(var(--ifm-h2-vertical-rhythm-top)*var(--ifm-leading))}.markdown>h3{--ifm-h3-font-size:1.5rem;margin-top:calc(var(--ifm-h3-vertical-rhythm-top)*var(--ifm-leading))}.markdown>h4,.markdown>h5,.markdown>h6{margin-top:calc(var(--ifm-heading-vertical-rhythm-top)*var(--ifm-leading))}.markdown>p,.markdown>pre,.markdown>ul,.tabList__CuJ{margin-bottom:var(--ifm-leading)}.markdown li>p{margin-top:var(--ifm-list-paragraph-margin)}.markdown li+li{margin-top:var(--ifm-list-item-margin)}ol,ul{margin:0 0 var(--ifm-list-margin);padding-left:var(--ifm-list-left-padding)}ol ol,ul ol{list-style-type:lower-roman}ol ol ol,ol ul ol,ul ol ol,ul ul ol{list-style-type:lower-alpha}table{border-collapse:collapse;display:block;margin-bottom:var(--ifm-spacing-vertical)}table thead tr{border-bottom:2px solid var(--ifm-table-border-color)}table thead,table tr:nth-child(2n){background-color:var(--ifm-table-stripe-background)}table tr{background-color:var(--ifm-table-background);border-top:var(--ifm-table-border-width) solid var(--ifm-table-border-color)}table td,table th{border:var(--ifm-table-border-width) solid var(--ifm-table-border-color);padding:var(--ifm-table-cell-padding)}table th{background-color:var(--ifm-table-head-background);color:var(--ifm-table-head-color);font-weight:var(--ifm-table-head-font-weight)}table td{color:var(--ifm-table-cell-color)}strong{font-weight:var(--ifm-font-weight-bold)}a{color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}a:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button:hover,.text--no-decoration,.text--no-decoration:hover,a:not([href]){-webkit-text-decoration:none;text-decoration:none}p{margin:0 0 var(--ifm-paragraph-margin-bottom)}blockquote{border-left:var(--ifm-blockquote-border-left-width) solid var(--ifm-blockquote-border-color);box-shadow:var(--ifm-blockquote-shadow);color:var(--ifm-blockquote-color);font-size:var(--ifm-blockquote-font-size);padding:var(--ifm-blockquote-padding-vertical) var(--ifm-blockquote-padding-horizontal)}blockquote>:first-child{margin-top:0}blockquote>:last-child{margin-bottom:0}hr{background-color:var(--ifm-hr-background-color);border:0;height:var(--ifm-hr-height);margin:var(--ifm-hr-margin-vertical) 0}.shadow--lw{box-shadow:var(--ifm-global-shadow-lw)!important}.shadow--md{box-shadow:var(--ifm-global-shadow-md)!important}.shadow--tl{box-shadow:var(--ifm-global-shadow-tl)!important}.text--primary{color:var(--ifm-color-primary)}.text--secondary{color:var(--ifm-color-secondary)}.text--success{color:var(--ifm-color-success)}.text--info{color:var(--ifm-color-info)}.text--warning{color:var(--ifm-color-warning)}.text--danger{color:var(--ifm-color-danger)}.text--center{text-align:center}.text--left{text-align:left}.text--justify{text-align:justify}.text--right{text-align:right}.text--capitalize{text-transform:capitalize}.text--lowercase{text-transform:lowercase}.admonitionHeading_Gvgb,.alert__heading,.text--uppercase{text-transform:uppercase}.text--light{font-weight:var(--ifm-font-weight-light)}.text--normal{font-weight:var(--ifm-font-weight-normal)}.text--semibold{font-weight:var(--ifm-font-weight-semibold)}.text--bold{font-weight:var(--ifm-font-weight-bold)}.text--italic{font-style:italic}.text--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text--break{word-wrap:break-word!important;word-break:break-word!important}.clean-btn{background:none;border:none;color:inherit;cursor:pointer;font-family:inherit;padding:0}.alert,.alert .close{color:var(--ifm-alert-foreground-color)}.clean-list{list-style:none;padding-left:0}.alert--primary{--ifm-alert-background-color:var(--ifm-color-primary-contrast-background);--ifm-alert-background-color-highlight:#3578e526;--ifm-alert-foreground-color:var(--ifm-color-primary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-primary-dark)}.alert--secondary{--ifm-alert-background-color:var(--ifm-color-secondary-contrast-background);--ifm-alert-background-color-highlight:#ebedf026;--ifm-alert-foreground-color:var(--ifm-color-secondary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-secondary-dark)}.alert--success{--ifm-alert-background-color:var(--ifm-color-success-contrast-background);--ifm-alert-background-color-highlight:#00a40026;--ifm-alert-foreground-color:var(--ifm-color-success-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-success-dark)}.alert--info{--ifm-alert-background-color:var(--ifm-color-info-contrast-background);--ifm-alert-background-color-highlight:#54c7ec26;--ifm-alert-foreground-color:var(--ifm-color-info-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-info-dark)}.alert--warning{--ifm-alert-background-color:var(--ifm-color-warning-contrast-background);--ifm-alert-background-color-highlight:#ffba0026;--ifm-alert-foreground-color:var(--ifm-color-warning-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-warning-dark)}.alert--danger{--ifm-alert-background-color:var(--ifm-color-danger-contrast-background);--ifm-alert-background-color-highlight:#fa383e26;--ifm-alert-foreground-color:var(--ifm-color-danger-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-danger-dark)}.alert{--ifm-code-background:var(--ifm-alert-background-color-highlight);--ifm-link-color:var(--ifm-alert-foreground-color);--ifm-link-hover-color:var(--ifm-alert-foreground-color);--ifm-link-decoration:underline;--ifm-tabs-color:var(--ifm-alert-foreground-color);--ifm-tabs-color-active:var(--ifm-alert-foreground-color);--ifm-tabs-color-active-border:var(--ifm-alert-border-color);background-color:var(--ifm-alert-background-color);border:var(--ifm-alert-border-width) solid var(--ifm-alert-border-color);border-left-width:var(--ifm-alert-border-left-width);border-radius:var(--ifm-alert-border-radius);box-shadow:var(--ifm-alert-shadow);padding:var(--ifm-alert-padding-vertical) var(--ifm-alert-padding-horizontal)}.alert__heading{align-items:center;display:flex;font:700 var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.5rem}.alert__icon{display:inline-flex;margin-right:.4em}.alert__icon svg{fill:var(--ifm-alert-foreground-color);stroke:var(--ifm-alert-foreground-color);stroke-width:0}.alert .close{margin:calc(var(--ifm-alert-padding-vertical)*-1) calc(var(--ifm-alert-padding-horizontal)*-1) 0 0;opacity:.75}.alert .close:focus,.alert .close:hover{opacity:1}.alert a{text-decoration-color:var(--ifm-alert-border-color)}.alert a:hover{text-decoration-thickness:2px}.avatar{column-gap:var(--ifm-avatar-intro-margin);display:flex}.avatar__photo{border-radius:50%;display:block;height:var(--ifm-avatar-photo-size);overflow:hidden;width:var(--ifm-avatar-photo-size)}.card--full-height,.navbar__logo img,body,html{height:100%}.avatar__photo--sm{--ifm-avatar-photo-size:2rem}.avatar__photo--lg{--ifm-avatar-photo-size:4rem}.avatar__photo--xl{--ifm-avatar-photo-size:6rem}.avatar__intro{display:flex;flex:1 1;flex-direction:column;justify-content:center;text-align:var(--ifm-avatar-intro-alignment)}.badge,.breadcrumbs__item,.breadcrumbs__link,.button,.dropdown>.navbar__link:after{display:inline-block}.avatar__name{font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base)}.avatar__subtitle{margin-top:.25rem}.avatar--vertical{--ifm-avatar-intro-alignment:center;--ifm-avatar-intro-margin:0.5rem;align-items:center;flex-direction:column}.badge{background-color:var(--ifm-badge-background-color);border:var(--ifm-badge-border-width) solid var(--ifm-badge-border-color);border-radius:var(--ifm-badge-border-radius);color:var(--ifm-badge-color);font-size:75%;font-weight:var(--ifm-font-weight-bold);line-height:1;padding:var(--ifm-badge-padding-vertical) var(--ifm-badge-padding-horizontal)}.badge--primary{--ifm-badge-background-color:var(--ifm-color-primary)}.badge--secondary{--ifm-badge-background-color:var(--ifm-color-secondary);color:var(--ifm-color-black)}.breadcrumbs__link,.button.button--secondary.button--outline:not(.button--active):not(:hover){color:var(--ifm-font-color-base)}.badge--success{--ifm-badge-background-color:var(--ifm-color-success)}.badge--info{--ifm-badge-background-color:var(--ifm-color-info)}.badge--warning{--ifm-badge-background-color:var(--ifm-color-warning)}.badge--danger{--ifm-badge-background-color:var(--ifm-color-danger)}.breadcrumbs{margin-bottom:0;padding-left:0}.breadcrumbs__item:not(:last-child):after{background:var(--ifm-breadcrumb-separator) center;content:" ";display:inline-block;filter:var(--ifm-breadcrumb-separator-filter);height:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier));margin:0 var(--ifm-breadcrumb-spacing);opacity:.5;width:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier))}.breadcrumbs__item--active .breadcrumbs__link{background:var(--ifm-breadcrumb-item-background-active);color:var(--ifm-breadcrumb-color-active)}.breadcrumbs__link{border-radius:var(--ifm-breadcrumb-border-radius);font-size:calc(1rem*var(--ifm-breadcrumb-size-multiplier));padding:calc(var(--ifm-breadcrumb-padding-vertical)*var(--ifm-breadcrumb-size-multiplier)) calc(var(--ifm-breadcrumb-padding-horizontal)*var(--ifm-breadcrumb-size-multiplier));transition-duration:var(--ifm-transition-fast);transition-property:background,color}.breadcrumbs__link:any-link:hover,.breadcrumbs__link:link:hover,.breadcrumbs__link:visited:hover,area[href].breadcrumbs__link:hover{background:var(--ifm-breadcrumb-item-background-active);-webkit-text-decoration:none;text-decoration:none}.breadcrumbs--sm{--ifm-breadcrumb-size-multiplier:0.8}.breadcrumbs--lg{--ifm-breadcrumb-size-multiplier:1.2}.button{background-color:var(--ifm-button-background-color);border:var(--ifm-button-border-width) solid var(--ifm-button-border-color);border-radius:var(--ifm-button-border-radius);cursor:pointer;font-size:calc(.875rem*var(--ifm-button-size-multiplier));font-weight:var(--ifm-button-font-weight);line-height:1.5;padding:calc(var(--ifm-button-padding-vertical)*var(--ifm-button-size-multiplier)) calc(var(--ifm-button-padding-horizontal)*var(--ifm-button-size-multiplier));text-align:center;transition-duration:var(--ifm-button-transition-duration);transition-property:color,background,border-color;-webkit-user-select:none;user-select:none;white-space:nowrap}.button,.button:hover{color:var(--ifm-button-color)}.button--outline{--ifm-button-color:var(--ifm-button-border-color)}.button--outline:hover{--ifm-button-background-color:var(--ifm-button-border-color)}.button--link{--ifm-button-border-color:#0000;color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}.button--link.button--active,.button--link:active,.button--link:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.DocSearch-Container a,.dropdown__link--active,.dropdown__link:hover,.menu__link:hover,.navbar__brand:hover,.navbar__link--active,.navbar__link:hover,.pagination-nav__link:hover,.pagination__link:hover,.tag_zVej:hover{-webkit-text-decoration:none;text-decoration:none}.button.disabled,.button:disabled,.button[disabled]{opacity:.65;pointer-events:none}.button--sm{--ifm-button-size-multiplier:0.8}.button--lg{--ifm-button-size-multiplier:1.35}.button--block{display:block;width:100%}.button.button--secondary{color:var(--ifm-color-gray-900)}:where(.button--primary){--ifm-button-background-color:var(--ifm-color-primary);--ifm-button-border-color:var(--ifm-color-primary)}:where(.button--primary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-primary-dark);--ifm-button-border-color:var(--ifm-color-primary-dark)}.button--primary.button--active,.button--primary:active{--ifm-button-background-color:var(--ifm-color-primary-darker);--ifm-button-border-color:var(--ifm-color-primary-darker)}:where(.button--secondary){--ifm-button-background-color:var(--ifm-color-secondary);--ifm-button-border-color:var(--ifm-color-secondary)}:where(.button--secondary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-secondary-dark);--ifm-button-border-color:var(--ifm-color-secondary-dark)}.button--secondary.button--active,.button--secondary:active{--ifm-button-background-color:var(--ifm-color-secondary-darker);--ifm-button-border-color:var(--ifm-color-secondary-darker)}:where(.button--success){--ifm-button-background-color:var(--ifm-color-success);--ifm-button-border-color:var(--ifm-color-success)}:where(.button--success):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-success-dark);--ifm-button-border-color:var(--ifm-color-success-dark)}.button--success.button--active,.button--success:active{--ifm-button-background-color:var(--ifm-color-success-darker);--ifm-button-border-color:var(--ifm-color-success-darker)}:where(.button--info){--ifm-button-background-color:var(--ifm-color-info);--ifm-button-border-color:var(--ifm-color-info)}:where(.button--info):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-info-dark);--ifm-button-border-color:var(--ifm-color-info-dark)}.button--info.button--active,.button--info:active{--ifm-button-background-color:var(--ifm-color-info-darker);--ifm-button-border-color:var(--ifm-color-info-darker)}:where(.button--warning){--ifm-button-background-color:var(--ifm-color-warning);--ifm-button-border-color:var(--ifm-color-warning)}:where(.button--warning):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-warning-dark);--ifm-button-border-color:var(--ifm-color-warning-dark)}.button--warning.button--active,.button--warning:active{--ifm-button-background-color:var(--ifm-color-warning-darker);--ifm-button-border-color:var(--ifm-color-warning-darker)}:where(.button--danger){--ifm-button-background-color:var(--ifm-color-danger);--ifm-button-border-color:var(--ifm-color-danger)}:where(.button--danger):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-danger-dark);--ifm-button-border-color:var(--ifm-color-danger-dark)}.button--danger.button--active,.button--danger:active{--ifm-button-background-color:var(--ifm-color-danger-darker);--ifm-button-border-color:var(--ifm-color-danger-darker)}.button-group{display:inline-flex;gap:var(--ifm-button-group-spacing)}.button-group>.button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.button-group>.button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.button-group--block{display:flex;justify-content:stretch}.button-group--block>.button{flex-grow:1}.card{background-color:var(--ifm-card-background-color);border-radius:var(--ifm-card-border-radius);box-shadow:var(--ifm-global-shadow-lw);display:flex;flex-direction:column;overflow:hidden}.card__image{padding-top:var(--ifm-card-vertical-spacing)}.card__image:first-child{padding-top:0}.card__body,.card__footer,.card__header{padding:var(--ifm-card-vertical-spacing) var(--ifm-card-horizontal-spacing)}.card__body:not(:last-child),.card__footer:not(:last-child),.card__header:not(:last-child){padding-bottom:0}.card__body>:last-child,.card__footer>:last-child,.card__header>:last-child{margin-bottom:0}.card__footer{margin-top:auto}.table-of-contents{font-size:.8rem;margin-bottom:0;padding:var(--ifm-toc-padding-vertical) 0}.table-of-contents,.table-of-contents ul{list-style:none;padding-left:var(--ifm-toc-padding-horizontal)}.table-of-contents li{margin:var(--ifm-toc-padding-vertical) var(--ifm-toc-padding-horizontal)}.table-of-contents__left-border{border-left:1px solid var(--ifm-toc-border-color)}.table-of-contents__link{color:var(--ifm-toc-link-color);display:block}.table-of-contents__link--active,.table-of-contents__link--active code,.table-of-contents__link:hover,.table-of-contents__link:hover code{color:var(--ifm-color-primary);-webkit-text-decoration:none;text-decoration:none}.close{color:var(--ifm-color-black);float:right;font-size:1.5rem;font-weight:var(--ifm-font-weight-bold);line-height:1;opacity:.5;padding:1rem;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.close:hover{opacity:.7}.close:focus,.theme-code-block-highlighted-line .codeLineNumber_Tfdd:before{opacity:.8}.dropdown{display:inline-flex;font-weight:var(--ifm-dropdown-font-weight);position:relative;vertical-align:top}.dropdown--hoverable:hover .dropdown__menu,.dropdown--show .dropdown__menu{opacity:1;pointer-events:all;transform:translateY(-1px);visibility:visible}#nprogress,.dropdown__menu,.navbar__item.dropdown .navbar__link:not([href]){pointer-events:none}.dropdown--right .dropdown__menu{left:inherit;right:0}.dropdown--nocaret .navbar__link:after{content:none!important}.dropdown__menu{background-color:var(--ifm-dropdown-background-color);border-radius:var(--ifm-global-radius);box-shadow:var(--ifm-global-shadow-md);left:0;list-style:none;max-height:80vh;min-width:10rem;opacity:0;overflow-y:auto;padding:.5rem;position:absolute;top:calc(100% - var(--ifm-navbar-item-padding-vertical) + .3rem);transform:translateY(-.625rem);transition-duration:var(--ifm-transition-fast);transition-property:opacity,transform,visibility;transition-timing-function:var(--ifm-transition-timing-default);visibility:hidden;z-index:var(--ifm-z-index-dropdown)}.menu__caret,.menu__link,.menu__list-item-collapsible{border-radius:.25rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.dropdown__link{border-radius:.25rem;color:var(--ifm-dropdown-link-color);display:block;font-size:.875rem;margin-top:.2rem;padding:.25rem .5rem;white-space:nowrap}.dropdown__link--active,.dropdown__link:hover{background-color:var(--ifm-dropdown-hover-background-color);color:var(--ifm-dropdown-link-color)}.dropdown__link--active,.dropdown__link--active:hover{--ifm-dropdown-link-color:var(--ifm-link-color)}.dropdown>.navbar__link:after{border-color:currentcolor #0000;border-style:solid;border-width:.4em .4em 0;content:"";margin-left:.3em;position:relative;top:2px;transform:translateY(-50%)}.footer{background-color:var(--ifm-footer-background-color);color:var(--ifm-footer-color);padding:var(--ifm-footer-padding-vertical) var(--ifm-footer-padding-horizontal)}.footer--dark{--ifm-footer-background-color:#303846;--ifm-footer-color:var(--ifm-footer-link-color);--ifm-footer-link-color:var(--ifm-color-secondary);--ifm-footer-title-color:var(--ifm-color-white)}.footer__links{margin-bottom:1rem}.footer__link-item{color:var(--ifm-footer-link-color);line-height:2}.footer__link-item:hover{color:var(--ifm-footer-link-hover-color)}.footer__link-separator{margin:0 var(--ifm-footer-link-horizontal-spacing)}.footer__logo{margin-top:1rem;max-width:var(--ifm-footer-logo-max-width)}.footer__title{color:var(--ifm-footer-title-color);font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base);margin-bottom:var(--ifm-heading-margin-bottom)}.menu,.navbar__link{font-weight:var(--ifm-font-weight-semibold)}.docItemContainer_Djhp article>:first-child,.docItemContainer_Djhp header+*,.footer__item{margin-top:0}.admonitionContent_BuS1>:last-child,.collapsibleContent_i85q p:last-child,.details_lb9f>summary>p:last-child,.footer__items,.tabItem_Ymn6>:last-child{margin-bottom:0}.codeBlockStandalone_MEMb,[type=checkbox]{padding:0}.hero{align-items:center;background-color:var(--ifm-hero-background-color);color:var(--ifm-hero-text-color);display:flex;padding:4rem 2rem}.hero--primary{--ifm-hero-background-color:var(--ifm-color-primary);--ifm-hero-text-color:var(--ifm-font-color-base-inverse)}.hero--dark{--ifm-hero-background-color:#303846;--ifm-hero-text-color:var(--ifm-color-white)}.hero__title{font-size:3rem}.hero__subtitle{font-size:1.5rem}.menu__list{list-style:none;margin:0;padding-left:0}.menu__caret,.menu__link{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu__list .menu__list{flex:0 0 100%;margin-top:.25rem;padding-left:var(--ifm-menu-link-padding-horizontal)}.menu__list-item:not(:first-child){margin-top:.25rem}.menu__list-item--collapsed .menu__list{height:0;overflow:hidden}.details_lb9f[data-collapsed=false].isBrowser_bmU9>summary:before,.details_lb9f[open]:not(.isBrowser_bmU9)>summary:before,.menu__list-item--collapsed .menu__caret:before,.menu__list-item--collapsed .menu__link--sublist:after{transform:rotate(90deg)}.menu__list-item-collapsible{display:flex;flex-wrap:wrap;position:relative}.menu__caret:hover,.menu__link:hover,.menu__list-item-collapsible--active,.menu__list-item-collapsible:hover{background:var(--ifm-menu-color-background-hover)}.menu__list-item-collapsible .menu__link--active,.menu__list-item-collapsible .menu__link:hover{background:none!important}.menu__caret,.menu__link{align-items:center;display:flex}.navbar-sidebar,.navbar-sidebar__backdrop{bottom:0;opacity:0;transition-duration:var(--ifm-transition-fast);transition-timing-function:ease-in-out;top:0;visibility:hidden;left:0}.menu__link{color:var(--ifm-menu-color);flex:1;line-height:1.25}.menu__link:hover{color:var(--ifm-menu-color)}.menu__caret:before,.menu__link--sublist-caret:after{height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast) linear;width:1.25rem;filter:var(--ifm-menu-link-sublist-icon-filter);content:""}.menu__link--sublist-caret:after{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem;margin-left:auto;min-width:1.25rem}.menu__link--active,.menu__link--active:hover{color:var(--ifm-menu-color-active)}.navbar__brand,.navbar__link{color:var(--ifm-navbar-link-color)}.menu__link--active:not(.menu__link--sublist){background-color:var(--ifm-menu-color-background-active)}.menu__caret:before{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem}.navbar--dark,html[data-theme=dark]{--ifm-menu-link-sublist-icon-filter:invert(100%) sepia(94%) saturate(17%) hue-rotate(223deg) brightness(104%) contrast(98%)}.navbar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-navbar-shadow);height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar,.navbar>.container,.navbar>.container-fluid{display:flex}.navbar--fixed-top{position:sticky;top:0;z-index:var(--ifm-z-index-fixed)}.navbar__inner{display:flex;flex-wrap:wrap;justify-content:space-between;width:100%}.navbar__brand{align-items:center;display:flex;margin-right:1rem;min-width:0}.navbar__brand:hover{color:var(--ifm-navbar-link-hover-color)}.announcementBarContent_xLdY,.navbar__title{flex:1 1 auto}.navbar__toggle{display:none;margin-right:.5rem}.navbar__logo{flex:0 0 auto;height:2rem;margin-right:.5rem}.navbar__items{align-items:center;display:flex;flex:1;min-width:0}.navbar__items--center{flex:0 0 auto}.navbar__items--center .navbar__brand,.popup_wph0 p{margin:0}.navbar__items--center+.navbar__items--right{flex:1}.navbar__items--right{flex:0 0 auto;justify-content:flex-end}.navbar__items--right>:last-child{padding-right:0}.navbar__item{display:inline-block;padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.navbar__link--active,.navbar__link:hover{color:var(--ifm-navbar-link-hover-color)}.navbar--dark,.navbar--primary{--ifm-menu-color:var(--ifm-color-gray-300);--ifm-navbar-link-color:var(--ifm-color-gray-100);--ifm-navbar-search-input-background-color:#ffffff1a;--ifm-navbar-search-input-placeholder-color:#ffffff80;color:var(--ifm-color-white)}.navbar--dark{--ifm-navbar-background-color:#242526;--ifm-menu-color-background-active:#ffffff0d;--ifm-navbar-search-input-color:var(--ifm-color-white)}.navbar--primary{--ifm-navbar-background-color:var(--ifm-color-primary);--ifm-navbar-link-hover-color:var(--ifm-color-white);--ifm-menu-color-active:var(--ifm-color-white);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-500)}.navbar__search-input{appearance:none;background:var(--ifm-navbar-search-input-background-color) var(--ifm-navbar-search-input-icon) no-repeat .75rem center/1rem 1rem;border:none;border-radius:2rem;color:var(--ifm-navbar-search-input-color);cursor:text;display:inline-block;font-size:1rem;height:2rem;padding:0 .5rem 0 2.25rem;width:12.5rem}.navbar__search-input::placeholder{color:var(--ifm-navbar-search-input-placeholder-color)}.navbar-sidebar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-global-shadow-md);position:fixed;transform:translate3d(-100%,0,0);transition-property:opacity,visibility,transform;width:var(--ifm-navbar-sidebar-width)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar__items{transform:translateZ(0)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar--show .navbar-sidebar__backdrop{opacity:1;visibility:visible}.navbar-sidebar__backdrop{background-color:#0009;position:fixed;right:0;transition-property:opacity,visibility}.navbar-sidebar__brand{align-items:center;box-shadow:var(--ifm-navbar-shadow);display:flex;flex:1;height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar-sidebar__items{display:flex;height:calc(100% - var(--ifm-navbar-height));transition:transform var(--ifm-transition-fast) ease-in-out}.navbar-sidebar__items--show-secondary{transform:translate3d(calc((var(--ifm-navbar-sidebar-width))*-1),0,0)}.navbar-sidebar__item{flex-shrink:0;padding:.5rem;width:calc(var(--ifm-navbar-sidebar-width))}.navbar-sidebar__back{background:var(--ifm-menu-color-background-active);font-size:15px;font-weight:var(--ifm-button-font-weight);margin:0 0 .2rem -.5rem;padding:.6rem 1.5rem;position:relative;text-align:left;top:-.5rem;width:calc(100% + 1rem)}.navbar-sidebar__close{display:flex;margin-left:auto}.pagination{column-gap:var(--ifm-pagination-page-spacing);display:flex;font-size:var(--ifm-pagination-font-size);padding-left:0}.pagination--sm{--ifm-pagination-font-size:0.8rem;--ifm-pagination-padding-horizontal:0.8rem;--ifm-pagination-padding-vertical:0.2rem}.pagination--lg{--ifm-pagination-font-size:1.2rem;--ifm-pagination-padding-horizontal:1.2rem;--ifm-pagination-padding-vertical:0.3rem}.pagination__item{display:inline-flex}.pagination__item>span{padding:var(--ifm-pagination-padding-vertical)}.pagination__item--active .pagination__link{color:var(--ifm-pagination-color-active)}.pagination__item--active .pagination__link,.pagination__item:not(.pagination__item--active):hover .pagination__link{background:var(--ifm-pagination-item-active-background)}.pagination__item--disabled,.pagination__item[disabled]{opacity:.25;pointer-events:none}.pagination__link{border-radius:var(--ifm-pagination-border-radius);color:var(--ifm-font-color-base);display:inline-block;padding:var(--ifm-pagination-padding-vertical) var(--ifm-pagination-padding-horizontal);transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination-nav{display:grid;grid-gap:var(--ifm-spacing-horizontal);gap:var(--ifm-spacing-horizontal);grid-template-columns:repeat(2,1fr)}.pagination-nav__link{border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-pagination-nav-border-radius);display:block;height:100%;line-height:var(--ifm-heading-line-height);padding:var(--ifm-global-spacing);transition:border-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination-nav__link:hover{border-color:var(--ifm-pagination-nav-color-hover)}.pagination-nav__link--next{grid-column:2/3;text-align:right}.pagination-nav__label{font-size:var(--ifm-h4-font-size);font-weight:var(--ifm-heading-font-weight);word-break:break-word}.pagination-nav__link--prev .pagination-nav__label:before{content:"« "}.pagination-nav__link--next .pagination-nav__label:after{content:" »"}.pagination-nav__sublabel{color:var(--ifm-color-content-secondary);font-size:var(--ifm-h5-font-size);font-weight:var(--ifm-font-weight-semibold);margin-bottom:.25rem}.pills__item,.tabs{font-weight:var(--ifm-font-weight-bold)}.pills{display:flex;gap:var(--ifm-pills-spacing);padding-left:0}.pills__item{border-radius:.5rem;cursor:pointer;display:inline-block;padding:.25rem 1rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs,:not(.containsTaskList_mC6p>li)>.containsTaskList_mC6p{padding-left:0}.pills__item--active{color:var(--ifm-pills-color-active)}.pills__item--active,.pills__item:not(.pills__item--active):hover{background:var(--ifm-pills-color-background-active)}.pills--block{justify-content:stretch}.pills--block .pills__item{flex-grow:1;text-align:center}.tabs{color:var(--ifm-tabs-color);display:flex;margin-bottom:0;overflow-x:auto}.tabs__item{border-bottom:3px solid #0000;border-radius:var(--ifm-global-radius);cursor:pointer;display:inline-flex;padding:var(--ifm-tabs-padding-vertical) var(--ifm-tabs-padding-horizontal);transition:background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs__item--active{border-bottom-color:var(--ifm-tabs-color-active-border);border-bottom-left-radius:0;border-bottom-right-radius:0;color:var(--ifm-tabs-color-active)}.tabs__item:hover{background-color:var(--ifm-hover-overlay)}.tabs--block{justify-content:stretch}.tabs--block .tabs__item{flex-grow:1;justify-content:center}html[data-theme=dark]{--ifm-color-scheme:dark;--ifm-color-emphasis-0:var(--ifm-color-gray-1000);--ifm-color-emphasis-100:var(--ifm-color-gray-900);--ifm-color-emphasis-200:var(--ifm-color-gray-800);--ifm-color-emphasis-300:var(--ifm-color-gray-700);--ifm-color-emphasis-400:var(--ifm-color-gray-600);--ifm-color-emphasis-600:var(--ifm-color-gray-400);--ifm-color-emphasis-700:var(--ifm-color-gray-300);--ifm-color-emphasis-800:var(--ifm-color-gray-200);--ifm-color-emphasis-900:var(--ifm-color-gray-100);--ifm-color-emphasis-1000:var(--ifm-color-gray-0);--ifm-background-color:#1b1b1d;--ifm-background-surface-color:#242526;--ifm-hover-overlay:#ffffff0d;--ifm-color-content:#e3e3e3;--ifm-color-content-secondary:#fff;--ifm-breadcrumb-separator-filter:invert(64%) sepia(11%) saturate(0%) hue-rotate(149deg) brightness(99%) contrast(95%);--ifm-code-background:#ffffff1a;--ifm-scrollbar-track-background-color:#444;--ifm-scrollbar-thumb-background-color:#686868;--ifm-scrollbar-thumb-hover-background-color:#7a7a7a;--ifm-table-stripe-background:#ffffff12;--ifm-toc-border-color:var(--ifm-color-emphasis-200);--ifm-color-primary-contrast-background:#102445;--ifm-color-primary-contrast-foreground:#ebf2fc;--ifm-color-secondary-contrast-background:#474748;--ifm-color-secondary-contrast-foreground:#fdfdfe;--ifm-color-success-contrast-background:#003100;--ifm-color-success-contrast-foreground:#e6f6e6;--ifm-color-info-contrast-background:#193c47;--ifm-color-info-contrast-foreground:#eef9fd;--ifm-color-warning-contrast-background:#4d3800;--ifm-color-warning-contrast-foreground:#fff8e6;--ifm-color-danger-contrast-background:#4b1113;--ifm-color-danger-contrast-foreground:#ffebec;--docsearch-text-color:#f5f6f7;--docsearch-container-background:#090a11cc;--docsearch-modal-background:#15172a;--docsearch-modal-shadow:inset 1px 1px 0 0 #2c2e40,0 3px 8px 0 #000309;--docsearch-searchbox-background:#090a11;--docsearch-searchbox-focus-background:#000;--docsearch-hit-color:#bec3c9;--docsearch-hit-shadow:none;--docsearch-hit-background:#090a11;--docsearch-key-gradient:linear-gradient(-26.5deg,#565872,#31355b);--docsearch-key-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 2px 2px 0 #0304094d;--docsearch-footer-background:#1e2136;--docsearch-footer-shadow:inset 0 1px 0 0 #494c6a80,0 -4px 8px 0 #0003;--docsearch-logo-color:#fff;--docsearch-muted-color:#7f8497}#nprogress .bar{background:var(--docusaurus-progress-bar-color);height:2px;left:0;position:fixed;top:0;width:100%;z-index:1031}#nprogress .peg{box-shadow:0 0 10px var(--docusaurus-progress-bar-color),0 0 5px var(--docusaurus-progress-bar-color);height:100%;opacity:1;position:absolute;right:0;transform:rotate(3deg) translateY(-4px);width:100px}.docusaurus-highlight-code-line{background-color:#484d5b;display:block;margin:0 calc(var(--ifm-pre-padding)*-1);padding:0 var(--ifm-pre-padding)}.header-github-link:hover{opacity:.6}.header-github-link:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat;content:"";display:flex;height:24px;width:24px}html[data-theme=dark] .header-github-link:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat}.tag_zVej{border:1px solid var(--docusaurus-tag-list-border);transition:border var(--ifm-transition-fast)}.tag_zVej:hover{--docusaurus-tag-list-border:var(--ifm-link-color)}.tagRegular_sFm0{border-radius:var(--ifm-global-radius);font-size:90%;padding:.2rem .5rem .3rem}.tagWithCount_h2kH{align-items:center;border-left:0;display:flex;padding:0 .5rem 0 1rem;position:relative}.tagWithCount_h2kH:after,.tagWithCount_h2kH:before{border:1px solid var(--docusaurus-tag-list-border);content:"";position:absolute;top:50%;transition:inherit}.tagWithCount_h2kH:before{border-bottom:0;border-right:0;height:1.18rem;right:100%;transform:translate(50%,-50%) rotate(-45deg);width:1.18rem}.tagWithCount_h2kH:after{border-radius:50%;height:.5rem;left:0;transform:translateY(-50%);width:.5rem}.tagWithCount_h2kH span{background:var(--ifm-color-secondary);border-radius:var(--ifm-global-radius);color:var(--ifm-color-black);font-size:.7rem;line-height:1.2;margin-left:.3rem;padding:.1rem .4rem}.tags_jXut{display:inline}.tag_QGVx{display:inline-block;margin:0 .4rem .5rem 0}.iconEdit_Z9Sw{margin-right:.3em;vertical-align:sub}.lastUpdated_JAkA{font-size:smaller;font-style:italic;margin-top:.2rem}.tocCollapsibleButton_TO0P{align-items:center;display:flex;font-size:inherit;justify-content:space-between;padding:.4rem .8rem;width:100%}.DocSearch-Button,.DocSearch-Button-Container{align-items:center;display:flex}.tocCollapsibleButton_TO0P:after{background:var(--ifm-menu-link-sublist-icon) 50% 50%/2rem 2rem no-repeat;content:"";filter:var(--ifm-menu-link-sublist-icon-filter);height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast);width:1.25rem}.tocCollapsibleButtonExpanded_MG3E:after,.tocCollapsibleExpanded_sAul{transform:none}.tocCollapsible_ETCw{background-color:var(--ifm-menu-color-background-active);border-radius:var(--ifm-global-radius);margin:1rem 0}.tocCollapsibleContent_vkbj>ul{border-left:none;border-top:1px solid var(--ifm-color-emphasis-300);font-size:15px;padding:.2rem 0}.tocCollapsibleContent_vkbj ul li{margin:.4rem .8rem}.tocCollapsibleContent_vkbj a{display:block}.tableOfContents_bqdL{max-height:calc(100vh - var(--ifm-navbar-height) - 2rem);overflow-y:auto;position:sticky;top:calc(var(--ifm-navbar-height) + 1rem)}.tableOfContentsInline_prmo ul{font-size:medium;list-style-type:disc;padding-top:0}.backToTopButton_sjWU{background-color:var(--ifm-color-emphasis-200);border-radius:50%;bottom:1.3rem;box-shadow:var(--ifm-global-shadow-lw);height:3rem;opacity:0;position:fixed;right:1.3rem;transform:scale(0);transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default);visibility:hidden;width:3rem;z-index:calc(var(--ifm-z-index-fixed) - 1)}.backToTopButton_sjWU:after{background-color:var(--ifm-color-emphasis-1000);content:" ";display:inline-block;height:100%;-webkit-mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;width:100%}.backToTopButtonShow_xfvO{opacity:1;transform:scale(1);visibility:visible}.DocSearch-Button{background:var(--docsearch-searchbox-background);border:0;border-radius:40px;color:var(--docsearch-muted-color);cursor:pointer;font-weight:500;height:36px;justify-content:space-between;padding:0 8px;-webkit-user-select:none;user-select:none}.DocSearch-Button:active,.DocSearch-Button:focus,.DocSearch-Button:hover{background:var(--docsearch-searchbox-focus-background);box-shadow:var(--docsearch-searchbox-shadow);color:var(--docsearch-text-color);outline:0}.DocSearch-Search-Icon{stroke-width:1.6}.DocSearch-Hit-Tree,.DocSearch-Hit-action,.DocSearch-Hit-icon,.DocSearch-Reset{stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Button .DocSearch-Search-Icon{color:var(--docsearch-text-color)}.DocSearch-Button-Placeholder{font-size:1rem;padding:0 12px 0 6px}.DocSearch-Button-Keys{display:flex;min-width:calc(40px + .8em)}.DocSearch-Button-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:3px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 2px;position:relative;top:-1px;width:20px}.DocSearch--active{overflow:hidden!important}.DocSearch-Container{background-color:var(--docsearch-container-background);height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:200}.DocSearch-Hit[aria-selected=true] mark,.DocSearch-Prefill:focus,.DocSearch-Prefill:hover,.content_knG7 a{-webkit-text-decoration:underline;text-decoration:underline}.DocSearch-Link{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;font:inherit;margin:0;padding:0}.DocSearch-Modal{background:var(--docsearch-modal-background);border-radius:6px;box-shadow:var(--docsearch-modal-shadow);flex-direction:column;margin:60px auto auto;max-width:var(--docsearch-modal-width);position:relative}.DocSearch-SearchBar{display:flex;padding:var(--docsearch-spacing) var(--docsearch-spacing) 0}.DocSearch-Form{align-items:center;background:var(--docsearch-searchbox-focus-background);border-radius:4px;box-shadow:var(--docsearch-searchbox-shadow);display:flex;height:var(--docsearch-searchbox-height);margin:0;padding:0 var(--docsearch-spacing);position:relative;width:100%}.DocSearch-Input{appearance:none;background:#0000;border:0;color:var(--docsearch-text-color);flex:1;font:inherit;font-size:1.2em;height:100%;outline:0;padding:0 0 0 8px;width:80%}.DocSearch-Input::placeholder{color:var(--docsearch-muted-color);opacity:1}.DocSearch-Input::-webkit-search-cancel-button,.DocSearch-Input::-webkit-search-decoration,.DocSearch-Input::-webkit-search-results-button,.DocSearch-Input::-webkit-search-results-decoration{display:none}.DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset,.buttonContainer_ox5C .close{margin:0;padding:0}.DocSearch-Container--Stalled .DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}.DocSearch-Cancel,.DocSearch-Container--Stalled .DocSearch-MagnifierLabel,.DocSearch-LoadingIndicator,.DocSearch-Reset[hidden]{display:none}.DocSearch-Reset{animation:.1s ease-in forwards a;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;padding:2px;right:0}.DocSearch-Help,.DocSearch-HitsFooter,.DocSearch-Label{color:var(--docsearch-muted-color)}.DocSearch-Reset:hover{color:var(--docsearch-highlight-color)}.DocSearch-LoadingIndicator svg,.DocSearch-MagnifierLabel svg{height:24px;width:24px}.DocSearch-Dropdown{max-height:calc(var(--docsearch-modal-height) - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height));min-height:var(--docsearch-spacing);overflow-y:auto;overflow-y:overlay;padding:0 var(--docsearch-spacing);scrollbar-color:var(--docsearch-muted-color) var(--docsearch-modal-background);scrollbar-width:thin}.DocSearch-Dropdown::-webkit-scrollbar{width:12px}.DocSearch-Dropdown::-webkit-scrollbar-track{background:#0000}.DocSearch-Dropdown::-webkit-scrollbar-thumb{background-color:var(--docsearch-muted-color);border:3px solid var(--docsearch-modal-background);border-radius:20px}.DocSearch-Dropdown ul{list-style:none;margin:0;padding:0}.DocSearch-Label{font-size:.75em;line-height:1.6em}.DocSearch-Help{font-size:.9em;margin:0;-webkit-user-select:none;user-select:none}.DocSearch-Title{font-size:1.2em}.DocSearch-Logo a{display:flex}.DocSearch-Logo svg{color:var(--docsearch-logo-color);margin-left:8px}.DocSearch-Hits:last-of-type{margin-bottom:24px}.DocSearch-Hits mark{background:none;color:var(--docsearch-highlight-color)}.DocSearch-HitsFooter{display:flex;font-size:.85em;justify-content:center;margin-bottom:var(--docsearch-spacing);padding:var(--docsearch-spacing)}.DocSearch-HitsFooter a{border-bottom:1px solid;color:inherit}.DocSearch-Hit{border-radius:4px;display:flex;padding-bottom:4px;position:relative}.DocSearch-Hit--deleting{opacity:0;transition:.25s linear}.DocSearch-Hit--favoriting{transform:scale(0);transform-origin:top center;transition:.25s linear .25s}.DocSearch-Hit a{background:var(--docsearch-hit-background);border-radius:4px;box-shadow:var(--docsearch-hit-shadow);display:block;padding-left:var(--docsearch-spacing);width:100%}.DocSearch-Hit-source{background:var(--docsearch-modal-background);color:var(--docsearch-highlight-color);font-size:.85em;font-weight:600;line-height:32px;margin:0 -4px;padding:8px 4px 0;position:sticky;top:0;z-index:10}.DocSearch-Hit-Tree{color:var(--docsearch-muted-color);height:var(--docsearch-hit-height);opacity:.5;width:24px}.DocSearch-Hit[aria-selected=true] a{background-color:var(--docsearch-highlight-color)}.DocSearch-Hit-Container{align-items:center;color:var(--docsearch-hit-color);display:flex;flex-direction:row;height:var(--docsearch-hit-height);padding:0 var(--docsearch-spacing) 0 0}.DocSearch-Hit-icon{height:20px;width:20px}.DocSearch-Hit-action,.DocSearch-Hit-icon{color:var(--docsearch-muted-color)}.DocSearch-Hit-action{align-items:center;display:flex;height:22px;width:22px}.DocSearch-Hit-action svg{display:block;height:18px;width:18px}.DocSearch-Hit-action+.DocSearch-Hit-action{margin-left:6px}.DocSearch-Hit-action-button{appearance:none;background:none;border:0;border-radius:50%;color:inherit;cursor:pointer;padding:2px}#__docusaurus-base-url-issue-banner-container,.docSidebarContainer_YfHR,.navbarSearchContainer_Bca1:empty,.sidebarLogo_isFc,.themedComponent_mlkZ,[data-theme=dark] .lightToggleIcon_pyhR,[data-theme=light] .darkToggleIcon_wfgR,html[data-announcement-bar-initially-dismissed=true] .announcementBar_mb4j,svg.DocSearch-Hit-Select-Icon{display:none}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Select-Icon{display:block}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:background-color .1s ease-in}.DocSearch-Hit-action-button:focus path,.DocSearch-Hit-action-button:hover path{fill:#fff}.DocSearch-Hit-content-wrapper{display:flex;flex:1 1 auto;flex-direction:column;font-weight:500;justify-content:center;line-height:1.2em;margin:0 8px;overflow-x:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap;width:80%}.DocSearch-Hit-title{font-size:.9em}.DocSearch-Hit-path{color:var(--docsearch-muted-color);font-size:.75em}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Tree,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-action,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-icon,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-path,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-text,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-title,.DocSearch-Hit[aria-selected=true] mark{color:var(--docsearch-hit-active-color)!important}.DocSearch-ErrorScreen,.DocSearch-NoResults,.DocSearch-StartScreen{font-size:.9em;margin:0 auto;padding:36px 0;text-align:center;width:80%}.DocSearch-Screen-Icon{color:var(--docsearch-muted-color);padding-bottom:12px}.DocSearch-NoResults-Prefill-List{display:inline-block;padding-bottom:24px;text-align:left}.DocSearch-NoResults-Prefill-List ul{display:inline-block;padding:8px 0 0}.DocSearch-NoResults-Prefill-List li{list-style-position:inside;list-style-type:"» "}.DocSearch-Prefill{appearance:none;background:none;border:0;border-radius:1em;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;font-size:1em;font-weight:700;padding:0}.DocSearch-Prefill:focus,.DocSearch-Prefill:hover{outline:0}.DocSearch-Footer{align-items:center;background:var(--docsearch-footer-background);border-radius:0 0 8px 8px;box-shadow:var(--docsearch-footer-shadow);display:flex;flex-direction:row-reverse;flex-shrink:0;height:var(--docsearch-footer-height);justify-content:space-between;padding:0 var(--docsearch-spacing);position:relative;-webkit-user-select:none;user-select:none;width:100%;z-index:300}.DocSearch-Commands{color:var(--docsearch-muted-color);display:flex;list-style:none;margin:0;padding:0}.DocSearch-Commands li,.buttonContainer_ox5C{align-items:center;display:flex}.DocSearch-Commands li:not(:last-of-type){margin-right:.8em}.DocSearch-Commands-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:2px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 1px;width:20px}@keyframes a{0%{opacity:0}to{opacity:1}}.DocSearch-Button{margin:0;transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.DocSearch-Container{z-index:calc(var(--ifm-z-index-fixed) + 1)}.popup_wph0{align-items:center;bottom:16px;display:flex;justify-content:space-between;position:fixed;right:16px;width:344px;z-index:999}.skipToContent_fXgn{background-color:var(--ifm-background-surface-color);color:var(--ifm-color-emphasis-900);left:100%;padding:calc(var(--ifm-global-spacing)/2) var(--ifm-global-spacing);position:fixed;top:1rem;z-index:calc(var(--ifm-z-index-fixed) + 1)}.skipToContent_fXgn:focus{box-shadow:var(--ifm-global-shadow-md);left:1rem}.closeButton_CVFx{line-height:0;padding:0}.content_knG7{font-size:85%;padding:5px 0;text-align:center}.content_knG7 a{color:inherit}.announcementBar_mb4j{align-items:center;background-color:var(--ifm-color-white);border-bottom:1px solid var(--ifm-color-emphasis-100);color:var(--ifm-color-black);display:flex;height:var(--docusaurus-announcement-bar-height)}.announcementBarPlaceholder_vyr4{flex:0 0 10px}.announcementBarClose_gvF7{align-self:stretch;flex:0 0 30px}.toggle_vylO{height:2rem;width:2rem}.toggleButton_gllP{align-items:center;border-radius:50%;display:flex;height:100%;justify-content:center;transition:background var(--ifm-transition-fast);width:100%}.toggleButton_gllP:hover{background:var(--ifm-color-emphasis-200)}.toggleButtonDisabled_aARS{cursor:not-allowed}.darkNavbarColorModeToggle_X3D1:hover{background:var(--ifm-color-gray-800)}[data-theme=dark] .themedComponent--dark_xIcU,[data-theme=light] .themedComponent--light_NVdE,html:not([data-theme]) .themedComponent--light_NVdE{display:initial}[data-theme=dark]:root{--docusaurus-collapse-button-bg:#ffffff0d;--docusaurus-collapse-button-bg-hover:#ffffff1a}.collapseSidebarButton_PEFL{display:none;margin:0}.iconExternalLink_nPIU{margin-left:.3rem}.docMainContainer_TBSr,.docRoot_UBD9{display:flex;width:100%}.docsWrapper_hBAB{display:flex;flex:1 0 auto}.dropdownNavbarItemMobile_S0Fm{cursor:pointer}.iconLanguage_nlXk{margin-right:5px;vertical-align:text-bottom}.navbarHideable_m1mJ{transition:transform var(--ifm-transition-fast) ease}.navbarHidden_jGov{transform:translate3d(0,calc(-100% - 2px),0)}.errorBoundaryError_a6uf{color:red;white-space:pre-wrap}.errorBoundaryFallback_VBag{color:red;padding:.55rem}.buttonGroup__atx button,.codeBlockContainer_Ckt0{background:var(--prism-background-color);color:var(--prism-color)}.footerLogoLink_BH7S{opacity:.5;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.footerLogoLink_BH7S:hover,.hash-link:focus,:hover>.hash-link{opacity:1}body:not(.navigation-with-keyboard) :not(input):focus{outline:0}.anchorWithStickyNavbar_LWe7{scroll-margin-top:calc(var(--ifm-navbar-height) + .5rem)}.anchorWithHideOnScrollNavbar_WYt5{scroll-margin-top:.5rem}.hash-link{opacity:0;padding-left:.5rem;transition:opacity var(--ifm-transition-fast);-webkit-user-select:none;user-select:none}.hash-link:before{content:"#"}.mainWrapper_z2l0{display:flex;flex:1 0 auto;flex-direction:column}.docusaurus-mt-lg{margin-top:3rem}#__docusaurus{display:flex;flex-direction:column;min-height:100%}.codeBlockContainer_Ckt0{border-radius:var(--ifm-code-border-radius);box-shadow:var(--ifm-global-shadow-lw);margin-bottom:var(--ifm-leading)}.codeBlockContent_biex{border-radius:inherit;direction:ltr;position:relative}.codeBlockTitle_Ktv7{border-bottom:1px solid var(--ifm-color-emphasis-300);border-top-left-radius:inherit;border-top-right-radius:inherit;font-size:var(--ifm-code-font-size);font-weight:500;padding:.75rem var(--ifm-pre-padding)}.codeBlock_bY9V{--ifm-pre-background:var(--prism-background-color);margin:0;padding:0}.codeBlockTitle_Ktv7+.codeBlockContent_biex .codeBlock_bY9V{border-top-left-radius:0;border-top-right-radius:0}.codeBlockLines_e6Vv{float:left;font:inherit;min-width:100%;padding:var(--ifm-pre-padding)}.codeBlockLinesWithNumbering_o6Pm{display:table;padding:var(--ifm-pre-padding) 0}.buttonGroup__atx{column-gap:.2rem;display:flex;position:absolute;right:calc(var(--ifm-pre-padding)/2);top:calc(var(--ifm-pre-padding)/2)}.buttonGroup__atx button{align-items:center;border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-global-radius);display:flex;line-height:0;opacity:0;padding:.4rem;transition:opacity var(--ifm-transition-fast) ease-in-out}.buttonGroup__atx button:focus-visible,.buttonGroup__atx button:hover{opacity:1!important}.theme-code-block:hover .buttonGroup__atx button{opacity:.4}:where(:root){--docusaurus-highlighted-code-line-bg:#484d5b}:where([data-theme=dark]){--docusaurus-highlighted-code-line-bg:#646464}.theme-code-block-highlighted-line{background-color:var(--docusaurus-highlighted-code-line-bg);display:block;margin:0 calc(var(--ifm-pre-padding)*-1);padding:0 var(--ifm-pre-padding)}.codeLine_lJS_{counter-increment:a;display:table-row}.codeLineNumber_Tfdd{background:var(--ifm-pre-background);display:table-cell;left:0;overflow-wrap:normal;padding:0 var(--ifm-pre-padding);position:sticky;text-align:right;width:1%}.codeLineNumber_Tfdd:before{content:counter(a);opacity:.4}.codeLineContent_feaV{padding-right:var(--ifm-pre-padding)}.theme-code-block:hover .copyButtonCopied_obH4{opacity:1!important}.copyButtonIcons_eSgA{height:1.125rem;position:relative;width:1.125rem}.copyButtonIcon_y97N,.copyButtonSuccessIcon_LjdS{left:0;position:absolute;top:0;fill:currentColor;height:inherit;opacity:inherit;transition:all var(--ifm-transition-fast) ease;width:inherit}.copyButtonSuccessIcon_LjdS{color:#00d600;left:50%;opacity:0;top:50%;transform:translate(-50%,-50%) scale(.33)}.copyButtonCopied_obH4 .copyButtonIcon_y97N{opacity:0;transform:scale(.33)}.copyButtonCopied_obH4 .copyButtonSuccessIcon_LjdS{opacity:1;transform:translate(-50%,-50%) scale(1);transition-delay:75ms}.wordWrapButtonIcon_Bwma{height:1.2rem;width:1.2rem}.heroTitleTextHtml_zYwv b,.indexCtaTryNowButton_wlFR:hover,.wordWrapButtonEnabled_EoeP .wordWrapButtonIcon_Bwma{color:var(--ifm-color-primary)}.details_lb9f{--docusaurus-details-summary-arrow-size:0.38rem;--docusaurus-details-transition:transform 200ms ease;--docusaurus-details-decoration-color:grey}.details_lb9f>summary{cursor:pointer;list-style:none;padding-left:1rem;position:relative}.details_lb9f>summary::-webkit-details-marker{display:none}.details_lb9f>summary:before{border-color:#0000 #0000 #0000 var(--docusaurus-details-decoration-color);border-style:solid;border-width:var(--docusaurus-details-summary-arrow-size);content:"";left:0;position:absolute;top:.45rem;transform:rotate(0);transform-origin:calc(var(--docusaurus-details-summary-arrow-size)/2) 50%;transition:var(--docusaurus-details-transition)}.collapsibleContent_i85q{border-top:1px solid var(--docusaurus-details-decoration-color);margin-top:1rem;padding-top:1rem}.details_b_Ee{--docusaurus-details-decoration-color:var(--ifm-alert-border-color);--docusaurus-details-transition:transform var(--ifm-transition-fast) ease;border:1px solid var(--ifm-alert-border-color);margin:0 0 var(--ifm-spacing-vertical)}.containsTaskList_mC6p{list-style:none}.img_ev3q{height:auto}.admonition_xJq3{margin-bottom:1em}.admonitionHeading_Gvgb{font:var(--ifm-heading-font-weight) var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family)}.admonitionHeading_Gvgb:not(:last-child){margin-bottom:.3rem}.admonitionHeading_Gvgb code{text-transform:none}.admonitionIcon_Rf37{display:inline-block;margin-right:.4em;vertical-align:middle}.admonitionIcon_Rf37 svg{display:inline-block;height:1.6em;width:1.6em;fill:var(--ifm-alert-foreground-color)}.breadcrumbHomeIcon_YNFT{height:1.1rem;position:relative;top:1px;vertical-align:top;width:1.1rem}.breadcrumbsContainer_Z_bl{--ifm-breadcrumb-size-multiplier:0.8;margin-bottom:.8rem}.searchQueryInput_u2C7,.searchVersionInput_m0Ui{background:var(--docsearch-searchbox-focus-background);border:2px solid var(--ifm-toc-border-color);border-radius:var(--ifm-global-radius);color:var(--docsearch-text-color);font:var(--ifm-font-size-base) var(--ifm-font-family-base);margin-bottom:.5rem;padding:.8rem;transition:border var(--ifm-transition-fast) ease;width:100%}.indexCtaTryNowButton_wlFR,.indexCtasGetStartedButton_UQaK{line-height:1.2em;text-transform:uppercase;transition:background .3s,color .3s}.searchQueryInput_u2C7:focus,.searchVersionInput_m0Ui:focus{border-color:var(--docsearch-primary-color);outline:0}.searchQueryInput_u2C7::placeholder{color:var(--docsearch-muted-color)}.searchResultsColumn_JPFH{font-size:.9rem;font-weight:700}.algoliaLogo_rT1R{max-width:150px}.algoliaLogoPathFill_WdUC{fill:var(--ifm-font-color-base)}.searchResultItem_Tv2o{border-bottom:1px solid var(--ifm-toc-border-color);padding:1rem 0}.searchResultItemHeading_KbCB{font-weight:400;margin-bottom:0}.searchResultItemPath_lhe1{color:var(--ifm-color-content-secondary);font-size:.8rem;--ifm-breadcrumb-separator-size-multiplier:1}.searchResultItemSummary_AEaO{font-style:italic;margin:.5rem 0 0}.loadingSpinner_XVxU{animation:1s linear infinite b;border:.4em solid #eee;border-radius:50%;border-top:.4em solid var(--ifm-color-primary);height:3rem;margin:0 auto;width:3rem}@keyframes b{to{transform:rotate(1turn)}}.loader_vvXV{margin-top:2rem}.search-result-match{background:#ffd78e40;color:var(--docsearch-hit-color);padding:.09em 0}.section_rC2D{padding:72px 0}.sectionAlt_XiGz{background-color:var(--ifm-color-emphasis-100)}.sectionInner_Y4r1{margin:0 auto}.featureImage_yA8i{margin:0 auto;max-height:128px;max-width:60%}.featureHeading_TLGJ{font-size:var(--ifm-h3-font-size);padding-top:1rem}.announcement_FsS0{font-size:24px;font-weight:700;margin:0 auto;padding:48px;text-align:center}.announcementDark_tzC4{background-color:#20232a;color:#fff}.announcementInner_RsrQ{margin:0 auto;max-width:768px}.hero_syme{background-color:#2b3137;padding:48px}.heroInner_VWeJ{margin:0 auto;max-width:1100px;padding:0 20px}.heroProjectTagline_EkV5{color:#fff;font-size:60px;margin:0}@keyframes c{0%{opacity:0;transform:scale(.1) rotate(30deg);transform-origin:center bottom}50%{transform:rotate(-10deg)}70%{transform:rotate(3deg)}to{opacity:1;transform:scale(1)}}.heroLogo_jM6J{animation-duration:2s;animation-name:c;float:right;height:160px;margin-top:20px;padding:0 20px 20px;width:180px}.indexCtas_hUA_{align-items:center;display:flex;margin-top:24px}.indexCtasGetStartedButton_UQaK{border:2px solid var(--ifm-color-primary);border-radius:8px;color:#fff;font-size:24px;font-weight:700;padding:18px 36px;-webkit-text-decoration:none!important;text-decoration:none!important}.indexCtasGitHubButtonWrapper_AOht{display:flex;margin-left:20px}.indexCtasGitHubButton_sMIS{border:none;overflow:hidden}.indexCtaTryNowButton_wlFR{color:#fff;font-size:14px;font-weight:700;margin:0 36px;-webkit-text-decoration:underline;text-decoration:underline}@media (min-width:997px){.collapseSidebarButton_PEFL,.expandButton_TmdG{background-color:var(--docusaurus-collapse-button-bg)}.lastUpdated_JAkA{text-align:right}.tocMobile_ITEo{display:none}:root{--docusaurus-announcement-bar-height:30px}.announcementBarClose_gvF7,.announcementBarPlaceholder_vyr4{flex-basis:50px}.collapseSidebarButton_PEFL{border:1px solid var(--ifm-toc-border-color);border-radius:0;bottom:0;display:block!important;height:40px;position:sticky}.collapseSidebarButtonIcon_kv0_{margin-top:4px;transform:rotate(180deg)}.expandButtonIcon_i1dp,[dir=rtl] .collapseSidebarButtonIcon_kv0_{transform:rotate(0)}.collapseSidebarButton_PEFL:focus,.collapseSidebarButton_PEFL:hover,.expandButton_TmdG:focus,.expandButton_TmdG:hover{background-color:var(--docusaurus-collapse-button-bg-hover)}.menuHtmlItem_M9Kj{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu_SIkG{flex-grow:1;padding:.5rem}@supports (scrollbar-gutter:stable){.menu_SIkG{padding:.5rem 0 .5rem .5rem;scrollbar-gutter:stable}}.menuWithAnnouncementBar_GW3s{margin-bottom:var(--docusaurus-announcement-bar-height)}.sidebar_njMd{display:flex;flex-direction:column;height:100%;padding-top:var(--ifm-navbar-height);width:var(--doc-sidebar-width)}.sidebarWithHideableNavbar_wUlq{padding-top:0}.sidebarHidden_VK0M{opacity:0;visibility:hidden}.sidebarLogo_isFc{align-items:center;color:inherit!important;display:flex!important;margin:0 var(--ifm-navbar-padding-horizontal);max-height:var(--ifm-navbar-height);min-height:var(--ifm-navbar-height);-webkit-text-decoration:none!important;text-decoration:none!important}.sidebarLogo_isFc img{height:2rem;margin-right:.5rem}.expandButton_TmdG{align-items:center;display:flex;height:100%;justify-content:center;position:absolute;right:0;top:0;transition:background-color var(--ifm-transition-fast) ease;width:100%}[dir=rtl] .expandButtonIcon_i1dp{transform:rotate(180deg)}.docSidebarContainer_YfHR{border-right:1px solid var(--ifm-toc-border-color);clip-path:inset(0);display:block;margin-top:calc(var(--ifm-navbar-height)*-1);transition:width var(--ifm-transition-fast) ease;width:var(--doc-sidebar-width);will-change:width}.docSidebarContainerHidden_DPk8{cursor:pointer;width:var(--doc-sidebar-hidden-width)}.sidebarViewport_aRkj{height:100%;max-height:100vh;position:sticky;top:0}.docMainContainer_TBSr{flex-grow:1;max-width:calc(100% - var(--doc-sidebar-width))}.docMainContainerEnhanced_lQrH{max-width:calc(100% - var(--doc-sidebar-hidden-width))}.docItemWrapperEnhanced_JWYK{max-width:calc(var(--ifm-container-width) + var(--doc-sidebar-width))!important}.navbarSearchContainer_Bca1{padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.docItemCol_VOVn{max-width:75%!important}}@media (min-width:1440px){.container{max-width:var(--ifm-container-width-xl)}}@media (max-width:996px){.col{--ifm-col-width:100%;flex-basis:var(--ifm-col-width);margin-left:0}.footer{--ifm-footer-padding-horizontal:0}.colorModeToggle_DEke,.footer__link-separator,.navbar__item,.tableOfContents_bqdL{display:none}.footer__col{margin-bottom:calc(var(--ifm-spacing-vertical)*3)}.footer__link-item{display:block;width:max-content}.hero{padding-left:0;padding-right:0}.navbar>.container,.navbar>.container-fluid{padding:0}.navbar__toggle{display:inherit}.navbar__search-input{width:9rem}.pills--block,.tabs--block{flex-direction:column}.docItemContainer_F8PC{padding:0 .3rem}.navbarSearchContainer_Bca1{position:absolute;right:var(--ifm-navbar-padding-horizontal)}}@media only screen and (max-width:996px){.searchQueryColumn_RTkw,.searchResultsColumn_JPFH{max-width:60%!important}.searchLogoColumn_rJIA,.searchVersionColumn_ypXd{max-width:40%!important}.searchLogoColumn_rJIA{padding-left:0!important}}@media (max-width:768px){.DocSearch-Button-Keys,.DocSearch-Button-Placeholder,.DocSearch-Commands,.DocSearch-Hit-Tree{display:none}:root{--docsearch-spacing:10px;--docsearch-footer-height:40px}.DocSearch-Dropdown{height:100%;max-height:calc(var(--docsearch-vh,1vh)*100 - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height))}.DocSearch-Container{height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);position:absolute}.DocSearch-Footer{border-radius:0;bottom:0;position:absolute}.DocSearch-Hit-content-wrapper{display:flex;position:relative;width:80%}.DocSearch-Modal{border-radius:0;box-shadow:none;height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);margin:0;max-width:100%;width:100%}.DocSearch-Cancel{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;flex:none;font:inherit;font-size:1em;font-weight:500;margin-left:var(--docsearch-spacing);outline:0;overflow:hidden;padding:0;-webkit-user-select:none;user-select:none;white-space:nowrap}}@media only screen and (max-width:768px){.hero_syme{padding-left:20px;padding-right:20px}.heroInner_VWeJ{padding:0}.heroProjectTagline_EkV5{font-size:36px;text-align:center}.heroLogo_jM6J{display:block;float:none;margin:0 auto}.indexCtas_hUA_{justify-content:center}.indexCtasGitHubButton_sMIS{display:none}}@media (max-width:576px){.markdown h1:first-child{--ifm-h1-font-size:2rem}.markdown>h2{--ifm-h2-font-size:1.5rem}.markdown>h3{--ifm-h3-font-size:1.25rem}}@media screen and (max-width:576px){.searchQueryColumn_RTkw{max-width:100%!important}.searchVersionColumn_ypXd{max-width:100%!important;padding-left:var(--ifm-spacing-horizontal)!important}}@media screen and (max-width:500px){.popup_wph0{bottom:0;right:0;width:100%}}@media (hover:hover){.backToTopButton_sjWU:hover{background-color:var(--ifm-color-emphasis-300)}}@media (pointer:fine){.thin-scrollbar{scrollbar-width:thin}.thin-scrollbar::-webkit-scrollbar{height:var(--ifm-scrollbar-size);width:var(--ifm-scrollbar-size)}.thin-scrollbar::-webkit-scrollbar-track{background:var(--ifm-scrollbar-track-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb{background:var(--ifm-scrollbar-thumb-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb:hover{background:var(--ifm-scrollbar-thumb-hover-background-color)}}@media (prefers-reduced-motion:reduce){:root{--ifm-transition-fast:0ms;--ifm-transition-slow:0ms}}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Reset{animation:none;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;right:0;stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Hit--deleting,.DocSearch-Hit--favoriting{transition:none}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:none}}@media print{.announcementBar_mb4j,.footer,.menu,.navbar,.pagination-nav,.table-of-contents,.tocMobile_ITEo{display:none}.tabs{page-break-inside:avoid}.codeBlockLines_e6Vv{white-space:pre-wrap}} \ No newline at end of file diff --git a/assets/css/styles.73165556.css b/assets/css/styles.73165556.css new file mode 100644 index 0000000000..c26282fbfa --- /dev/null +++ b/assets/css/styles.73165556.css @@ -0,0 +1 @@ +.col,.container{padding:0 var(--ifm-spacing-horizontal);width:100%}.markdown>h2,.markdown>h3,.markdown>h4,.markdown>h5,.markdown>h6{margin-bottom:calc(var(--ifm-heading-vertical-rhythm-bottom)*var(--ifm-leading))}.markdown li,body{word-wrap:break-word}body,ol ol,ol ul,ul ol,ul ul{margin:0}pre,table{overflow:auto}blockquote,pre{margin:0 0 var(--ifm-spacing-vertical)}.breadcrumbs__link,.button{transition-timing-function:var(--ifm-transition-timing-default)}.button,code{vertical-align:middle}.button--outline.button--active,.button--outline:active,.button--outline:hover,:root{--ifm-button-color:var(--ifm-font-color-base-inverse)}.menu__link:hover,a{transition:color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.navbar--dark,:root{--ifm-navbar-link-hover-color:var(--ifm-color-primary)}.menu,.navbar-sidebar{overflow-x:hidden}:root,html[data-theme=dark]{--ifm-color-emphasis-500:var(--ifm-color-gray-500)}*,.DocSearch-Container,.DocSearch-Container *{box-sizing:border-box}.toggleButton_gllP,html{-webkit-tap-highlight-color:transparent}:root{--ifm-color-scheme:light;--ifm-dark-value:10%;--ifm-darker-value:15%;--ifm-darkest-value:30%;--ifm-light-value:15%;--ifm-lighter-value:30%;--ifm-lightest-value:50%;--ifm-contrast-background-value:90%;--ifm-contrast-foreground-value:70%;--ifm-contrast-background-dark-value:70%;--ifm-contrast-foreground-dark-value:90%;--ifm-color-primary:#3578e5;--ifm-color-secondary:#ebedf0;--ifm-color-success:#00a400;--ifm-color-info:#54c7ec;--ifm-color-warning:#ffba00;--ifm-color-danger:#fa383e;--ifm-color-primary-dark:#306cce;--ifm-color-primary-darker:#2d66c3;--ifm-color-primary-darkest:#2554a0;--ifm-color-primary-light:#538ce9;--ifm-color-primary-lighter:#72a1ed;--ifm-color-primary-lightest:#9abcf2;--ifm-color-primary-contrast-background:#ebf2fc;--ifm-color-primary-contrast-foreground:#102445;--ifm-color-secondary-dark:#d4d5d8;--ifm-color-secondary-darker:#c8c9cc;--ifm-color-secondary-darkest:#a4a6a8;--ifm-color-secondary-light:#eef0f2;--ifm-color-secondary-lighter:#f1f2f5;--ifm-color-secondary-lightest:#f5f6f8;--ifm-color-secondary-contrast-background:#fdfdfe;--ifm-color-secondary-contrast-foreground:#474748;--ifm-color-success-dark:#009400;--ifm-color-success-darker:#008b00;--ifm-color-success-darkest:#007300;--ifm-color-success-light:#26b226;--ifm-color-success-lighter:#4dbf4d;--ifm-color-success-lightest:#80d280;--ifm-color-success-contrast-background:#e6f6e6;--ifm-color-success-contrast-foreground:#003100;--ifm-color-info-dark:#4cb3d4;--ifm-color-info-darker:#47a9c9;--ifm-color-info-darkest:#3b8ba5;--ifm-color-info-light:#6ecfef;--ifm-color-info-lighter:#87d8f2;--ifm-color-info-lightest:#aae3f6;--ifm-color-info-contrast-background:#eef9fd;--ifm-color-info-contrast-foreground:#193c47;--ifm-color-warning-dark:#e6a700;--ifm-color-warning-darker:#d99e00;--ifm-color-warning-darkest:#b38200;--ifm-color-warning-light:#ffc426;--ifm-color-warning-lighter:#ffcf4d;--ifm-color-warning-lightest:#ffdd80;--ifm-color-warning-contrast-background:#fff8e6;--ifm-color-warning-contrast-foreground:#4d3800;--ifm-color-danger-dark:#e13238;--ifm-color-danger-darker:#d53035;--ifm-color-danger-darkest:#af272b;--ifm-color-danger-light:#fb565b;--ifm-color-danger-lighter:#fb7478;--ifm-color-danger-lightest:#fd9c9f;--ifm-color-danger-contrast-background:#ffebec;--ifm-color-danger-contrast-foreground:#4b1113;--ifm-color-white:#fff;--ifm-color-black:#000;--ifm-color-gray-0:var(--ifm-color-white);--ifm-color-gray-100:#f5f6f7;--ifm-color-gray-200:#ebedf0;--ifm-color-gray-300:#dadde1;--ifm-color-gray-400:#ccd0d5;--ifm-color-gray-500:#bec3c9;--ifm-color-gray-600:#8d949e;--ifm-color-gray-700:#606770;--ifm-color-gray-800:#444950;--ifm-color-gray-900:#1c1e21;--ifm-color-gray-1000:var(--ifm-color-black);--ifm-color-emphasis-0:var(--ifm-color-gray-0);--ifm-color-emphasis-100:var(--ifm-color-gray-100);--ifm-color-emphasis-200:var(--ifm-color-gray-200);--ifm-color-emphasis-300:var(--ifm-color-gray-300);--ifm-color-emphasis-400:var(--ifm-color-gray-400);--ifm-color-emphasis-600:var(--ifm-color-gray-600);--ifm-color-emphasis-700:var(--ifm-color-gray-700);--ifm-color-emphasis-800:var(--ifm-color-gray-800);--ifm-color-emphasis-900:var(--ifm-color-gray-900);--ifm-color-emphasis-1000:var(--ifm-color-gray-1000);--ifm-color-content:var(--ifm-color-emphasis-900);--ifm-color-content-inverse:var(--ifm-color-emphasis-0);--ifm-color-content-secondary:#525860;--ifm-background-color:#0000;--ifm-background-surface-color:var(--ifm-color-content-inverse);--ifm-global-border-width:1px;--ifm-global-radius:0.4rem;--ifm-hover-overlay:#0000000d;--ifm-font-color-base:var(--ifm-color-content);--ifm-font-color-base-inverse:var(--ifm-color-content-inverse);--ifm-font-color-secondary:var(--ifm-color-content-secondary);--ifm-font-family-base:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ifm-font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--ifm-font-size-base:100%;--ifm-font-weight-light:300;--ifm-font-weight-normal:400;--ifm-font-weight-semibold:500;--ifm-font-weight-bold:700;--ifm-font-weight-base:var(--ifm-font-weight-normal);--ifm-line-height-base:1.65;--ifm-global-spacing:1rem;--ifm-spacing-vertical:var(--ifm-global-spacing);--ifm-spacing-horizontal:var(--ifm-global-spacing);--ifm-transition-fast:200ms;--ifm-transition-slow:400ms;--ifm-transition-timing-default:cubic-bezier(0.08,0.52,0.52,1);--ifm-global-shadow-lw:0 1px 2px 0 #0000001a;--ifm-global-shadow-md:0 5px 40px #0003;--ifm-global-shadow-tl:0 12px 28px 0 #0003,0 2px 4px 0 #0000001a;--ifm-z-index-dropdown:100;--ifm-z-index-fixed:200;--ifm-z-index-overlay:400;--ifm-container-width:1140px;--ifm-container-width-xl:1320px;--ifm-code-background:#f6f7f8;--ifm-code-border-radius:var(--ifm-global-radius);--ifm-code-font-size:90%;--ifm-code-padding-horizontal:0.1rem;--ifm-code-padding-vertical:0.1rem;--ifm-pre-background:var(--ifm-code-background);--ifm-pre-border-radius:var(--ifm-code-border-radius);--ifm-pre-color:inherit;--ifm-pre-line-height:1.45;--ifm-pre-padding:1rem;--ifm-heading-color:inherit;--ifm-heading-margin-top:0;--ifm-heading-margin-bottom:var(--ifm-spacing-vertical);--ifm-heading-font-family:var(--ifm-font-family-base);--ifm-heading-font-weight:var(--ifm-font-weight-bold);--ifm-heading-line-height:1.25;--ifm-h1-font-size:2rem;--ifm-h2-font-size:1.5rem;--ifm-h3-font-size:1.25rem;--ifm-h4-font-size:1rem;--ifm-h5-font-size:0.875rem;--ifm-h6-font-size:0.85rem;--ifm-image-alignment-padding:1.25rem;--ifm-leading-desktop:1.25;--ifm-leading:calc(var(--ifm-leading-desktop)*1rem);--ifm-list-left-padding:2rem;--ifm-list-margin:1rem;--ifm-list-item-margin:0.25rem;--ifm-list-paragraph-margin:1rem;--ifm-table-cell-padding:0.75rem;--ifm-table-background:#0000;--ifm-table-stripe-background:#00000008;--ifm-table-border-width:1px;--ifm-table-border-color:var(--ifm-color-emphasis-300);--ifm-table-head-background:inherit;--ifm-table-head-color:inherit;--ifm-table-head-font-weight:var(--ifm-font-weight-bold);--ifm-table-cell-color:inherit;--ifm-link-color:var(--ifm-color-primary);--ifm-link-decoration:none;--ifm-link-hover-color:var(--ifm-link-color);--ifm-link-hover-decoration:underline;--ifm-paragraph-margin-bottom:var(--ifm-leading);--ifm-blockquote-font-size:var(--ifm-font-size-base);--ifm-blockquote-border-left-width:2px;--ifm-blockquote-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-blockquote-padding-vertical:0;--ifm-blockquote-shadow:none;--ifm-blockquote-color:var(--ifm-color-emphasis-800);--ifm-blockquote-border-color:var(--ifm-color-emphasis-300);--ifm-hr-background-color:var(--ifm-color-emphasis-500);--ifm-hr-height:1px;--ifm-hr-margin-vertical:1.5rem;--ifm-scrollbar-size:7px;--ifm-scrollbar-track-background-color:#f1f1f1;--ifm-scrollbar-thumb-background-color:silver;--ifm-scrollbar-thumb-hover-background-color:#a7a7a7;--ifm-alert-background-color:inherit;--ifm-alert-border-color:inherit;--ifm-alert-border-radius:var(--ifm-global-radius);--ifm-alert-border-width:0px;--ifm-alert-border-left-width:5px;--ifm-alert-color:var(--ifm-font-color-base);--ifm-alert-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-alert-padding-vertical:var(--ifm-spacing-vertical);--ifm-alert-shadow:var(--ifm-global-shadow-lw);--ifm-avatar-intro-margin:1rem;--ifm-avatar-intro-alignment:inherit;--ifm-avatar-photo-size:3rem;--ifm-badge-background-color:inherit;--ifm-badge-border-color:inherit;--ifm-badge-border-radius:var(--ifm-global-radius);--ifm-badge-border-width:var(--ifm-global-border-width);--ifm-badge-color:var(--ifm-color-white);--ifm-badge-padding-horizontal:calc(var(--ifm-spacing-horizontal)*0.5);--ifm-badge-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-breadcrumb-border-radius:1.5rem;--ifm-breadcrumb-spacing:0.5rem;--ifm-breadcrumb-color-active:var(--ifm-color-primary);--ifm-breadcrumb-item-background-active:var(--ifm-hover-overlay);--ifm-breadcrumb-padding-horizontal:0.8rem;--ifm-breadcrumb-padding-vertical:0.4rem;--ifm-breadcrumb-size-multiplier:1;--ifm-breadcrumb-separator:url('data:image/svg+xml;utf8,');--ifm-breadcrumb-separator-filter:none;--ifm-breadcrumb-separator-size:0.5rem;--ifm-breadcrumb-separator-size-multiplier:1.25;--ifm-button-background-color:inherit;--ifm-button-border-color:var(--ifm-button-background-color);--ifm-button-border-width:var(--ifm-global-border-width);--ifm-button-font-weight:var(--ifm-font-weight-bold);--ifm-button-padding-horizontal:1.5rem;--ifm-button-padding-vertical:0.375rem;--ifm-button-size-multiplier:1;--ifm-button-transition-duration:var(--ifm-transition-fast);--ifm-button-border-radius:calc(var(--ifm-global-radius)*var(--ifm-button-size-multiplier));--ifm-button-group-spacing:2px;--ifm-card-background-color:var(--ifm-background-surface-color);--ifm-card-border-radius:calc(var(--ifm-global-radius)*2);--ifm-card-horizontal-spacing:var(--ifm-global-spacing);--ifm-card-vertical-spacing:var(--ifm-global-spacing);--ifm-toc-border-color:var(--ifm-color-emphasis-300);--ifm-toc-link-color:var(--ifm-color-content-secondary);--ifm-toc-padding-vertical:0.5rem;--ifm-toc-padding-horizontal:0.5rem;--ifm-dropdown-background-color:var(--ifm-background-surface-color);--ifm-dropdown-font-weight:var(--ifm-font-weight-semibold);--ifm-dropdown-link-color:var(--ifm-font-color-base);--ifm-dropdown-hover-background-color:var(--ifm-hover-overlay);--ifm-footer-background-color:var(--ifm-color-emphasis-100);--ifm-footer-color:inherit;--ifm-footer-link-color:var(--ifm-color-emphasis-700);--ifm-footer-link-hover-color:var(--ifm-color-primary);--ifm-footer-link-horizontal-spacing:0.5rem;--ifm-footer-padding-horizontal:calc(var(--ifm-spacing-horizontal)*2);--ifm-footer-padding-vertical:calc(var(--ifm-spacing-vertical)*2);--ifm-footer-title-color:inherit;--ifm-footer-logo-max-width:min(30rem,90vw);--ifm-hero-background-color:var(--ifm-background-surface-color);--ifm-hero-text-color:var(--ifm-color-emphasis-800);--ifm-menu-color:var(--ifm-color-emphasis-700);--ifm-menu-color-active:var(--ifm-color-primary);--ifm-menu-color-background-active:var(--ifm-hover-overlay);--ifm-menu-color-background-hover:var(--ifm-hover-overlay);--ifm-menu-link-padding-horizontal:0.75rem;--ifm-menu-link-padding-vertical:0.375rem;--ifm-menu-link-sublist-icon:url('data:image/svg+xml;utf8,');--ifm-menu-link-sublist-icon-filter:none;--ifm-navbar-background-color:var(--ifm-background-surface-color);--ifm-navbar-height:3.75rem;--ifm-navbar-item-padding-horizontal:0.75rem;--ifm-navbar-item-padding-vertical:0.25rem;--ifm-navbar-link-color:var(--ifm-font-color-base);--ifm-navbar-link-active-color:var(--ifm-link-color);--ifm-navbar-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-navbar-padding-vertical:calc(var(--ifm-spacing-vertical)*0.5);--ifm-navbar-shadow:var(--ifm-global-shadow-lw);--ifm-navbar-search-input-background-color:var(--ifm-color-emphasis-200);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-800);--ifm-navbar-search-input-placeholder-color:var(--ifm-color-emphasis-500);--ifm-navbar-search-input-icon:url('data:image/svg+xml;utf8,');--ifm-navbar-sidebar-width:83vw;--ifm-pagination-border-radius:var(--ifm-global-radius);--ifm-pagination-color-active:var(--ifm-color-primary);--ifm-pagination-font-size:1rem;--ifm-pagination-item-active-background:var(--ifm-hover-overlay);--ifm-pagination-page-spacing:0.2em;--ifm-pagination-padding-horizontal:calc(var(--ifm-spacing-horizontal)*1);--ifm-pagination-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-pagination-nav-border-radius:var(--ifm-global-radius);--ifm-pagination-nav-color-hover:var(--ifm-color-primary);--ifm-pills-color-active:var(--ifm-color-primary);--ifm-pills-color-background-active:var(--ifm-hover-overlay);--ifm-pills-spacing:0.125rem;--ifm-tabs-color:var(--ifm-font-color-secondary);--ifm-tabs-color-active:var(--ifm-color-primary);--ifm-tabs-color-active-border:var(--ifm-tabs-color-active);--ifm-tabs-padding-horizontal:1rem;--ifm-tabs-padding-vertical:1rem;--docusaurus-progress-bar-color:var(--ifm-color-primary);--ifm-color-primary:#25c2a0;--ifm-color-primary-dark:#21af90;--ifm-color-primary-darker:#1fa588;--ifm-color-primary-darkest:#1a8870;--ifm-color-primary-light:#46cbae;--ifm-color-primary-lighter:#66d4bd;--ifm-color-primary-lightest:#92e0d0;--ifm-code-font-size:95%;--docusaurus-tag-list-border:var(--ifm-color-emphasis-300);--docsearch-primary-color:#5468ff;--docsearch-text-color:#1c1e21;--docsearch-spacing:12px;--docsearch-icon-stroke-width:1.4;--docsearch-highlight-color:var(--docsearch-primary-color);--docsearch-muted-color:#969faf;--docsearch-container-background:#656c85cc;--docsearch-logo-color:#5468ff;--docsearch-modal-width:560px;--docsearch-modal-height:600px;--docsearch-modal-background:#f5f6f7;--docsearch-modal-shadow:inset 1px 1px 0 0 #ffffff80,0 3px 8px 0 #555a64;--docsearch-searchbox-height:56px;--docsearch-searchbox-background:#ebedf0;--docsearch-searchbox-focus-background:#fff;--docsearch-searchbox-shadow:inset 0 0 0 2px var(--docsearch-primary-color);--docsearch-hit-height:56px;--docsearch-hit-color:#444950;--docsearch-hit-active-color:#fff;--docsearch-hit-background:#fff;--docsearch-hit-shadow:0 1px 3px 0 #d4d9e1;--docsearch-key-gradient:linear-gradient(-225deg,#d5dbe4,#f8f8f8);--docsearch-key-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 2px 1px #1e235a66;--docsearch-key-pressed-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 1px 0 #1e235a66;--docsearch-footer-height:44px;--docsearch-footer-background:#fff;--docsearch-footer-shadow:0 -1px 0 0 #e0e3e8,0 -3px 6px 0 #45629b1f;--docsearch-primary-color:var(--ifm-color-primary);--docsearch-text-color:var(--ifm-font-color-base);--docusaurus-announcement-bar-height:auto;--docusaurus-collapse-button-bg:#0000;--docusaurus-collapse-button-bg-hover:#0000001a;--doc-sidebar-width:300px;--doc-sidebar-hidden-width:30px}.badge--danger,.badge--info,.badge--primary,.badge--secondary,.badge--success,.badge--warning{--ifm-badge-border-color:var(--ifm-badge-background-color)}.button--link,.button--outline{--ifm-button-background-color:#0000}html{background-color:var(--ifm-background-color);color:var(--ifm-font-color-base);color-scheme:var(--ifm-color-scheme);font:var(--ifm-font-size-base)/var(--ifm-line-height-base) var(--ifm-font-family-base);-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility;-webkit-text-size-adjust:100%;text-size-adjust:100%}iframe{border:0;color-scheme:auto}.container{margin:0 auto;max-width:var(--ifm-container-width)}.container--fluid{max-width:inherit}.row{display:flex;flex-wrap:wrap;margin:0 calc(var(--ifm-spacing-horizontal)*-1)}.margin-bottom--none,.margin-vert--none,.markdown>:last-child{margin-bottom:0!important}.margin-top--none,.margin-vert--none,.tabItem_LNqP{margin-top:0!important}.row--no-gutters{margin-left:0;margin-right:0}.margin-horiz--none,.margin-right--none{margin-right:0!important}.row--no-gutters>.col{padding-left:0;padding-right:0}.row--align-top{align-items:flex-start}.row--align-bottom{align-items:flex-end}.menuExternalLink_NmtK,.row--align-center{align-items:center}.row--align-stretch{align-items:stretch}.row--align-baseline{align-items:baseline}.col{--ifm-col-width:100%;flex:1 0;margin-left:0;max-width:var(--ifm-col-width)}.padding-bottom--none,.padding-vert--none{padding-bottom:0!important}.padding-top--none,.padding-vert--none{padding-top:0!important}.padding-horiz--none,.padding-left--none{padding-left:0!important}.padding-horiz--none,.padding-right--none{padding-right:0!important}.col[class*=col--]{flex:0 0 var(--ifm-col-width)}.col--1{--ifm-col-width:8.33333%}.col--offset-1{margin-left:8.33333%}.col--2{--ifm-col-width:16.66667%}.col--offset-2{margin-left:16.66667%}.col--3{--ifm-col-width:25%}.col--offset-3{margin-left:25%}.col--4{--ifm-col-width:33.33333%}.col--offset-4{margin-left:33.33333%}.col--5{--ifm-col-width:41.66667%}.col--offset-5{margin-left:41.66667%}.col--6{--ifm-col-width:50%}.col--offset-6{margin-left:50%}.col--7{--ifm-col-width:58.33333%}.col--offset-7{margin-left:58.33333%}.col--8{--ifm-col-width:66.66667%}.col--offset-8{margin-left:66.66667%}.col--9{--ifm-col-width:75%}.col--offset-9{margin-left:75%}.col--10{--ifm-col-width:83.33333%}.col--offset-10{margin-left:83.33333%}.col--11{--ifm-col-width:91.66667%}.col--offset-11{margin-left:91.66667%}.col--12{--ifm-col-width:100%}.col--offset-12{margin-left:100%}.margin-horiz--none,.margin-left--none{margin-left:0!important}.margin--none{margin:0!important}.margin-bottom--xs,.margin-vert--xs{margin-bottom:.25rem!important}.margin-top--xs,.margin-vert--xs{margin-top:.25rem!important}.margin-horiz--xs,.margin-left--xs{margin-left:.25rem!important}.margin-horiz--xs,.margin-right--xs{margin-right:.25rem!important}.margin--xs{margin:.25rem!important}.margin-bottom--sm,.margin-vert--sm{margin-bottom:.5rem!important}.margin-top--sm,.margin-vert--sm{margin-top:.5rem!important}.margin-horiz--sm,.margin-left--sm{margin-left:.5rem!important}.margin-horiz--sm,.margin-right--sm{margin-right:.5rem!important}.margin--sm{margin:.5rem!important}.margin-bottom--md,.margin-vert--md{margin-bottom:1rem!important}.margin-top--md,.margin-vert--md{margin-top:1rem!important}.margin-horiz--md,.margin-left--md{margin-left:1rem!important}.margin-horiz--md,.margin-right--md{margin-right:1rem!important}.margin--md{margin:1rem!important}.margin-bottom--lg,.margin-vert--lg{margin-bottom:2rem!important}.margin-top--lg,.margin-vert--lg{margin-top:2rem!important}.margin-horiz--lg,.margin-left--lg{margin-left:2rem!important}.margin-horiz--lg,.margin-right--lg{margin-right:2rem!important}.margin--lg{margin:2rem!important}.margin-bottom--xl,.margin-vert--xl{margin-bottom:5rem!important}.margin-top--xl,.margin-vert--xl{margin-top:5rem!important}.margin-horiz--xl,.margin-left--xl{margin-left:5rem!important}.margin-horiz--xl,.margin-right--xl{margin-right:5rem!important}.margin--xl{margin:5rem!important}.padding--none{padding:0!important}.padding-bottom--xs,.padding-vert--xs{padding-bottom:.25rem!important}.padding-top--xs,.padding-vert--xs{padding-top:.25rem!important}.padding-horiz--xs,.padding-left--xs{padding-left:.25rem!important}.padding-horiz--xs,.padding-right--xs{padding-right:.25rem!important}.padding--xs{padding:.25rem!important}.padding-bottom--sm,.padding-vert--sm{padding-bottom:.5rem!important}.padding-top--sm,.padding-vert--sm{padding-top:.5rem!important}.padding-horiz--sm,.padding-left--sm{padding-left:.5rem!important}.padding-horiz--sm,.padding-right--sm{padding-right:.5rem!important}.padding--sm{padding:.5rem!important}.padding-bottom--md,.padding-vert--md{padding-bottom:1rem!important}.padding-top--md,.padding-vert--md{padding-top:1rem!important}.padding-horiz--md,.padding-left--md{padding-left:1rem!important}.padding-horiz--md,.padding-right--md{padding-right:1rem!important}.padding--md{padding:1rem!important}.padding-bottom--lg,.padding-vert--lg{padding-bottom:2rem!important}.padding-top--lg,.padding-vert--lg{padding-top:2rem!important}.padding-horiz--lg,.padding-left--lg{padding-left:2rem!important}.padding-horiz--lg,.padding-right--lg{padding-right:2rem!important}.padding--lg{padding:2rem!important}.padding-bottom--xl,.padding-vert--xl{padding-bottom:5rem!important}.padding-top--xl,.padding-vert--xl{padding-top:5rem!important}.padding-horiz--xl,.padding-left--xl{padding-left:5rem!important}.padding-horiz--xl,.padding-right--xl{padding-right:5rem!important}.padding--xl{padding:5rem!important}code{background-color:var(--ifm-code-background);border:.1rem solid #0000001a;border-radius:var(--ifm-code-border-radius);font-family:var(--ifm-font-family-monospace);font-size:var(--ifm-code-font-size);padding:var(--ifm-code-padding-vertical) var(--ifm-code-padding-horizontal)}a code{color:inherit}pre{background-color:var(--ifm-pre-background);border-radius:var(--ifm-pre-border-radius);color:var(--ifm-pre-color);font:var(--ifm-code-font-size)/var(--ifm-pre-line-height) var(--ifm-font-family-monospace);padding:var(--ifm-pre-padding)}pre code{background-color:initial;border:none;font-size:100%;line-height:inherit;padding:0}kbd{background-color:var(--ifm-color-emphasis-0);border:1px solid var(--ifm-color-emphasis-400);border-radius:.2rem;box-shadow:inset 0 -1px 0 var(--ifm-color-emphasis-400);color:var(--ifm-color-emphasis-800);font:80% var(--ifm-font-family-monospace);padding:.15rem .3rem}h1,h2,h3,h4,h5,h6{color:var(--ifm-heading-color);font-family:var(--ifm-heading-font-family);font-weight:var(--ifm-heading-font-weight);line-height:var(--ifm-heading-line-height);margin:var(--ifm-heading-margin-top) 0 var(--ifm-heading-margin-bottom) 0}h1{font-size:var(--ifm-h1-font-size)}h2{font-size:var(--ifm-h2-font-size)}h3{font-size:var(--ifm-h3-font-size)}h4{font-size:var(--ifm-h4-font-size)}h5{font-size:var(--ifm-h5-font-size)}h6{font-size:var(--ifm-h6-font-size)}img{max-width:100%}img[align=right]{padding-left:var(--image-alignment-padding)}img[align=left]{padding-right:var(--image-alignment-padding)}.markdown{--ifm-h1-vertical-rhythm-top:3;--ifm-h2-vertical-rhythm-top:2;--ifm-h3-vertical-rhythm-top:1.5;--ifm-heading-vertical-rhythm-top:1.25;--ifm-h1-vertical-rhythm-bottom:1.25;--ifm-heading-vertical-rhythm-bottom:1}.markdown:after,.markdown:before{content:"";display:table}.markdown:after{clear:both}.markdown h1:first-child{--ifm-h1-font-size:3rem;margin-bottom:calc(var(--ifm-h1-vertical-rhythm-bottom)*var(--ifm-leading))}.markdown>h2{--ifm-h2-font-size:2rem;margin-top:calc(var(--ifm-h2-vertical-rhythm-top)*var(--ifm-leading))}.markdown>h3{--ifm-h3-font-size:1.5rem;margin-top:calc(var(--ifm-h3-vertical-rhythm-top)*var(--ifm-leading))}.markdown>h4,.markdown>h5,.markdown>h6{margin-top:calc(var(--ifm-heading-vertical-rhythm-top)*var(--ifm-leading))}.markdown>p,.markdown>pre,.markdown>ul,.tabList__CuJ{margin-bottom:var(--ifm-leading)}.markdown li>p{margin-top:var(--ifm-list-paragraph-margin)}.markdown li+li{margin-top:var(--ifm-list-item-margin)}ol,ul{margin:0 0 var(--ifm-list-margin);padding-left:var(--ifm-list-left-padding)}ol ol,ul ol{list-style-type:lower-roman}ol ol ol,ol ul ol,ul ol ol,ul ul ol{list-style-type:lower-alpha}table{border-collapse:collapse;display:block;margin-bottom:var(--ifm-spacing-vertical)}table thead tr{border-bottom:2px solid var(--ifm-table-border-color)}table thead,table tr:nth-child(2n){background-color:var(--ifm-table-stripe-background)}table tr{background-color:var(--ifm-table-background);border-top:var(--ifm-table-border-width) solid var(--ifm-table-border-color)}table td,table th{border:var(--ifm-table-border-width) solid var(--ifm-table-border-color);padding:var(--ifm-table-cell-padding)}table th{background-color:var(--ifm-table-head-background);color:var(--ifm-table-head-color);font-weight:var(--ifm-table-head-font-weight)}table td{color:var(--ifm-table-cell-color)}strong{font-weight:var(--ifm-font-weight-bold)}a{color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}a:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button:hover,.text--no-decoration,.text--no-decoration:hover,a:not([href]){-webkit-text-decoration:none;text-decoration:none}p{margin:0 0 var(--ifm-paragraph-margin-bottom)}blockquote{border-left:var(--ifm-blockquote-border-left-width) solid var(--ifm-blockquote-border-color);box-shadow:var(--ifm-blockquote-shadow);color:var(--ifm-blockquote-color);font-size:var(--ifm-blockquote-font-size);padding:var(--ifm-blockquote-padding-vertical) var(--ifm-blockquote-padding-horizontal)}blockquote>:first-child{margin-top:0}blockquote>:last-child{margin-bottom:0}hr{background-color:var(--ifm-hr-background-color);border:0;height:var(--ifm-hr-height);margin:var(--ifm-hr-margin-vertical) 0}.shadow--lw{box-shadow:var(--ifm-global-shadow-lw)!important}.shadow--md{box-shadow:var(--ifm-global-shadow-md)!important}.shadow--tl{box-shadow:var(--ifm-global-shadow-tl)!important}.text--primary{color:var(--ifm-color-primary)}.text--secondary{color:var(--ifm-color-secondary)}.text--success{color:var(--ifm-color-success)}.text--info{color:var(--ifm-color-info)}.text--warning{color:var(--ifm-color-warning)}.text--danger{color:var(--ifm-color-danger)}.text--center{text-align:center}.text--left{text-align:left}.text--justify{text-align:justify}.text--right{text-align:right}.text--capitalize{text-transform:capitalize}.text--lowercase{text-transform:lowercase}.admonitionHeading_Gvgb,.alert__heading,.text--uppercase{text-transform:uppercase}.text--light{font-weight:var(--ifm-font-weight-light)}.text--normal{font-weight:var(--ifm-font-weight-normal)}.text--semibold{font-weight:var(--ifm-font-weight-semibold)}.text--bold{font-weight:var(--ifm-font-weight-bold)}.text--italic{font-style:italic}.text--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text--break{word-wrap:break-word!important;word-break:break-word!important}.clean-btn{background:none;border:none;color:inherit;cursor:pointer;font-family:inherit;padding:0}.alert,.alert .close{color:var(--ifm-alert-foreground-color)}.clean-list{list-style:none;padding-left:0}.alert--primary{--ifm-alert-background-color:var(--ifm-color-primary-contrast-background);--ifm-alert-background-color-highlight:#3578e526;--ifm-alert-foreground-color:var(--ifm-color-primary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-primary-dark)}.alert--secondary{--ifm-alert-background-color:var(--ifm-color-secondary-contrast-background);--ifm-alert-background-color-highlight:#ebedf026;--ifm-alert-foreground-color:var(--ifm-color-secondary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-secondary-dark)}.alert--success{--ifm-alert-background-color:var(--ifm-color-success-contrast-background);--ifm-alert-background-color-highlight:#00a40026;--ifm-alert-foreground-color:var(--ifm-color-success-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-success-dark)}.alert--info{--ifm-alert-background-color:var(--ifm-color-info-contrast-background);--ifm-alert-background-color-highlight:#54c7ec26;--ifm-alert-foreground-color:var(--ifm-color-info-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-info-dark)}.alert--warning{--ifm-alert-background-color:var(--ifm-color-warning-contrast-background);--ifm-alert-background-color-highlight:#ffba0026;--ifm-alert-foreground-color:var(--ifm-color-warning-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-warning-dark)}.alert--danger{--ifm-alert-background-color:var(--ifm-color-danger-contrast-background);--ifm-alert-background-color-highlight:#fa383e26;--ifm-alert-foreground-color:var(--ifm-color-danger-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-danger-dark)}.alert{--ifm-code-background:var(--ifm-alert-background-color-highlight);--ifm-link-color:var(--ifm-alert-foreground-color);--ifm-link-hover-color:var(--ifm-alert-foreground-color);--ifm-link-decoration:underline;--ifm-tabs-color:var(--ifm-alert-foreground-color);--ifm-tabs-color-active:var(--ifm-alert-foreground-color);--ifm-tabs-color-active-border:var(--ifm-alert-border-color);background-color:var(--ifm-alert-background-color);border:var(--ifm-alert-border-width) solid var(--ifm-alert-border-color);border-left-width:var(--ifm-alert-border-left-width);border-radius:var(--ifm-alert-border-radius);box-shadow:var(--ifm-alert-shadow);padding:var(--ifm-alert-padding-vertical) var(--ifm-alert-padding-horizontal)}.alert__heading{align-items:center;display:flex;font:700 var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.5rem}.alert__icon{display:inline-flex;margin-right:.4em}.alert__icon svg{fill:var(--ifm-alert-foreground-color);stroke:var(--ifm-alert-foreground-color);stroke-width:0}.alert .close{margin:calc(var(--ifm-alert-padding-vertical)*-1) calc(var(--ifm-alert-padding-horizontal)*-1) 0 0;opacity:.75}.alert .close:focus,.alert .close:hover{opacity:1}.alert a{text-decoration-color:var(--ifm-alert-border-color)}.alert a:hover{text-decoration-thickness:2px}.avatar{column-gap:var(--ifm-avatar-intro-margin);display:flex}.avatar__photo{border-radius:50%;display:block;height:var(--ifm-avatar-photo-size);overflow:hidden;width:var(--ifm-avatar-photo-size)}.card--full-height,.navbar__logo img,body,html{height:100%}.avatar__photo--sm{--ifm-avatar-photo-size:2rem}.avatar__photo--lg{--ifm-avatar-photo-size:4rem}.avatar__photo--xl{--ifm-avatar-photo-size:6rem}.avatar__intro{display:flex;flex:1 1;flex-direction:column;justify-content:center;text-align:var(--ifm-avatar-intro-alignment)}.badge,.breadcrumbs__item,.breadcrumbs__link,.button,.dropdown>.navbar__link:after{display:inline-block}.avatar__name{font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base)}.avatar__subtitle{margin-top:.25rem}.avatar--vertical{--ifm-avatar-intro-alignment:center;--ifm-avatar-intro-margin:0.5rem;align-items:center;flex-direction:column}.badge{background-color:var(--ifm-badge-background-color);border:var(--ifm-badge-border-width) solid var(--ifm-badge-border-color);border-radius:var(--ifm-badge-border-radius);color:var(--ifm-badge-color);font-size:75%;font-weight:var(--ifm-font-weight-bold);line-height:1;padding:var(--ifm-badge-padding-vertical) var(--ifm-badge-padding-horizontal)}.badge--primary{--ifm-badge-background-color:var(--ifm-color-primary)}.badge--secondary{--ifm-badge-background-color:var(--ifm-color-secondary);color:var(--ifm-color-black)}.breadcrumbs__link,.button.button--secondary.button--outline:not(.button--active):not(:hover){color:var(--ifm-font-color-base)}.badge--success{--ifm-badge-background-color:var(--ifm-color-success)}.badge--info{--ifm-badge-background-color:var(--ifm-color-info)}.badge--warning{--ifm-badge-background-color:var(--ifm-color-warning)}.badge--danger{--ifm-badge-background-color:var(--ifm-color-danger)}.breadcrumbs{margin-bottom:0;padding-left:0}.breadcrumbs__item:not(:last-child):after{background:var(--ifm-breadcrumb-separator) center;content:" ";display:inline-block;filter:var(--ifm-breadcrumb-separator-filter);height:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier));margin:0 var(--ifm-breadcrumb-spacing);opacity:.5;width:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier))}.breadcrumbs__item--active .breadcrumbs__link{background:var(--ifm-breadcrumb-item-background-active);color:var(--ifm-breadcrumb-color-active)}.breadcrumbs__link{border-radius:var(--ifm-breadcrumb-border-radius);font-size:calc(1rem*var(--ifm-breadcrumb-size-multiplier));padding:calc(var(--ifm-breadcrumb-padding-vertical)*var(--ifm-breadcrumb-size-multiplier)) calc(var(--ifm-breadcrumb-padding-horizontal)*var(--ifm-breadcrumb-size-multiplier));transition-duration:var(--ifm-transition-fast);transition-property:background,color}.breadcrumbs__link:any-link:hover,.breadcrumbs__link:link:hover,.breadcrumbs__link:visited:hover,area[href].breadcrumbs__link:hover{background:var(--ifm-breadcrumb-item-background-active);-webkit-text-decoration:none;text-decoration:none}.breadcrumbs--sm{--ifm-breadcrumb-size-multiplier:0.8}.breadcrumbs--lg{--ifm-breadcrumb-size-multiplier:1.2}.button{background-color:var(--ifm-button-background-color);border:var(--ifm-button-border-width) solid var(--ifm-button-border-color);border-radius:var(--ifm-button-border-radius);cursor:pointer;font-size:calc(.875rem*var(--ifm-button-size-multiplier));font-weight:var(--ifm-button-font-weight);line-height:1.5;padding:calc(var(--ifm-button-padding-vertical)*var(--ifm-button-size-multiplier)) calc(var(--ifm-button-padding-horizontal)*var(--ifm-button-size-multiplier));text-align:center;transition-duration:var(--ifm-button-transition-duration);transition-property:color,background,border-color;-webkit-user-select:none;user-select:none;white-space:nowrap}.button,.button:hover{color:var(--ifm-button-color)}.button--outline{--ifm-button-color:var(--ifm-button-border-color)}.button--outline:hover{--ifm-button-background-color:var(--ifm-button-border-color)}.button--link{--ifm-button-border-color:#0000;color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}.button--link.button--active,.button--link:active,.button--link:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.DocSearch-Container a,.dropdown__link--active,.dropdown__link:hover,.menu__link:hover,.navbar__brand:hover,.navbar__link--active,.navbar__link:hover,.pagination-nav__link:hover,.pagination__link:hover,.tag_zVej:hover{-webkit-text-decoration:none;text-decoration:none}.button.disabled,.button:disabled,.button[disabled]{opacity:.65;pointer-events:none}.button--sm{--ifm-button-size-multiplier:0.8}.button--lg{--ifm-button-size-multiplier:1.35}.button--block{display:block;width:100%}.button.button--secondary{color:var(--ifm-color-gray-900)}:where(.button--primary){--ifm-button-background-color:var(--ifm-color-primary);--ifm-button-border-color:var(--ifm-color-primary)}:where(.button--primary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-primary-dark);--ifm-button-border-color:var(--ifm-color-primary-dark)}.button--primary.button--active,.button--primary:active{--ifm-button-background-color:var(--ifm-color-primary-darker);--ifm-button-border-color:var(--ifm-color-primary-darker)}:where(.button--secondary){--ifm-button-background-color:var(--ifm-color-secondary);--ifm-button-border-color:var(--ifm-color-secondary)}:where(.button--secondary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-secondary-dark);--ifm-button-border-color:var(--ifm-color-secondary-dark)}.button--secondary.button--active,.button--secondary:active{--ifm-button-background-color:var(--ifm-color-secondary-darker);--ifm-button-border-color:var(--ifm-color-secondary-darker)}:where(.button--success){--ifm-button-background-color:var(--ifm-color-success);--ifm-button-border-color:var(--ifm-color-success)}:where(.button--success):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-success-dark);--ifm-button-border-color:var(--ifm-color-success-dark)}.button--success.button--active,.button--success:active{--ifm-button-background-color:var(--ifm-color-success-darker);--ifm-button-border-color:var(--ifm-color-success-darker)}:where(.button--info){--ifm-button-background-color:var(--ifm-color-info);--ifm-button-border-color:var(--ifm-color-info)}:where(.button--info):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-info-dark);--ifm-button-border-color:var(--ifm-color-info-dark)}.button--info.button--active,.button--info:active{--ifm-button-background-color:var(--ifm-color-info-darker);--ifm-button-border-color:var(--ifm-color-info-darker)}:where(.button--warning){--ifm-button-background-color:var(--ifm-color-warning);--ifm-button-border-color:var(--ifm-color-warning)}:where(.button--warning):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-warning-dark);--ifm-button-border-color:var(--ifm-color-warning-dark)}.button--warning.button--active,.button--warning:active{--ifm-button-background-color:var(--ifm-color-warning-darker);--ifm-button-border-color:var(--ifm-color-warning-darker)}:where(.button--danger){--ifm-button-background-color:var(--ifm-color-danger);--ifm-button-border-color:var(--ifm-color-danger)}:where(.button--danger):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-danger-dark);--ifm-button-border-color:var(--ifm-color-danger-dark)}.button--danger.button--active,.button--danger:active{--ifm-button-background-color:var(--ifm-color-danger-darker);--ifm-button-border-color:var(--ifm-color-danger-darker)}.button-group{display:inline-flex;gap:var(--ifm-button-group-spacing)}.button-group>.button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.button-group>.button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.button-group--block{display:flex;justify-content:stretch}.button-group--block>.button{flex-grow:1}.card{background-color:var(--ifm-card-background-color);border-radius:var(--ifm-card-border-radius);box-shadow:var(--ifm-global-shadow-lw);display:flex;flex-direction:column;overflow:hidden}.card__image{padding-top:var(--ifm-card-vertical-spacing)}.card__image:first-child{padding-top:0}.card__body,.card__footer,.card__header{padding:var(--ifm-card-vertical-spacing) var(--ifm-card-horizontal-spacing)}.card__body:not(:last-child),.card__footer:not(:last-child),.card__header:not(:last-child){padding-bottom:0}.card__body>:last-child,.card__footer>:last-child,.card__header>:last-child{margin-bottom:0}.card__footer{margin-top:auto}.table-of-contents{font-size:.8rem;margin-bottom:0;padding:var(--ifm-toc-padding-vertical) 0}.table-of-contents,.table-of-contents ul{list-style:none;padding-left:var(--ifm-toc-padding-horizontal)}.table-of-contents li{margin:var(--ifm-toc-padding-vertical) var(--ifm-toc-padding-horizontal)}.table-of-contents__left-border{border-left:1px solid var(--ifm-toc-border-color)}.table-of-contents__link{color:var(--ifm-toc-link-color);display:block}.table-of-contents__link--active,.table-of-contents__link--active code,.table-of-contents__link:hover,.table-of-contents__link:hover code{color:var(--ifm-color-primary);-webkit-text-decoration:none;text-decoration:none}.close{color:var(--ifm-color-black);float:right;font-size:1.5rem;font-weight:var(--ifm-font-weight-bold);line-height:1;opacity:.5;padding:1rem;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.close:hover{opacity:.7}.close:focus,.theme-code-block-highlighted-line .codeLineNumber_Tfdd:before{opacity:.8}.dropdown{display:inline-flex;font-weight:var(--ifm-dropdown-font-weight);position:relative;vertical-align:top}.dropdown--hoverable:hover .dropdown__menu,.dropdown--show .dropdown__menu{opacity:1;pointer-events:all;transform:translateY(-1px);visibility:visible}#nprogress,.dropdown__menu,.navbar__item.dropdown .navbar__link:not([href]){pointer-events:none}.dropdown--right .dropdown__menu{left:inherit;right:0}.dropdown--nocaret .navbar__link:after{content:none!important}.dropdown__menu{background-color:var(--ifm-dropdown-background-color);border-radius:var(--ifm-global-radius);box-shadow:var(--ifm-global-shadow-md);left:0;list-style:none;max-height:80vh;min-width:10rem;opacity:0;overflow-y:auto;padding:.5rem;position:absolute;top:calc(100% - var(--ifm-navbar-item-padding-vertical) + .3rem);transform:translateY(-.625rem);transition-duration:var(--ifm-transition-fast);transition-property:opacity,transform,visibility;transition-timing-function:var(--ifm-transition-timing-default);visibility:hidden;z-index:var(--ifm-z-index-dropdown)}.menu__caret,.menu__link,.menu__list-item-collapsible{border-radius:.25rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.dropdown__link{border-radius:.25rem;color:var(--ifm-dropdown-link-color);display:block;font-size:.875rem;margin-top:.2rem;padding:.25rem .5rem;white-space:nowrap}.dropdown__link--active,.dropdown__link:hover{background-color:var(--ifm-dropdown-hover-background-color);color:var(--ifm-dropdown-link-color)}.dropdown__link--active,.dropdown__link--active:hover{--ifm-dropdown-link-color:var(--ifm-link-color)}.dropdown>.navbar__link:after{border-color:currentcolor #0000;border-style:solid;border-width:.4em .4em 0;content:"";margin-left:.3em;position:relative;top:2px;transform:translateY(-50%)}.footer{background-color:var(--ifm-footer-background-color);color:var(--ifm-footer-color);padding:var(--ifm-footer-padding-vertical) var(--ifm-footer-padding-horizontal)}.footer--dark{--ifm-footer-background-color:#303846;--ifm-footer-color:var(--ifm-footer-link-color);--ifm-footer-link-color:var(--ifm-color-secondary);--ifm-footer-title-color:var(--ifm-color-white)}.footer__links{margin-bottom:1rem}.footer__link-item{color:var(--ifm-footer-link-color);line-height:2}.footer__link-item:hover{color:var(--ifm-footer-link-hover-color)}.footer__link-separator{margin:0 var(--ifm-footer-link-horizontal-spacing)}.footer__logo{margin-top:1rem;max-width:var(--ifm-footer-logo-max-width)}.footer__title{color:var(--ifm-footer-title-color);font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base);margin-bottom:var(--ifm-heading-margin-bottom)}.menu,.navbar__link{font-weight:var(--ifm-font-weight-semibold)}.docItemContainer_Djhp article>:first-child,.docItemContainer_Djhp header+*,.footer__item{margin-top:0}.admonitionContent_BuS1>:last-child,.collapsibleContent_i85q p:last-child,.details_lb9f>summary>p:last-child,.footer__items,.tabItem_Ymn6>:last-child{margin-bottom:0}.codeBlockStandalone_MEMb,[type=checkbox]{padding:0}.hero{align-items:center;background-color:var(--ifm-hero-background-color);color:var(--ifm-hero-text-color);display:flex;padding:4rem 2rem}.hero--primary{--ifm-hero-background-color:var(--ifm-color-primary);--ifm-hero-text-color:var(--ifm-font-color-base-inverse)}.hero--dark{--ifm-hero-background-color:#303846;--ifm-hero-text-color:var(--ifm-color-white)}.hero__title{font-size:3rem}.hero__subtitle{font-size:1.5rem}.menu__list{list-style:none;margin:0;padding-left:0}.menu__caret,.menu__link{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu__list .menu__list{flex:0 0 100%;margin-top:.25rem;padding-left:var(--ifm-menu-link-padding-horizontal)}.menu__list-item:not(:first-child){margin-top:.25rem}.menu__list-item--collapsed .menu__list{height:0;overflow:hidden}.details_lb9f[data-collapsed=false].isBrowser_bmU9>summary:before,.details_lb9f[open]:not(.isBrowser_bmU9)>summary:before,.menu__list-item--collapsed .menu__caret:before,.menu__list-item--collapsed .menu__link--sublist:after{transform:rotate(90deg)}.menu__list-item-collapsible{display:flex;flex-wrap:wrap;position:relative}.menu__caret:hover,.menu__link:hover,.menu__list-item-collapsible--active,.menu__list-item-collapsible:hover{background:var(--ifm-menu-color-background-hover)}.menu__list-item-collapsible .menu__link--active,.menu__list-item-collapsible .menu__link:hover{background:none!important}.menu__caret,.menu__link{align-items:center;display:flex}.navbar-sidebar,.navbar-sidebar__backdrop{bottom:0;opacity:0;transition-duration:var(--ifm-transition-fast);transition-timing-function:ease-in-out;top:0;visibility:hidden;left:0}.menu__link{color:var(--ifm-menu-color);flex:1;line-height:1.25}.menu__link:hover{color:var(--ifm-menu-color)}.menu__caret:before,.menu__link--sublist-caret:after{height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast) linear;width:1.25rem;filter:var(--ifm-menu-link-sublist-icon-filter);content:""}.menu__link--sublist-caret:after{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem;margin-left:auto;min-width:1.25rem}.menu__link--active,.menu__link--active:hover{color:var(--ifm-menu-color-active)}.navbar__brand,.navbar__link{color:var(--ifm-navbar-link-color)}.menu__link--active:not(.menu__link--sublist){background-color:var(--ifm-menu-color-background-active)}.menu__caret:before{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem}.navbar--dark,html[data-theme=dark]{--ifm-menu-link-sublist-icon-filter:invert(100%) sepia(94%) saturate(17%) hue-rotate(223deg) brightness(104%) contrast(98%)}.navbar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-navbar-shadow);height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar,.navbar>.container,.navbar>.container-fluid{display:flex}.navbar--fixed-top{position:sticky;top:0;z-index:var(--ifm-z-index-fixed)}.navbar__inner{display:flex;flex-wrap:wrap;justify-content:space-between;width:100%}.navbar__brand{align-items:center;display:flex;margin-right:1rem;min-width:0}.navbar__brand:hover{color:var(--ifm-navbar-link-hover-color)}.announcementBarContent_xLdY,.navbar__title{flex:1 1 auto}.navbar__toggle{display:none;margin-right:.5rem}.navbar__logo{flex:0 0 auto;height:2rem;margin-right:.5rem}.navbar__items{align-items:center;display:flex;flex:1;min-width:0}.navbar__items--center{flex:0 0 auto}.navbar__items--center .navbar__brand,.popup_wph0 p{margin:0}.navbar__items--center+.navbar__items--right{flex:1}.navbar__items--right{flex:0 0 auto;justify-content:flex-end}.navbar__items--right>:last-child{padding-right:0}.navbar__item{display:inline-block;padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.navbar__link--active,.navbar__link:hover{color:var(--ifm-navbar-link-hover-color)}.navbar--dark,.navbar--primary{--ifm-menu-color:var(--ifm-color-gray-300);--ifm-navbar-link-color:var(--ifm-color-gray-100);--ifm-navbar-search-input-background-color:#ffffff1a;--ifm-navbar-search-input-placeholder-color:#ffffff80;color:var(--ifm-color-white)}.navbar--dark{--ifm-navbar-background-color:#242526;--ifm-menu-color-background-active:#ffffff0d;--ifm-navbar-search-input-color:var(--ifm-color-white)}.navbar--primary{--ifm-navbar-background-color:var(--ifm-color-primary);--ifm-navbar-link-hover-color:var(--ifm-color-white);--ifm-menu-color-active:var(--ifm-color-white);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-500)}.navbar__search-input{appearance:none;background:var(--ifm-navbar-search-input-background-color) var(--ifm-navbar-search-input-icon) no-repeat .75rem center/1rem 1rem;border:none;border-radius:2rem;color:var(--ifm-navbar-search-input-color);cursor:text;display:inline-block;font-size:1rem;height:2rem;padding:0 .5rem 0 2.25rem;width:12.5rem}.navbar__search-input::placeholder{color:var(--ifm-navbar-search-input-placeholder-color)}.navbar-sidebar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-global-shadow-md);position:fixed;transform:translate3d(-100%,0,0);transition-property:opacity,visibility,transform;width:var(--ifm-navbar-sidebar-width)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar__items{transform:translateZ(0)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar--show .navbar-sidebar__backdrop{opacity:1;visibility:visible}.navbar-sidebar__backdrop{background-color:#0009;position:fixed;right:0;transition-property:opacity,visibility}.navbar-sidebar__brand{align-items:center;box-shadow:var(--ifm-navbar-shadow);display:flex;flex:1;height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar-sidebar__items{display:flex;height:calc(100% - var(--ifm-navbar-height));transition:transform var(--ifm-transition-fast) ease-in-out}.navbar-sidebar__items--show-secondary{transform:translate3d(calc((var(--ifm-navbar-sidebar-width))*-1),0,0)}.navbar-sidebar__item{flex-shrink:0;padding:.5rem;width:calc(var(--ifm-navbar-sidebar-width))}.navbar-sidebar__back{background:var(--ifm-menu-color-background-active);font-size:15px;font-weight:var(--ifm-button-font-weight);margin:0 0 .2rem -.5rem;padding:.6rem 1.5rem;position:relative;text-align:left;top:-.5rem;width:calc(100% + 1rem)}.navbar-sidebar__close{display:flex;margin-left:auto}.pagination{column-gap:var(--ifm-pagination-page-spacing);display:flex;font-size:var(--ifm-pagination-font-size);padding-left:0}.pagination--sm{--ifm-pagination-font-size:0.8rem;--ifm-pagination-padding-horizontal:0.8rem;--ifm-pagination-padding-vertical:0.2rem}.pagination--lg{--ifm-pagination-font-size:1.2rem;--ifm-pagination-padding-horizontal:1.2rem;--ifm-pagination-padding-vertical:0.3rem}.pagination__item{display:inline-flex}.pagination__item>span{padding:var(--ifm-pagination-padding-vertical)}.pagination__item--active .pagination__link{color:var(--ifm-pagination-color-active)}.pagination__item--active .pagination__link,.pagination__item:not(.pagination__item--active):hover .pagination__link{background:var(--ifm-pagination-item-active-background)}.pagination__item--disabled,.pagination__item[disabled]{opacity:.25;pointer-events:none}.pagination__link{border-radius:var(--ifm-pagination-border-radius);color:var(--ifm-font-color-base);display:inline-block;padding:var(--ifm-pagination-padding-vertical) var(--ifm-pagination-padding-horizontal);transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination-nav{display:grid;grid-gap:var(--ifm-spacing-horizontal);gap:var(--ifm-spacing-horizontal);grid-template-columns:repeat(2,1fr)}.pagination-nav__link{border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-pagination-nav-border-radius);display:block;height:100%;line-height:var(--ifm-heading-line-height);padding:var(--ifm-global-spacing);transition:border-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination-nav__link:hover{border-color:var(--ifm-pagination-nav-color-hover)}.pagination-nav__link--next{grid-column:2/3;text-align:right}.pagination-nav__label{font-size:var(--ifm-h4-font-size);font-weight:var(--ifm-heading-font-weight);word-break:break-word}.pagination-nav__link--prev .pagination-nav__label:before{content:"« "}.pagination-nav__link--next .pagination-nav__label:after{content:" »"}.pagination-nav__sublabel{color:var(--ifm-color-content-secondary);font-size:var(--ifm-h5-font-size);font-weight:var(--ifm-font-weight-semibold);margin-bottom:.25rem}.pills__item,.tabs{font-weight:var(--ifm-font-weight-bold)}.pills{display:flex;gap:var(--ifm-pills-spacing);padding-left:0}.pills__item{border-radius:.5rem;cursor:pointer;display:inline-block;padding:.25rem 1rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs,:not(.containsTaskList_mC6p>li)>.containsTaskList_mC6p{padding-left:0}.pills__item--active{color:var(--ifm-pills-color-active)}.pills__item--active,.pills__item:not(.pills__item--active):hover{background:var(--ifm-pills-color-background-active)}.pills--block{justify-content:stretch}.pills--block .pills__item{flex-grow:1;text-align:center}.tabs{color:var(--ifm-tabs-color);display:flex;margin-bottom:0;overflow-x:auto}.tabs__item{border-bottom:3px solid #0000;border-radius:var(--ifm-global-radius);cursor:pointer;display:inline-flex;padding:var(--ifm-tabs-padding-vertical) var(--ifm-tabs-padding-horizontal);transition:background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs__item--active{border-bottom-color:var(--ifm-tabs-color-active-border);border-bottom-left-radius:0;border-bottom-right-radius:0;color:var(--ifm-tabs-color-active)}.tabs__item:hover{background-color:var(--ifm-hover-overlay)}.tabs--block{justify-content:stretch}.tabs--block .tabs__item{flex-grow:1;justify-content:center}html[data-theme=dark]{--ifm-color-scheme:dark;--ifm-color-emphasis-0:var(--ifm-color-gray-1000);--ifm-color-emphasis-100:var(--ifm-color-gray-900);--ifm-color-emphasis-200:var(--ifm-color-gray-800);--ifm-color-emphasis-300:var(--ifm-color-gray-700);--ifm-color-emphasis-400:var(--ifm-color-gray-600);--ifm-color-emphasis-600:var(--ifm-color-gray-400);--ifm-color-emphasis-700:var(--ifm-color-gray-300);--ifm-color-emphasis-800:var(--ifm-color-gray-200);--ifm-color-emphasis-900:var(--ifm-color-gray-100);--ifm-color-emphasis-1000:var(--ifm-color-gray-0);--ifm-background-color:#1b1b1d;--ifm-background-surface-color:#242526;--ifm-hover-overlay:#ffffff0d;--ifm-color-content:#e3e3e3;--ifm-color-content-secondary:#fff;--ifm-breadcrumb-separator-filter:invert(64%) sepia(11%) saturate(0%) hue-rotate(149deg) brightness(99%) contrast(95%);--ifm-code-background:#ffffff1a;--ifm-scrollbar-track-background-color:#444;--ifm-scrollbar-thumb-background-color:#686868;--ifm-scrollbar-thumb-hover-background-color:#7a7a7a;--ifm-table-stripe-background:#ffffff12;--ifm-toc-border-color:var(--ifm-color-emphasis-200);--ifm-color-primary-contrast-background:#102445;--ifm-color-primary-contrast-foreground:#ebf2fc;--ifm-color-secondary-contrast-background:#474748;--ifm-color-secondary-contrast-foreground:#fdfdfe;--ifm-color-success-contrast-background:#003100;--ifm-color-success-contrast-foreground:#e6f6e6;--ifm-color-info-contrast-background:#193c47;--ifm-color-info-contrast-foreground:#eef9fd;--ifm-color-warning-contrast-background:#4d3800;--ifm-color-warning-contrast-foreground:#fff8e6;--ifm-color-danger-contrast-background:#4b1113;--ifm-color-danger-contrast-foreground:#ffebec;--docsearch-text-color:#f5f6f7;--docsearch-container-background:#090a11cc;--docsearch-modal-background:#15172a;--docsearch-modal-shadow:inset 1px 1px 0 0 #2c2e40,0 3px 8px 0 #000309;--docsearch-searchbox-background:#090a11;--docsearch-searchbox-focus-background:#000;--docsearch-hit-color:#bec3c9;--docsearch-hit-shadow:none;--docsearch-hit-background:#090a11;--docsearch-key-gradient:linear-gradient(-26.5deg,#565872,#31355b);--docsearch-key-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 2px 2px 0 #0304094d;--docsearch-key-pressed-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 1px 1px 0 #0304094d;--docsearch-footer-background:#1e2136;--docsearch-footer-shadow:inset 0 1px 0 0 #494c6a80,0 -4px 8px 0 #0003;--docsearch-logo-color:#fff;--docsearch-muted-color:#7f8497}#nprogress .bar{background:var(--docusaurus-progress-bar-color);height:2px;left:0;position:fixed;top:0;width:100%;z-index:1031}#nprogress .peg{box-shadow:0 0 10px var(--docusaurus-progress-bar-color),0 0 5px var(--docusaurus-progress-bar-color);height:100%;opacity:1;position:absolute;right:0;transform:rotate(3deg) translateY(-4px);width:100px}.docusaurus-highlight-code-line{background-color:#484d5b;display:block;margin:0 calc(var(--ifm-pre-padding)*-1);padding:0 var(--ifm-pre-padding)}.header-github-link:hover{opacity:.6}.header-github-link:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat;content:"";display:flex;height:24px;width:24px}html[data-theme=dark] .header-github-link:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat}.tag_zVej{border:1px solid var(--docusaurus-tag-list-border);transition:border var(--ifm-transition-fast)}.tag_zVej:hover{--docusaurus-tag-list-border:var(--ifm-link-color)}.tagRegular_sFm0{border-radius:var(--ifm-global-radius);font-size:90%;padding:.2rem .5rem .3rem}.tagWithCount_h2kH{align-items:center;border-left:0;display:flex;padding:0 .5rem 0 1rem;position:relative}.tagWithCount_h2kH:after,.tagWithCount_h2kH:before{border:1px solid var(--docusaurus-tag-list-border);content:"";position:absolute;top:50%;transition:inherit}.tagWithCount_h2kH:before{border-bottom:0;border-right:0;height:1.18rem;right:100%;transform:translate(50%,-50%) rotate(-45deg);width:1.18rem}.tagWithCount_h2kH:after{border-radius:50%;height:.5rem;left:0;transform:translateY(-50%);width:.5rem}.tagWithCount_h2kH span{background:var(--ifm-color-secondary);border-radius:var(--ifm-global-radius);color:var(--ifm-color-black);font-size:.7rem;line-height:1.2;margin-left:.3rem;padding:.1rem .4rem}.tags_jXut{display:inline}.tag_QGVx{display:inline-block;margin:0 .4rem .5rem 0}.iconEdit_Z9Sw{margin-right:.3em;vertical-align:sub}.lastUpdated_JAkA{font-size:smaller;font-style:italic;margin-top:.2rem}.tocCollapsibleButton_TO0P{align-items:center;display:flex;font-size:inherit;justify-content:space-between;padding:.4rem .8rem;width:100%}.DocSearch-Button,.DocSearch-Button-Container{align-items:center;display:flex}.tocCollapsibleButton_TO0P:after{background:var(--ifm-menu-link-sublist-icon) 50% 50%/2rem 2rem no-repeat;content:"";filter:var(--ifm-menu-link-sublist-icon-filter);height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast);width:1.25rem}.tocCollapsibleButtonExpanded_MG3E:after,.tocCollapsibleExpanded_sAul{transform:none}.tocCollapsible_ETCw{background-color:var(--ifm-menu-color-background-active);border-radius:var(--ifm-global-radius);margin:1rem 0}.tocCollapsibleContent_vkbj>ul{border-left:none;border-top:1px solid var(--ifm-color-emphasis-300);font-size:15px;padding:.2rem 0}.tocCollapsibleContent_vkbj ul li{margin:.4rem .8rem}.tocCollapsibleContent_vkbj a{display:block}.tableOfContents_bqdL{max-height:calc(100vh - var(--ifm-navbar-height) - 2rem);overflow-y:auto;position:sticky;top:calc(var(--ifm-navbar-height) + 1rem)}.tableOfContentsInline_prmo ul{font-size:medium;list-style-type:disc;padding-top:0}.backToTopButton_sjWU{background-color:var(--ifm-color-emphasis-200);border-radius:50%;bottom:1.3rem;box-shadow:var(--ifm-global-shadow-lw);height:3rem;opacity:0;position:fixed;right:1.3rem;transform:scale(0);transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default);visibility:hidden;width:3rem;z-index:calc(var(--ifm-z-index-fixed) - 1)}.backToTopButton_sjWU:after{background-color:var(--ifm-color-emphasis-1000);content:" ";display:inline-block;height:100%;-webkit-mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;width:100%}.backToTopButtonShow_xfvO{opacity:1;transform:scale(1);visibility:visible}.DocSearch-Button{background:var(--docsearch-searchbox-background);border:0;border-radius:40px;color:var(--docsearch-muted-color);cursor:pointer;font-weight:500;height:36px;justify-content:space-between;padding:0 8px;-webkit-user-select:none;user-select:none}.DocSearch-Button:active,.DocSearch-Button:focus,.DocSearch-Button:hover{background:var(--docsearch-searchbox-focus-background);box-shadow:var(--docsearch-searchbox-shadow);color:var(--docsearch-text-color);outline:0}.DocSearch-Search-Icon{stroke-width:1.6}.DocSearch-Hit-Tree,.DocSearch-Hit-action,.DocSearch-Hit-icon,.DocSearch-Reset{stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Button .DocSearch-Search-Icon{color:var(--docsearch-text-color)}.DocSearch-Button-Placeholder{font-size:1rem;padding:0 12px 0 6px}.DocSearch-Button-Keys{display:flex;min-width:calc(40px + .8em)}.DocSearch-Button-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:3px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 2px;position:relative;top:-1px;width:20px}.DocSearch-Button-Key--pressed{box-shadow:var(--docsearch-key-pressed-shadow);transform:translate3d(0,1px,0)}.DocSearch--active{overflow:hidden!important}.DocSearch-Container{background-color:var(--docsearch-container-background);height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:200}.DocSearch-Hit[aria-selected=true] mark,.DocSearch-Prefill:focus,.DocSearch-Prefill:hover,.content_knG7 a{-webkit-text-decoration:underline;text-decoration:underline}.DocSearch-Link{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;font:inherit;margin:0;padding:0}.DocSearch-Modal{background:var(--docsearch-modal-background);border-radius:6px;box-shadow:var(--docsearch-modal-shadow);flex-direction:column;margin:60px auto auto;max-width:var(--docsearch-modal-width);position:relative}.DocSearch-SearchBar{display:flex;padding:var(--docsearch-spacing) var(--docsearch-spacing) 0}.DocSearch-Form{align-items:center;background:var(--docsearch-searchbox-focus-background);border-radius:4px;box-shadow:var(--docsearch-searchbox-shadow);display:flex;height:var(--docsearch-searchbox-height);margin:0;padding:0 var(--docsearch-spacing);position:relative;width:100%}.DocSearch-Input{appearance:none;background:#0000;border:0;color:var(--docsearch-text-color);flex:1;font:inherit;font-size:1.2em;height:100%;outline:0;padding:0 0 0 8px;width:80%}.DocSearch-Input::placeholder{color:var(--docsearch-muted-color);opacity:1}.DocSearch-Input::-webkit-search-cancel-button,.DocSearch-Input::-webkit-search-decoration,.DocSearch-Input::-webkit-search-results-button,.DocSearch-Input::-webkit-search-results-decoration{display:none}.DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset,.buttonContainer_ox5C .close{margin:0;padding:0}.DocSearch-Container--Stalled .DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}.DocSearch-Cancel,.DocSearch-Container--Stalled .DocSearch-MagnifierLabel,.DocSearch-LoadingIndicator,.DocSearch-Reset[hidden]{display:none}.DocSearch-Reset{animation:.1s ease-in forwards a;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;padding:2px;right:0}.DocSearch-Help,.DocSearch-HitsFooter,.DocSearch-Label{color:var(--docsearch-muted-color)}.DocSearch-Reset:hover{color:var(--docsearch-highlight-color)}.DocSearch-LoadingIndicator svg,.DocSearch-MagnifierLabel svg{height:24px;width:24px}.DocSearch-Dropdown{max-height:calc(var(--docsearch-modal-height) - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height));min-height:var(--docsearch-spacing);overflow-y:auto;overflow-y:overlay;padding:0 var(--docsearch-spacing);scrollbar-color:var(--docsearch-muted-color) var(--docsearch-modal-background);scrollbar-width:thin}.DocSearch-Dropdown::-webkit-scrollbar{width:12px}.DocSearch-Dropdown::-webkit-scrollbar-track{background:#0000}.DocSearch-Dropdown::-webkit-scrollbar-thumb{background-color:var(--docsearch-muted-color);border:3px solid var(--docsearch-modal-background);border-radius:20px}.DocSearch-Dropdown ul{list-style:none;margin:0;padding:0}.DocSearch-Label{font-size:.75em;line-height:1.6em}.DocSearch-Help{font-size:.9em;margin:0;-webkit-user-select:none;user-select:none}.DocSearch-Title{font-size:1.2em}.DocSearch-Logo a{display:flex}.DocSearch-Logo svg{color:var(--docsearch-logo-color);margin-left:8px}.DocSearch-Hits:last-of-type{margin-bottom:24px}.DocSearch-Hits mark{background:none;color:var(--docsearch-highlight-color)}.DocSearch-HitsFooter{display:flex;font-size:.85em;justify-content:center;margin-bottom:var(--docsearch-spacing);padding:var(--docsearch-spacing)}.DocSearch-HitsFooter a{border-bottom:1px solid;color:inherit}.DocSearch-Hit{border-radius:4px;display:flex;padding-bottom:4px;position:relative}.DocSearch-Hit--deleting{opacity:0;transition:.25s linear}.DocSearch-Hit--favoriting{transform:scale(0);transform-origin:top center;transition:.25s linear .25s}.DocSearch-Hit a{background:var(--docsearch-hit-background);border-radius:4px;box-shadow:var(--docsearch-hit-shadow);display:block;padding-left:var(--docsearch-spacing);width:100%}.DocSearch-Hit-source{background:var(--docsearch-modal-background);color:var(--docsearch-highlight-color);font-size:.85em;font-weight:600;line-height:32px;margin:0 -4px;padding:8px 4px 0;position:sticky;top:0;z-index:10}.DocSearch-Hit-Tree{color:var(--docsearch-muted-color);height:var(--docsearch-hit-height);opacity:.5;width:24px}.DocSearch-Hit[aria-selected=true] a{background-color:var(--docsearch-highlight-color)}.DocSearch-Hit-Container{align-items:center;color:var(--docsearch-hit-color);display:flex;flex-direction:row;height:var(--docsearch-hit-height);padding:0 var(--docsearch-spacing) 0 0}.DocSearch-Hit-icon{height:20px;width:20px}.DocSearch-Hit-action,.DocSearch-Hit-icon{color:var(--docsearch-muted-color)}.DocSearch-Hit-action{align-items:center;display:flex;height:22px;width:22px}.DocSearch-Hit-action svg{display:block;height:18px;width:18px}.DocSearch-Hit-action+.DocSearch-Hit-action{margin-left:6px}.DocSearch-Hit-action-button{appearance:none;background:none;border:0;border-radius:50%;color:inherit;cursor:pointer;padding:2px}#__docusaurus-base-url-issue-banner-container,.docSidebarContainer_YfHR,.navbarSearchContainer_Bca1:empty,.sidebarLogo_isFc,.themedComponent_mlkZ,[data-theme=dark] .lightToggleIcon_pyhR,[data-theme=light] .darkToggleIcon_wfgR,html[data-announcement-bar-initially-dismissed=true] .announcementBar_mb4j,svg.DocSearch-Hit-Select-Icon{display:none}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Select-Icon{display:block}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:background-color .1s ease-in}.DocSearch-Hit-action-button:focus path,.DocSearch-Hit-action-button:hover path{fill:#fff}.DocSearch-Hit-content-wrapper{display:flex;flex:1 1 auto;flex-direction:column;font-weight:500;justify-content:center;line-height:1.2em;margin:0 8px;overflow-x:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap;width:80%}.DocSearch-Hit-title{font-size:.9em}.DocSearch-Hit-path{color:var(--docsearch-muted-color);font-size:.75em}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Tree,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-action,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-icon,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-path,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-text,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-title,.DocSearch-Hit[aria-selected=true] mark{color:var(--docsearch-hit-active-color)!important}.DocSearch-ErrorScreen,.DocSearch-NoResults,.DocSearch-StartScreen{font-size:.9em;margin:0 auto;padding:36px 0;text-align:center;width:80%}.DocSearch-Screen-Icon{color:var(--docsearch-muted-color);padding-bottom:12px}.DocSearch-NoResults-Prefill-List{display:inline-block;padding-bottom:24px;text-align:left}.DocSearch-NoResults-Prefill-List ul{display:inline-block;padding:8px 0 0}.DocSearch-NoResults-Prefill-List li{list-style-position:inside;list-style-type:"» "}.DocSearch-Prefill{appearance:none;background:none;border:0;border-radius:1em;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;font-size:1em;font-weight:700;padding:0}.DocSearch-Prefill:focus,.DocSearch-Prefill:hover{outline:0}.DocSearch-Footer{align-items:center;background:var(--docsearch-footer-background);border-radius:0 0 8px 8px;box-shadow:var(--docsearch-footer-shadow);display:flex;flex-direction:row-reverse;flex-shrink:0;height:var(--docsearch-footer-height);justify-content:space-between;padding:0 var(--docsearch-spacing);position:relative;-webkit-user-select:none;user-select:none;width:100%;z-index:300}.DocSearch-Commands{color:var(--docsearch-muted-color);display:flex;list-style:none;margin:0;padding:0}.DocSearch-Commands li,.buttonContainer_ox5C{align-items:center;display:flex}.DocSearch-Commands li:not(:last-of-type){margin-right:.8em}.DocSearch-Commands-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:2px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 1px;width:20px}.DocSearch-VisuallyHiddenForAccessibility{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@keyframes a{0%{opacity:0}to{opacity:1}}.DocSearch-Button{margin:0;transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.DocSearch-Container{z-index:calc(var(--ifm-z-index-fixed) + 1)}.popup_wph0{align-items:center;bottom:16px;display:flex;justify-content:space-between;position:fixed;right:16px;width:344px;z-index:999}.skipToContent_fXgn{background-color:var(--ifm-background-surface-color);color:var(--ifm-color-emphasis-900);left:100%;padding:calc(var(--ifm-global-spacing)/2) var(--ifm-global-spacing);position:fixed;top:1rem;z-index:calc(var(--ifm-z-index-fixed) + 1)}.skipToContent_fXgn:focus{box-shadow:var(--ifm-global-shadow-md);left:1rem}.closeButton_CVFx{line-height:0;padding:0}.content_knG7{font-size:85%;padding:5px 0;text-align:center}.content_knG7 a{color:inherit}.announcementBar_mb4j{align-items:center;background-color:var(--ifm-color-white);border-bottom:1px solid var(--ifm-color-emphasis-100);color:var(--ifm-color-black);display:flex;height:var(--docusaurus-announcement-bar-height)}.announcementBarPlaceholder_vyr4{flex:0 0 10px}.announcementBarClose_gvF7{align-self:stretch;flex:0 0 30px}.toggle_vylO{height:2rem;width:2rem}.toggleButton_gllP{align-items:center;border-radius:50%;display:flex;height:100%;justify-content:center;transition:background var(--ifm-transition-fast);width:100%}.toggleButton_gllP:hover{background:var(--ifm-color-emphasis-200)}.toggleButtonDisabled_aARS{cursor:not-allowed}.darkNavbarColorModeToggle_X3D1:hover{background:var(--ifm-color-gray-800)}[data-theme=dark] .themedComponent--dark_xIcU,[data-theme=light] .themedComponent--light_NVdE,html:not([data-theme]) .themedComponent--light_NVdE{display:initial}[data-theme=dark]:root{--docusaurus-collapse-button-bg:#ffffff0d;--docusaurus-collapse-button-bg-hover:#ffffff1a}.collapseSidebarButton_PEFL{display:none;margin:0}.iconExternalLink_nPIU{margin-left:.3rem}.docMainContainer_TBSr,.docRoot_UBD9{display:flex;width:100%}.docsWrapper_hBAB{display:flex;flex:1 0 auto}.dropdownNavbarItemMobile_S0Fm{cursor:pointer}.iconLanguage_nlXk{margin-right:5px;vertical-align:text-bottom}.navbarHideable_m1mJ{transition:transform var(--ifm-transition-fast) ease}.navbarHidden_jGov{transform:translate3d(0,calc(-100% - 2px),0)}.errorBoundaryError_a6uf{color:red;white-space:pre-wrap}.errorBoundaryFallback_VBag{color:red;padding:.55rem}.buttonGroup__atx button,.codeBlockContainer_Ckt0{background:var(--prism-background-color);color:var(--prism-color)}.footerLogoLink_BH7S{opacity:.5;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.footerLogoLink_BH7S:hover,.hash-link:focus,:hover>.hash-link{opacity:1}body:not(.navigation-with-keyboard) :not(input):focus{outline:0}.anchorWithStickyNavbar_LWe7{scroll-margin-top:calc(var(--ifm-navbar-height) + .5rem)}.anchorWithHideOnScrollNavbar_WYt5{scroll-margin-top:.5rem}.hash-link{opacity:0;padding-left:.5rem;transition:opacity var(--ifm-transition-fast);-webkit-user-select:none;user-select:none}.hash-link:before{content:"#"}.mainWrapper_z2l0{display:flex;flex:1 0 auto;flex-direction:column}.docusaurus-mt-lg{margin-top:3rem}#__docusaurus{display:flex;flex-direction:column;min-height:100%}.codeBlockContainer_Ckt0{border-radius:var(--ifm-code-border-radius);box-shadow:var(--ifm-global-shadow-lw);margin-bottom:var(--ifm-leading)}.codeBlockContent_biex{border-radius:inherit;direction:ltr;position:relative}.codeBlockTitle_Ktv7{border-bottom:1px solid var(--ifm-color-emphasis-300);border-top-left-radius:inherit;border-top-right-radius:inherit;font-size:var(--ifm-code-font-size);font-weight:500;padding:.75rem var(--ifm-pre-padding)}.codeBlock_bY9V{--ifm-pre-background:var(--prism-background-color);margin:0;padding:0}.codeBlockTitle_Ktv7+.codeBlockContent_biex .codeBlock_bY9V{border-top-left-radius:0;border-top-right-radius:0}.codeBlockLines_e6Vv{float:left;font:inherit;min-width:100%;padding:var(--ifm-pre-padding)}.codeBlockLinesWithNumbering_o6Pm{display:table;padding:var(--ifm-pre-padding) 0}.buttonGroup__atx{column-gap:.2rem;display:flex;position:absolute;right:calc(var(--ifm-pre-padding)/2);top:calc(var(--ifm-pre-padding)/2)}.buttonGroup__atx button{align-items:center;border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-global-radius);display:flex;line-height:0;opacity:0;padding:.4rem;transition:opacity var(--ifm-transition-fast) ease-in-out}.buttonGroup__atx button:focus-visible,.buttonGroup__atx button:hover{opacity:1!important}.theme-code-block:hover .buttonGroup__atx button{opacity:.4}:where(:root){--docusaurus-highlighted-code-line-bg:#484d5b}:where([data-theme=dark]){--docusaurus-highlighted-code-line-bg:#646464}.theme-code-block-highlighted-line{background-color:var(--docusaurus-highlighted-code-line-bg);display:block;margin:0 calc(var(--ifm-pre-padding)*-1);padding:0 var(--ifm-pre-padding)}.codeLine_lJS_{counter-increment:a;display:table-row}.codeLineNumber_Tfdd{background:var(--ifm-pre-background);display:table-cell;left:0;overflow-wrap:normal;padding:0 var(--ifm-pre-padding);position:sticky;text-align:right;width:1%}.codeLineNumber_Tfdd:before{content:counter(a);opacity:.4}.codeLineContent_feaV{padding-right:var(--ifm-pre-padding)}.theme-code-block:hover .copyButtonCopied_obH4{opacity:1!important}.copyButtonIcons_eSgA{height:1.125rem;position:relative;width:1.125rem}.copyButtonIcon_y97N,.copyButtonSuccessIcon_LjdS{left:0;position:absolute;top:0;fill:currentColor;height:inherit;opacity:inherit;transition:all var(--ifm-transition-fast) ease;width:inherit}.copyButtonSuccessIcon_LjdS{color:#00d600;left:50%;opacity:0;top:50%;transform:translate(-50%,-50%) scale(.33)}.copyButtonCopied_obH4 .copyButtonIcon_y97N{opacity:0;transform:scale(.33)}.copyButtonCopied_obH4 .copyButtonSuccessIcon_LjdS{opacity:1;transform:translate(-50%,-50%) scale(1);transition-delay:75ms}.wordWrapButtonIcon_Bwma{height:1.2rem;width:1.2rem}.heroTitleTextHtml_zYwv b,.indexCtaTryNowButton_wlFR:hover,.wordWrapButtonEnabled_EoeP .wordWrapButtonIcon_Bwma{color:var(--ifm-color-primary)}.details_lb9f{--docusaurus-details-summary-arrow-size:0.38rem;--docusaurus-details-transition:transform 200ms ease;--docusaurus-details-decoration-color:grey}.details_lb9f>summary{cursor:pointer;list-style:none;padding-left:1rem;position:relative}.details_lb9f>summary::-webkit-details-marker{display:none}.details_lb9f>summary:before{border-color:#0000 #0000 #0000 var(--docusaurus-details-decoration-color);border-style:solid;border-width:var(--docusaurus-details-summary-arrow-size);content:"";left:0;position:absolute;top:.45rem;transform:rotate(0);transform-origin:calc(var(--docusaurus-details-summary-arrow-size)/2) 50%;transition:var(--docusaurus-details-transition)}.collapsibleContent_i85q{border-top:1px solid var(--docusaurus-details-decoration-color);margin-top:1rem;padding-top:1rem}.details_b_Ee{--docusaurus-details-decoration-color:var(--ifm-alert-border-color);--docusaurus-details-transition:transform var(--ifm-transition-fast) ease;border:1px solid var(--ifm-alert-border-color);margin:0 0 var(--ifm-spacing-vertical)}.containsTaskList_mC6p{list-style:none}.img_ev3q{height:auto}.admonition_xJq3{margin-bottom:1em}.admonitionHeading_Gvgb{font:var(--ifm-heading-font-weight) var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family)}.admonitionHeading_Gvgb:not(:last-child){margin-bottom:.3rem}.admonitionHeading_Gvgb code{text-transform:none}.admonitionIcon_Rf37{display:inline-block;margin-right:.4em;vertical-align:middle}.admonitionIcon_Rf37 svg{display:inline-block;height:1.6em;width:1.6em;fill:var(--ifm-alert-foreground-color)}.breadcrumbHomeIcon_YNFT{height:1.1rem;position:relative;top:1px;vertical-align:top;width:1.1rem}.breadcrumbsContainer_Z_bl{--ifm-breadcrumb-size-multiplier:0.8;margin-bottom:.8rem}.searchQueryInput_u2C7,.searchVersionInput_m0Ui{background:var(--docsearch-searchbox-focus-background);border:2px solid var(--ifm-toc-border-color);border-radius:var(--ifm-global-radius);color:var(--docsearch-text-color);font:var(--ifm-font-size-base) var(--ifm-font-family-base);margin-bottom:.5rem;padding:.8rem;transition:border var(--ifm-transition-fast) ease;width:100%}.indexCtaTryNowButton_wlFR,.indexCtasGetStartedButton_UQaK{line-height:1.2em;text-transform:uppercase;transition:background .3s,color .3s}.searchQueryInput_u2C7:focus,.searchVersionInput_m0Ui:focus{border-color:var(--docsearch-primary-color);outline:0}.searchQueryInput_u2C7::placeholder{color:var(--docsearch-muted-color)}.searchResultsColumn_JPFH{font-size:.9rem;font-weight:700}.algoliaLogo_rT1R{max-width:150px}.algoliaLogoPathFill_WdUC{fill:var(--ifm-font-color-base)}.searchResultItem_Tv2o{border-bottom:1px solid var(--ifm-toc-border-color);padding:1rem 0}.searchResultItemHeading_KbCB{font-weight:400;margin-bottom:0}.searchResultItemPath_lhe1{color:var(--ifm-color-content-secondary);font-size:.8rem;--ifm-breadcrumb-separator-size-multiplier:1}.searchResultItemSummary_AEaO{font-style:italic;margin:.5rem 0 0}.loadingSpinner_XVxU{animation:1s linear infinite b;border:.4em solid #eee;border-radius:50%;border-top:.4em solid var(--ifm-color-primary);height:3rem;margin:0 auto;width:3rem}@keyframes b{to{transform:rotate(1turn)}}.loader_vvXV{margin-top:2rem}.search-result-match{background:#ffd78e40;color:var(--docsearch-hit-color);padding:.09em 0}.section_rC2D{padding:72px 0}.sectionAlt_XiGz{background-color:var(--ifm-color-emphasis-100)}.sectionInner_Y4r1{margin:0 auto}.featureImage_yA8i{margin:0 auto;max-height:128px;max-width:60%}.featureHeading_TLGJ{font-size:var(--ifm-h3-font-size);padding-top:1rem}.announcement_FsS0{font-size:24px;font-weight:700;margin:0 auto;padding:48px;text-align:center}.announcementDark_tzC4{background-color:#20232a;color:#fff}.announcementInner_RsrQ{margin:0 auto;max-width:768px}.hero_syme{background-color:#2b3137;padding:48px}.heroInner_VWeJ{margin:0 auto;max-width:1100px;padding:0 20px}.heroProjectTagline_EkV5{color:#fff;font-size:60px;margin:0}@keyframes c{0%{opacity:0;transform:scale(.1) rotate(30deg);transform-origin:center bottom}50%{transform:rotate(-10deg)}70%{transform:rotate(3deg)}to{opacity:1;transform:scale(1)}}.heroLogo_jM6J{animation-duration:2s;animation-name:c;float:right;height:160px;margin-top:20px;padding:0 20px 20px;width:180px}.indexCtas_hUA_{align-items:center;display:flex;margin-top:24px}.indexCtasGetStartedButton_UQaK{border:2px solid var(--ifm-color-primary);border-radius:8px;color:#fff;font-size:24px;font-weight:700;padding:18px 36px;-webkit-text-decoration:none!important;text-decoration:none!important}.indexCtasGitHubButtonWrapper_AOht{display:flex;margin-left:20px}.indexCtasGitHubButton_sMIS{border:none;overflow:hidden}.indexCtaTryNowButton_wlFR{color:#fff;font-size:14px;font-weight:700;margin:0 36px;-webkit-text-decoration:underline;text-decoration:underline}@media (min-width:997px){.collapseSidebarButton_PEFL,.expandButton_TmdG{background-color:var(--docusaurus-collapse-button-bg)}.lastUpdated_JAkA{text-align:right}.tocMobile_ITEo{display:none}:root{--docusaurus-announcement-bar-height:30px}.announcementBarClose_gvF7,.announcementBarPlaceholder_vyr4{flex-basis:50px}.collapseSidebarButton_PEFL{border:1px solid var(--ifm-toc-border-color);border-radius:0;bottom:0;display:block!important;height:40px;position:sticky}.collapseSidebarButtonIcon_kv0_{margin-top:4px;transform:rotate(180deg)}.expandButtonIcon_i1dp,[dir=rtl] .collapseSidebarButtonIcon_kv0_{transform:rotate(0)}.collapseSidebarButton_PEFL:focus,.collapseSidebarButton_PEFL:hover,.expandButton_TmdG:focus,.expandButton_TmdG:hover{background-color:var(--docusaurus-collapse-button-bg-hover)}.menuHtmlItem_M9Kj{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu_SIkG{flex-grow:1;padding:.5rem}@supports (scrollbar-gutter:stable){.menu_SIkG{padding:.5rem 0 .5rem .5rem;scrollbar-gutter:stable}}.menuWithAnnouncementBar_GW3s{margin-bottom:var(--docusaurus-announcement-bar-height)}.sidebar_njMd{display:flex;flex-direction:column;height:100%;padding-top:var(--ifm-navbar-height);width:var(--doc-sidebar-width)}.sidebarWithHideableNavbar_wUlq{padding-top:0}.sidebarHidden_VK0M{opacity:0;visibility:hidden}.sidebarLogo_isFc{align-items:center;color:inherit!important;display:flex!important;margin:0 var(--ifm-navbar-padding-horizontal);max-height:var(--ifm-navbar-height);min-height:var(--ifm-navbar-height);-webkit-text-decoration:none!important;text-decoration:none!important}.sidebarLogo_isFc img{height:2rem;margin-right:.5rem}.expandButton_TmdG{align-items:center;display:flex;height:100%;justify-content:center;position:absolute;right:0;top:0;transition:background-color var(--ifm-transition-fast) ease;width:100%}[dir=rtl] .expandButtonIcon_i1dp{transform:rotate(180deg)}.docSidebarContainer_YfHR{border-right:1px solid var(--ifm-toc-border-color);clip-path:inset(0);display:block;margin-top:calc(var(--ifm-navbar-height)*-1);transition:width var(--ifm-transition-fast) ease;width:var(--doc-sidebar-width);will-change:width}.docSidebarContainerHidden_DPk8{cursor:pointer;width:var(--doc-sidebar-hidden-width)}.sidebarViewport_aRkj{height:100%;max-height:100vh;position:sticky;top:0}.docMainContainer_TBSr{flex-grow:1;max-width:calc(100% - var(--doc-sidebar-width))}.docMainContainerEnhanced_lQrH{max-width:calc(100% - var(--doc-sidebar-hidden-width))}.docItemWrapperEnhanced_JWYK{max-width:calc(var(--ifm-container-width) + var(--doc-sidebar-width))!important}.navbarSearchContainer_Bca1{padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.docItemCol_VOVn{max-width:75%!important}}@media (min-width:1440px){.container{max-width:var(--ifm-container-width-xl)}}@media (max-width:996px){.col{--ifm-col-width:100%;flex-basis:var(--ifm-col-width);margin-left:0}.footer{--ifm-footer-padding-horizontal:0}.colorModeToggle_DEke,.footer__link-separator,.navbar__item,.tableOfContents_bqdL{display:none}.footer__col{margin-bottom:calc(var(--ifm-spacing-vertical)*3)}.footer__link-item{display:block;width:max-content}.hero{padding-left:0;padding-right:0}.navbar>.container,.navbar>.container-fluid{padding:0}.navbar__toggle{display:inherit}.navbar__search-input{width:9rem}.pills--block,.tabs--block{flex-direction:column}.docItemContainer_F8PC{padding:0 .3rem}.navbarSearchContainer_Bca1{position:absolute;right:var(--ifm-navbar-padding-horizontal)}}@media only screen and (max-width:996px){.searchQueryColumn_RTkw,.searchResultsColumn_JPFH{max-width:60%!important}.searchLogoColumn_rJIA,.searchVersionColumn_ypXd{max-width:40%!important}.searchLogoColumn_rJIA{padding-left:0!important}}@media (max-width:768px){.DocSearch-Button-Keys,.DocSearch-Button-Placeholder,.DocSearch-Commands,.DocSearch-Hit-Tree{display:none}:root{--docsearch-spacing:10px;--docsearch-footer-height:40px}.DocSearch-Dropdown{height:100%;max-height:calc(var(--docsearch-vh,1vh)*100 - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height))}.DocSearch-Container{height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);position:absolute}.DocSearch-Footer{border-radius:0;bottom:0;position:absolute}.DocSearch-Hit-content-wrapper{display:flex;position:relative;width:80%}.DocSearch-Modal{border-radius:0;box-shadow:none;height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);margin:0;max-width:100%;width:100%}.DocSearch-Cancel{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;flex:none;font:inherit;font-size:1em;font-weight:500;margin-left:var(--docsearch-spacing);outline:0;overflow:hidden;padding:0;-webkit-user-select:none;user-select:none;white-space:nowrap}}@media only screen and (max-width:768px){.hero_syme{padding-left:20px;padding-right:20px}.heroInner_VWeJ{padding:0}.heroProjectTagline_EkV5{font-size:36px;text-align:center}.heroLogo_jM6J{display:block;float:none;margin:0 auto}.indexCtas_hUA_{justify-content:center}.indexCtasGitHubButton_sMIS{display:none}}@media (max-width:576px){.markdown h1:first-child{--ifm-h1-font-size:2rem}.markdown>h2{--ifm-h2-font-size:1.5rem}.markdown>h3{--ifm-h3-font-size:1.25rem}}@media screen and (max-width:576px){.searchQueryColumn_RTkw{max-width:100%!important}.searchVersionColumn_ypXd{max-width:100%!important;padding-left:var(--ifm-spacing-horizontal)!important}}@media screen and (max-width:500px){.popup_wph0{bottom:0;right:0;width:100%}}@media (hover:hover){.backToTopButton_sjWU:hover{background-color:var(--ifm-color-emphasis-300)}}@media (pointer:fine){.thin-scrollbar{scrollbar-width:thin}.thin-scrollbar::-webkit-scrollbar{height:var(--ifm-scrollbar-size);width:var(--ifm-scrollbar-size)}.thin-scrollbar::-webkit-scrollbar-track{background:var(--ifm-scrollbar-track-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb{background:var(--ifm-scrollbar-thumb-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb:hover{background:var(--ifm-scrollbar-thumb-hover-background-color)}}@media (prefers-reduced-motion:reduce){:root{--ifm-transition-fast:0ms;--ifm-transition-slow:0ms}}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Reset{animation:none;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;right:0;stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Hit--deleting,.DocSearch-Hit--favoriting{transition:none}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:#0003;transition:none}}@media print{.announcementBar_mb4j,.footer,.menu,.navbar,.pagination-nav,.table-of-contents,.tocMobile_ITEo{display:none}.tabs{page-break-inside:avoid}.codeBlockLines_e6Vv{white-space:pre-wrap}} \ No newline at end of file diff --git a/assets/js/029bedf1.5c086163.js b/assets/js/029bedf1.5c086163.js new file mode 100644 index 0000000000..fc61b880be --- /dev/null +++ b/assets/js/029bedf1.5c086163.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1180],{1152:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-11.1/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/11.1/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/using-with-babel.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/11.1/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/11.1/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const r={id:"using-with-babel",title:"Using with Babel"},l=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>r,x:()=>l});var t=n(6540);const i={},o=t.createContext(i);function r(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function l(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/029bedf1.b7009fd1.js b/assets/js/029bedf1.b7009fd1.js deleted file mode 100644 index 5750c13036..0000000000 --- a/assets/js/029bedf1.b7009fd1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1180],{4908:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-11.1/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/11.1/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/using-with-babel.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/11.1/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/11.1/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const l={id:"using-with-babel",title:"Using with Babel"},r=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>l,x:()=>r});var t=n(6540);const i={},o=t.createContext(i);function l(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function r(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/02a1e558.3695ef1c.js b/assets/js/02a1e558.3695ef1c.js new file mode 100644 index 0000000000..be0a98d2cb --- /dev/null +++ b/assets/js/02a1e558.3695ef1c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4026],{3937:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-8.x/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/8.x/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/getting-started/installation.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/8.x/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/8.x/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/02a1e558.7d8be562.js b/assets/js/02a1e558.7d8be562.js deleted file mode 100644 index ac552cbb80..0000000000 --- a/assets/js/02a1e558.7d8be562.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4026],{4288:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-8.x/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/8.x/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/getting-started/installation.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/8.x/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/8.x/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/03be7dae.946b6548.js b/assets/js/03be7dae.946b6548.js deleted file mode 100644 index bab9cc0092..0000000000 --- a/assets/js/03be7dae.946b6548.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4768],{2699:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/docs/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/next/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/troubleshooting.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/next/guides/absolute-imports"}}');var r=t(4848),a=t(8453),o=t(9489),i=t(7227);const l={id:"troubleshooting",title:"Troubleshooting"},c=void 0,d={},u=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when ChangeDetectionStrategy.OnPush is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (node_modules package within another package node_nodules)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function p(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:["You can check Jest ",(0,r.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,r.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,r.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,r.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,r.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,r.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,r.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,r.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title="tsconfig.spec.json"',children:'{\n "compilerOptions": {\n "emitDecoratorMetadata": true\n }\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["In general, this is related to ",(0,r.jsx)(n.code,{children:"Angular"}),"'s reflection and also depends on a reflection library, as e. g. included in ",(0,r.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy ",(0,r.jsx)(n.code,{children:"Angular"}),"'s current requirements, but in case these change, you can install ",(0,r.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import 'core-js/es/reflect';\nimport 'core-js/proposals/reflect-metadata';\n"})}),"\n",(0,r.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,r.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,r.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,r.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,r.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,r.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="some.component.spec.ts"',children:"beforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,r.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,r.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,r.jsx)(n.p,{children:"Add this to your global mock file"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,r.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,r.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,r.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,r.jsx)(n.code,{children:"JS"})," file with ",(0,r.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"({\"Object.\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,r.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,r.jsx)(n.code,{children:"@angular"}),", ",(0,r.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,r.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,r.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,r.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,r.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,r.jsx)(n.p,{children:"or"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,r.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,r.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,r.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,r.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Install ",(0,r.jsx)(n.code,{children:"babel-jest"}),", ",(0,r.jsx)(n.code,{children:"@babel/core"})," and ",(0,r.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,r.jsxs)(n.li,{children:["Create a ",(0,r.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,r.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title=".babelrc"',children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Define the usage of ",(0,r.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,r.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,r.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,r.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,r.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,r.jsx)(n.code,{children:"firebase"})," and ",(0,r.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,r.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,r.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,r.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,r.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,r.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,r.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,r.jsxs)(n.p,{children:["In these cases, a ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,r.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,r.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,r.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.resolver.ts"',children:"import type { SyncResolver } from 'jest-resolve';\n\nconst myResolver: SyncResolver = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n\nexport = myResolver;\n"})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '/src/jest.resolver.ts',\n //...\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '/src/jest.resolver.js',\n //...\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,r.jsxs)(n.p,{children:["Please use Angular ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),a=t(4245),o=t(6347),i=t(6494),l=t(2814),c=t(5167),d=t(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function h(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function g(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!h({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,u]=m({queryString:t,groupId:r}),[g,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),f(e)}),[u,f,a]),tabValues:a}}var f=t(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=t(4848);function x(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>l.push(e),onKeyDown:u,onClick:d,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...n,...e}),(0,b.jsx)(v,{...n,...e})]})}function w(e){const n=(0,f.A)();return(0,b.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/03be7dae.e6cf5ed1.js b/assets/js/03be7dae.e6cf5ed1.js new file mode 100644 index 0000000000..98f293cc3c --- /dev/null +++ b/assets/js/03be7dae.e6cf5ed1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4768],{2152:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/docs/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/next/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/troubleshooting.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/next/guides/absolute-imports"}}');var r=t(4848),a=t(8453),o=t(1470),i=t(9365);const l={id:"troubleshooting",title:"Troubleshooting"},c=void 0,d={},u=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when ChangeDetectionStrategy.OnPush is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (node_modules package within another package node_nodules)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function h(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:["You can check Jest ",(0,r.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,r.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,r.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,r.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,r.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,r.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,r.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,r.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title="tsconfig.spec.json"',children:'{\n "compilerOptions": {\n "emitDecoratorMetadata": true\n }\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["In general, this is related to ",(0,r.jsx)(n.code,{children:"Angular"}),"'s reflection and also depends on a reflection library, as e. g. included in ",(0,r.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy ",(0,r.jsx)(n.code,{children:"Angular"}),"'s current requirements, but in case these change, you can install ",(0,r.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import 'core-js/es/reflect';\nimport 'core-js/proposals/reflect-metadata';\n"})}),"\n",(0,r.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,r.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,r.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,r.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,r.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,r.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="some.component.spec.ts"',children:"beforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,r.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,r.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,r.jsx)(n.p,{children:"Add this to your global mock file"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,r.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,r.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,r.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,r.jsx)(n.code,{children:"JS"})," file with ",(0,r.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"({\"Object.\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,r.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,r.jsx)(n.code,{children:"@angular"}),", ",(0,r.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,r.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,r.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,r.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,r.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,r.jsx)(n.p,{children:"or"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,r.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,r.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,r.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,r.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Install ",(0,r.jsx)(n.code,{children:"babel-jest"}),", ",(0,r.jsx)(n.code,{children:"@babel/core"})," and ",(0,r.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,r.jsxs)(n.li,{children:["Create a ",(0,r.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,r.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title=".babelrc"',children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Define the usage of ",(0,r.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,r.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,r.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,r.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,r.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,r.jsx)(n.code,{children:"firebase"})," and ",(0,r.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,r.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,r.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,r.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,r.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,r.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,r.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,r.jsxs)(n.p,{children:["In these cases, a ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,r.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,r.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,r.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.resolver.ts"',children:"import type { SyncResolver } from 'jest-resolve';\n\nconst myResolver: SyncResolver = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n\nexport = myResolver;\n"})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '/src/jest.resolver.ts',\n //...\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '/src/jest.resolver.js',\n //...\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,r.jsxs)(n.p,{children:["Please use Angular ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function p(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},9365:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),a=t(3104),o=t(6347),i=t(205),l=t(7485),c=t(1682),d=t(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function g(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=h(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,u]=m({queryString:t,groupId:r}),[g,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??g;return p({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),f(e)}),[u,f,a]),tabValues:a}}var f=t(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=t(4848);function x(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...n,...e}),(0,b.jsx)(v,{...n,...e})]})}function w(e){const n=(0,f.A)();return(0,b.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/04ae74d1.415e8c45.js b/assets/js/04ae74d1.415e8c45.js new file mode 100644 index 0000000000..f2ae3437ba --- /dev/null +++ b/assets/js/04ae74d1.415e8c45.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8889],{8533:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-12.0/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/12.0/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/getting-started/presets.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/12.0/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/12.0/getting-started/options"}}');var r=s(4848),a=s(8453),o=s(1470),l=s(9365);const i={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.ts\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n globals: {\n 'ts-jest': {\n ...presets.defaults.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},1470:(e,t,s)=>{s.d(t,{A:()=>w});var n=s(6540),r=s(4164),a=s(3104),o=s(6347),l=s(205),i=s(7485),c=s(1682),u=s(679);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function g(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,i.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,i]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[c,d]=g({queryString:s,groupId:r}),[f,j]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),m=(()=>{const e=c??f;return h({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{m&&i(m)}),[m]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(2303);const m={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=s(4848);function x(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,s=i.indexOf(t),r=l[s].value;r!==n&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;t=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;t=i[s]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:l.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",m.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",m.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,j.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>l});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/04ae74d1.50384eca.js b/assets/js/04ae74d1.50384eca.js deleted file mode 100644 index 93c326ecf0..0000000000 --- a/assets/js/04ae74d1.50384eca.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8889],{564:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-12.0/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/12.0/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/getting-started/presets.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/12.0/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/12.0/getting-started/options"}}');var r=s(4848),a=s(8453),o=s(9489),l=s(7227);const i={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.ts\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n globals: {\n 'ts-jest': {\n ...presets.defaults.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},9489:(e,t,s)=>{s.d(t,{A:()=>w});var n=s(6540),r=s(4164),a=s(4245),o=s(6347),l=s(6494),i=s(2814),c=s(5167),u=s(9900);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function g(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,i.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,i]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[c,d]=g({queryString:s,groupId:r}),[f,j]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),m=(()=>{const e=c??f;return h({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{m&&i(m)}),[m]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(1062);const m={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=s(4848);function x(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,s=i.indexOf(t),r=l[s].value;r!==n&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;t=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;t=i[s]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:l.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",m.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",m.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,j.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>l});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/fa9f2ace.5b075c64.js b/assets/js/04b3fc6c.0ae6bbb7.js similarity index 86% rename from assets/js/fa9f2ace.5b075c64.js rename to assets/js/04b3fc6c.0ae6bbb7.js index 2e6a0f1677..d0c8c1bf7e 100644 --- a/assets/js/fa9f2ace.5b075c64.js +++ b/assets/js/04b3fc6c.0ae6bbb7.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[742],{800:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-11.0/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/11.0/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/getting-started/presets.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/11.0/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/11.0/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},l=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function c(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:["Or through TypeScript (if ",(0,r.jsx)(t.code,{children:"ts-node"})," is installed):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// jest.config.ts\nimport type { InitialOptionsTsJest } from 'ts-jest/dist/types';\nimport { defaults as jestNgPreset } from 'jest-preset-angular/presets';\n// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'\n\nconst config: InitialOptionsTsJest = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default config;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8582],{7334:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-10.x/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/10.x/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/getting-started/presets.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/10.x/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/10.x/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},l=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function c(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:["Or through TypeScript (if ",(0,r.jsx)(t.code,{children:"ts-node"})," is installed):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// jest.config.ts\nimport type { InitialOptionsTsJest } from 'ts-jest/dist/types';\nimport { defaults as jestNgPreset } from 'jest-preset-angular/presets';\n// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'\n\nconst config: InitialOptionsTsJest = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default config;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/04b3fc6c.268ff951.js b/assets/js/04b3fc6c.268ff951.js deleted file mode 100644 index ddae103561..0000000000 --- a/assets/js/04b3fc6c.268ff951.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8582],{8243:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-10.x/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/10.x/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/getting-started/presets.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/10.x/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/10.x/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},l=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function c(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:["Or through TypeScript (if ",(0,r.jsx)(t.code,{children:"ts-node"})," is installed):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// jest.config.ts\nimport type { InitialOptionsTsJest } from 'ts-jest/dist/types';\nimport { defaults as jestNgPreset } from 'jest-preset-angular/presets';\n// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'\n\nconst config: InitialOptionsTsJest = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default config;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/05916282.32c64332.js b/assets/js/05916282.32c64332.js deleted file mode 100644 index 2dbbd3eb74..0000000000 --- a/assets/js/05916282.32c64332.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2502],{6861:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-14.0/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/14.0/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/absolute-imports.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.0/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/14.0/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/05916282.a686b861.js b/assets/js/05916282.a686b861.js new file mode 100644 index 0000000000..5d3785572a --- /dev/null +++ b/assets/js/05916282.a686b861.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2502],{9387:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-14.0/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/14.0/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/absolute-imports.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.0/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/14.0/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/08804573.542b86a7.js b/assets/js/08804573.542b86a7.js new file mode 100644 index 0000000000..568df824fc --- /dev/null +++ b/assets/js/08804573.542b86a7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[108],{175:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-14.3/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/14.3/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/troubleshooting.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.3/guides/absolute-imports"}}');var r=t(4848),a=t(8453),o=t(1470),i=t(9365);const l={id:"troubleshooting",title:"Troubleshooting"},c=void 0,d={},u=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when ChangeDetectionStrategy.OnPush is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (node_modules package within another package node_nodules)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function h(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:["You can check Jest ",(0,r.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,r.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,r.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,r.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,r.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,r.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,r.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,r.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title="tsconfig.spec.json"',children:'{\n "compilerOptions": {\n "emitDecoratorMetadata": true\n }\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["In general, this is related to ",(0,r.jsx)(n.code,{children:"Angular"}),"'s reflection and also depends on a reflection library, as e. g. included in ",(0,r.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy ",(0,r.jsx)(n.code,{children:"Angular"}),"'s current requirements, but in case these change, you can install ",(0,r.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import 'core-js/es/reflect';\nimport 'core-js/proposals/reflect-metadata';\n"})}),"\n",(0,r.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,r.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,r.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,r.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,r.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,r.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="some.component.spec.ts"',children:"beforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,r.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,r.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,r.jsx)(n.p,{children:"Add this to your global mock file"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,r.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,r.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,r.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,r.jsx)(n.code,{children:"JS"})," file with ",(0,r.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"({\"Object.\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,r.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,r.jsx)(n.code,{children:"@angular"}),", ",(0,r.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,r.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,r.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,r.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,r.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,r.jsx)(n.p,{children:"or"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,r.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,r.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,r.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,r.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Install ",(0,r.jsx)(n.code,{children:"babel-jest"}),", ",(0,r.jsx)(n.code,{children:"@babel/core"})," and ",(0,r.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,r.jsxs)(n.li,{children:["Create a ",(0,r.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,r.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title=".babelrc"',children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Define the usage of ",(0,r.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,r.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,r.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,r.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,r.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,r.jsx)(n.code,{children:"firebase"})," and ",(0,r.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,r.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,r.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,r.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,r.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,r.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,r.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,r.jsxs)(n.p,{children:["In these cases, a ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,r.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,r.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,r.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.resolver.ts"',children:"import type { SyncResolver } from 'jest-resolve';\n\nconst myResolver: SyncResolver = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n\nexport = myResolver;\n"})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '/src/jest.resolver.ts',\n //...\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '/src/jest.resolver.js',\n //...\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,r.jsxs)(n.p,{children:["Please use Angular ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function p(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},9365:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),a=t(3104),o=t(6347),i=t(205),l=t(7485),c=t(1682),d=t(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function g(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=h(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,u]=m({queryString:t,groupId:r}),[g,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??g;return p({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),f(e)}),[u,f,a]),tabValues:a}}var f=t(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=t(4848);function x(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...n,...e}),(0,b.jsx)(v,{...n,...e})]})}function w(e){const n=(0,f.A)();return(0,b.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/08804573.b158604d.js b/assets/js/08804573.b158604d.js deleted file mode 100644 index b8a2783f2d..0000000000 --- a/assets/js/08804573.b158604d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[108],{7234:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-14.3/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/14.3/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/troubleshooting.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.3/guides/absolute-imports"}}');var r=t(4848),a=t(8453),o=t(9489),i=t(7227);const l={id:"troubleshooting",title:"Troubleshooting"},c=void 0,d={},u=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when ChangeDetectionStrategy.OnPush is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (node_modules package within another package node_nodules)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function p(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:["You can check Jest ",(0,r.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,r.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,r.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,r.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,r.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,r.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,r.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,r.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title="tsconfig.spec.json"',children:'{\n "compilerOptions": {\n "emitDecoratorMetadata": true\n }\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["In general, this is related to ",(0,r.jsx)(n.code,{children:"Angular"}),"'s reflection and also depends on a reflection library, as e. g. included in ",(0,r.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy ",(0,r.jsx)(n.code,{children:"Angular"}),"'s current requirements, but in case these change, you can install ",(0,r.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import 'core-js/es/reflect';\nimport 'core-js/proposals/reflect-metadata';\n"})}),"\n",(0,r.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,r.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,r.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,r.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,r.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,r.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="some.component.spec.ts"',children:"beforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,r.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,r.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,r.jsx)(n.p,{children:"Add this to your global mock file"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,r.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,r.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,r.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,r.jsx)(n.code,{children:"JS"})," file with ",(0,r.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"({\"Object.\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,r.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,r.jsx)(n.code,{children:"@angular"}),", ",(0,r.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,r.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,r.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,r.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,r.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,r.jsx)(n.p,{children:"or"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,r.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,r.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,r.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,r.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Install ",(0,r.jsx)(n.code,{children:"babel-jest"}),", ",(0,r.jsx)(n.code,{children:"@babel/core"})," and ",(0,r.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,r.jsxs)(n.li,{children:["Create a ",(0,r.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,r.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title=".babelrc"',children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Define the usage of ",(0,r.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,r.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,r.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,r.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,r.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,r.jsx)(n.code,{children:"firebase"})," and ",(0,r.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,r.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,r.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,r.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,r.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,r.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,r.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,r.jsxs)(n.p,{children:["In these cases, a ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,r.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,r.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,r.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.resolver.ts"',children:"import type { SyncResolver } from 'jest-resolve';\n\nconst myResolver: SyncResolver = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n\nexport = myResolver;\n"})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '/src/jest.resolver.ts',\n //...\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '/src/jest.resolver.js',\n //...\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,r.jsxs)(n.p,{children:["Please use Angular ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),a=t(4245),o=t(6347),i=t(6494),l=t(2814),c=t(5167),d=t(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function h(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function g(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!h({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,u]=m({queryString:t,groupId:r}),[g,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),f(e)}),[u,f,a]),tabValues:a}}var f=t(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=t(4848);function x(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>l.push(e),onKeyDown:u,onClick:d,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...n,...e}),(0,b.jsx)(v,{...n,...e})]})}function w(e){const n=(0,f.A)();return(0,b.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/097bb47a.391c0328.js b/assets/js/097bb47a.391c0328.js deleted file mode 100644 index 6cb240e514..0000000000 --- a/assets/js/097bb47a.391c0328.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3803],{5301:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-14.3/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/14.3/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/processing.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/14.3/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.3/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/097bb47a.e3aa4bf2.js b/assets/js/097bb47a.e3aa4bf2.js new file mode 100644 index 0000000000..a3b2717f8d --- /dev/null +++ b/assets/js/097bb47a.e3aa4bf2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3803],{1928:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-14.3/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/14.3/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/processing.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/14.3/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.3/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/09df063d.e4ecd33e.js b/assets/js/09df063d.e4ecd33e.js new file mode 100644 index 0000000000..26815a74d7 --- /dev/null +++ b/assets/js/09df063d.e4ecd33e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5027],{7646:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-14.4/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/getting-started/installation.md","tags":[],"version":"14.4","lastUpdatedBy":"ahnpnl","lastUpdatedAt":1734689944000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),i=n(9365);const o={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(i.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsx)(t.p,{children:"In your project root, create a setup file with following contents:"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(t.p,{children:"Add the following section to your root Jest config"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label":"TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label":"TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"tsconfig-cjs",label:"Tsconfig CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json5",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig CJS"}',children:"{\n //...\n extends: './tsconfig.json',\n compilerOptions: {\n //...\n module: 'CommonJS',\n types: ['jest'],\n },\n include: ['src/**/*.spec.ts', 'src/**/*.d.ts'],\n //...\n}\n"})})}),(0,r.jsx)(i.A,{value:"tsconfig-esm",label:"Tsconfig ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig ESM"}',children:'{\n //...\n "extends": "./tsconfig.json",\n "compilerOptions": {\n //...\n "module": "ES2022",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n //...\n}\n'})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="package.json"',children:'{\n //...\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n //...\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document, 'doctype', {\n value: '',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),i=n(205),o=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[g,j]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&o(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{o.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function S(e){const t=(0,j.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/09df063d.f8f4a530.js b/assets/js/09df063d.f8f4a530.js deleted file mode 100644 index b49b811104..0000000000 --- a/assets/js/09df063d.f8f4a530.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5027],{450:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-14.4/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/getting-started/installation.md","tags":[],"version":"14.4","lastUpdatedBy":"ahnpnl","lastUpdatedAt":1734689944000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),i=n(7227);const o={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(i.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsx)(t.p,{children:"In your project root, create a setup file with following contents:"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(t.p,{children:"Add the following section to your root Jest config"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label":"TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label":"TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"tsconfig-cjs",label:"Tsconfig CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json5",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig CJS"}',children:"{\n //...\n extends: './tsconfig.json',\n compilerOptions: {\n //...\n module: 'CommonJS',\n types: ['jest'],\n },\n include: ['src/**/*.spec.ts', 'src/**/*.d.ts'],\n //...\n}\n"})})}),(0,r.jsx)(i.A,{value:"tsconfig-esm",label:"Tsconfig ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig ESM"}',children:'{\n //...\n "extends": "./tsconfig.json",\n "compilerOptions": {\n //...\n "module": "ES2022",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n //...\n}\n'})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="package.json"',children:'{\n //...\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n //...\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document, 'doctype', {\n value: '',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),i=n(6494),o=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[g,j]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&o(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>o.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function S(e){const t=(0,j.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/0d71a3f1.bb603643.js b/assets/js/0d71a3f1.bb603643.js new file mode 100644 index 0000000000..2c0a318422 --- /dev/null +++ b/assets/js/0d71a3f1.bb603643.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3316],{3961:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-9.x/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/9.x/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/getting-started/test-environment.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/9.x/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/9.x/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,c={},d=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/0d71a3f1.c30ddbf7.js b/assets/js/0d71a3f1.c30ddbf7.js deleted file mode 100644 index 8447b7aca9..0000000000 --- a/assets/js/0d71a3f1.c30ddbf7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3316],{4912:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-9.x/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/9.x/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/getting-started/test-environment.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/9.x/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/9.x/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,d={},c=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/0dc350cc.701cfe13.js b/assets/js/0dc350cc.701cfe13.js new file mode 100644 index 0000000000..9ba41d84a3 --- /dev/null +++ b/assets/js/0dc350cc.701cfe13.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9800],{2869:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-14.0/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/14.0/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/jsdom-version.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.0/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.0/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/0dc350cc.e5f566a7.js b/assets/js/0dc350cc.e5f566a7.js deleted file mode 100644 index 4b858998ba..0000000000 --- a/assets/js/0dc350cc.e5f566a7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9800],{8134:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-14.0/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/14.0/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/jsdom-version.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.0/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.0/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/0e35f71d.4f1b452c.js b/assets/js/0e35f71d.4f1b452c.js new file mode 100644 index 0000000000..3313f6aa99 --- /dev/null +++ b/assets/js/0e35f71d.4f1b452c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1672],{3230:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-12.0/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/12.0/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/using-with-babel.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/12.0/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/12.0/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),u=n(1682),c=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function b(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=b({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{g&&i(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/0e35f71d.922de4b0.js b/assets/js/0e35f71d.922de4b0.js deleted file mode 100644 index 60ef5e2206..0000000000 --- a/assets/js/0e35f71d.922de4b0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1672],{2610:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-12.0/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/12.0/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/using-with-babel.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/12.0/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/12.0/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),u=n(5167),c=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function b(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=b({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{g&&i(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/13973f06.622ff653.js b/assets/js/13973f06.622ff653.js deleted file mode 100644 index a004f2ce04..0000000000 --- a/assets/js/13973f06.622ff653.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1446],{2709:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-12.0/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/12.0/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/processing.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/12.0/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/12.0/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/13973f06.e6f985d5.js b/assets/js/13973f06.e6f985d5.js new file mode 100644 index 0000000000..cb58f54894 --- /dev/null +++ b/assets/js/13973f06.e6f985d5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1446],{5842:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-12.0/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/12.0/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/processing.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/12.0/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/12.0/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1438ea8f.38a1d8c7.js b/assets/js/1438ea8f.38a1d8c7.js new file mode 100644 index 0000000000..06fedb9641 --- /dev/null +++ b/assets/js/1438ea8f.38a1d8c7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[853],{5959:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-14.2/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/14.2/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/jsdom-version.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.2/guides/esm-support"},"next":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/14.2/guides/snapshot-testing"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),b=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{b&&l(b)}),[b]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,o]),tabValues:o}}var g=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",b.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1438ea8f.864d0288.js b/assets/js/1438ea8f.864d0288.js deleted file mode 100644 index 5274c53847..0000000000 --- a/assets/js/1438ea8f.864d0288.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[853],{572:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-14.2/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/14.2/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/jsdom-version.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.2/guides/esm-support"},"next":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/14.2/guides/snapshot-testing"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),b=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{b&&l(b)}),[b]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,o]),tabValues:o}}var g=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",b.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/14b133ce.ca79723e.js b/assets/js/14b133ce.68259f60.js similarity index 60% rename from assets/js/14b133ce.ca79723e.js rename to assets/js/14b133ce.68259f60.js index a43bbb8760..41005b008f 100644 --- a/assets/js/14b133ce.ca79723e.js +++ b/assets/js/14b133ce.68259f60.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1653],{6124:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This guide is now DEPRECATED and will be removed in the next major release together with the below APIs.","source":"@site/docs/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/next/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/angular-ivy.md","tags":[],"version":"current","lastUpdatedBy":"ahnpnl","lastUpdatedAt":1735635587000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/next/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/next/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"angular-ivy",title:"Angular Ivy"},c=void 0,u={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"warning",children:(0,s.jsxs)(t.p,{children:["This guide is now ",(0,s.jsx)(t.strong,{children:"DEPRECATED"})," and will be removed in the next major release together with the below APIs."]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[c,d]=h({queryString:n,groupId:s}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,u.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=c??f;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(c(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1653],{1772:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This guide is now DEPRECATED and will be removed in the next major release together with the below APIs.","source":"@site/docs/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/next/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/angular-ivy.md","tags":[],"version":"current","lastUpdatedBy":"ahnpnl","lastUpdatedAt":1735635587000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/next/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/next/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"angular-ivy",title:"Angular Ivy"},c=void 0,u={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"warning",children:(0,s.jsxs)(t.p,{children:["This guide is now ",(0,s.jsx)(t.strong,{children:"DEPRECATED"})," and will be removed in the next major release together with the below APIs."]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[c,d]=h({queryString:n,groupId:s}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,u.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=c??f;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(c(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/151633a5.435147e0.js b/assets/js/151633a5.435147e0.js new file mode 100644 index 0000000000..b57d25e1c5 --- /dev/null +++ b/assets/js/151633a5.435147e0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4528],{5571:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-11.0/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/11.0/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/introduction.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/11.0/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/151633a5.dd917c1e.js b/assets/js/151633a5.dd917c1e.js deleted file mode 100644 index b4b455724e..0000000000 --- a/assets/js/151633a5.dd917c1e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4528],{238:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-11.0/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/11.0/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/introduction.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/11.0/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/15a051c9.2048c710.js b/assets/js/15a051c9.2048c710.js deleted file mode 100644 index 86bec23605..0000000000 --- a/assets/js/15a051c9.2048c710.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1116],{9966:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>b,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-14.3/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/14.3/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/using-with-babel.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/14.3/guides/snapshot-testing"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.3/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(9489),i=n(7227);const o={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:'title="babel.config.js"',children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function b(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),i=n(6494),o=n(2814),u=n(5167),c=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function b(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!b({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return b({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{g&&o(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!b({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>o.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/15a051c9.63f493b4.js b/assets/js/15a051c9.63f493b4.js new file mode 100644 index 0000000000..a13e72c9ca --- /dev/null +++ b/assets/js/15a051c9.63f493b4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1116],{8583:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>b,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-14.3/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/14.3/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/using-with-babel.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/14.3/guides/snapshot-testing"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.3/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(1470),i=n(9365);const o={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:'title="babel.config.js"',children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function b(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),i=n(205),o=n(7485),u=n(1682),c=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function b(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!b({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return b({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{g&&o(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!b({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{o.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/164a8de7.9a3d6637.js b/assets/js/164a8de7.9a3d6637.js deleted file mode 100644 index 34304d5ddc..0000000000 --- a/assets/js/164a8de7.9a3d6637.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1795],{7007:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-14.3/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/14.3/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/jsdom-version.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.3/guides/esm-support"},"next":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/14.3/guides/snapshot-testing"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=f({queryString:n,groupId:s}),[h,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),b=(()=>{const e=u??h;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{b&&l(b)}),[b]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,o]),tabValues:o}}var g=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",b.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=h(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/164a8de7.cd7de8b4.js b/assets/js/164a8de7.cd7de8b4.js new file mode 100644 index 0000000000..46a0f202f2 --- /dev/null +++ b/assets/js/164a8de7.cd7de8b4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1795],{905:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-14.3/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/14.3/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/jsdom-version.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.3/guides/esm-support"},"next":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/14.3/guides/snapshot-testing"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=f({queryString:n,groupId:s}),[h,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),b=(()=>{const e=u??h;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{b&&l(b)}),[b]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,o]),tabValues:o}}var g=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",b.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=h(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/17896441.703c7d4f.js b/assets/js/17896441.703c7d4f.js deleted file mode 100644 index 46c5d6187a..0000000000 --- a/assets/js/17896441.703c7d4f.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8401],{4687:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>Gt});var s=n(6540),a=n(4239),o=n(4799),i=n(4848);const l=s.createContext(null);function c(e){let{children:t,content:n}=e;const a=function(e){return(0,s.useMemo)((()=>({metadata:e.metadata,frontMatter:e.frontMatter,assets:e.assets,contentTitle:e.contentTitle,toc:e.toc})),[e])}(n);return(0,i.jsx)(l.Provider,{value:a,children:t})}function r(){const e=(0,s.useContext)(l);if(null===e)throw new o.dV("DocProvider");return e}function d(){const{metadata:e,frontMatter:t,assets:n}=r();return(0,i.jsx)(a.be,{title:e.title,description:e.description,keywords:t.keywords,image:n.image??t.image})}var u=n(4164),m=n(2216),h=n(3230),p=n(4783);function f(e){const{permalink:t,title:n,subLabel:s,isNext:a}=e;return(0,i.jsxs)(p.A,{className:(0,u.A)("pagination-nav__link",a?"pagination-nav__link--next":"pagination-nav__link--prev"),to:t,children:[s&&(0,i.jsx)("div",{className:"pagination-nav__sublabel",children:s}),(0,i.jsx)("div",{className:"pagination-nav__label",children:n})]})}function x(e){const{previous:t,next:n}=e;return(0,i.jsxs)("nav",{className:"pagination-nav docusaurus-mt-lg","aria-label":(0,h.T)({id:"theme.docs.paginator.navAriaLabel",message:"Docs pages",description:"The ARIA label for the docs pagination"}),children:[t&&(0,i.jsx)(f,{...t,subLabel:(0,i.jsx)(h.A,{id:"theme.docs.paginator.previous",description:"The label used to navigate to the previous doc",children:"Previous"})}),n&&(0,i.jsx)(f,{...n,subLabel:(0,i.jsx)(h.A,{id:"theme.docs.paginator.next",description:"The label used to navigate to the next doc",children:"Next"}),isNext:!0})]})}function b(){const{metadata:e}=r();return(0,i.jsx)(x,{previous:e.previous,next:e.next})}var g=n(7639),j=n(4721),v=n(8630),N=n(6457),A=n(1704);const C={unreleased:function(e){let{siteTitle:t,versionMetadata:n}=e;return(0,i.jsx)(h.A,{id:"theme.docs.versions.unreleasedVersionLabel",description:"The label used to tell the user that he's browsing an unreleased doc version",values:{siteTitle:t,versionLabel:(0,i.jsx)("b",{children:n.label})},children:"This is unreleased documentation for {siteTitle} {versionLabel} version."})},unmaintained:function(e){let{siteTitle:t,versionMetadata:n}=e;return(0,i.jsx)(h.A,{id:"theme.docs.versions.unmaintainedVersionLabel",description:"The label used to tell the user that he's browsing an unmaintained doc version",values:{siteTitle:t,versionLabel:(0,i.jsx)("b",{children:n.label})},children:"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained."})}};function y(e){const t=C[e.versionMetadata.banner];return(0,i.jsx)(t,{...e})}function k(e){let{versionLabel:t,to:n,onClick:s}=e;return(0,i.jsx)(h.A,{id:"theme.docs.versions.latestVersionSuggestionLabel",description:"The label used to tell the user to check the latest version",values:{versionLabel:t,latestVersionLink:(0,i.jsx)("b",{children:(0,i.jsx)(p.A,{to:n,onClick:s,children:(0,i.jsx)(h.A,{id:"theme.docs.versions.latestVersionLinkLabel",description:"The label used for the latest version suggestion link label",children:"latest version"})})})},children:"For up-to-date documentation, see the {latestVersionLink} ({versionLabel})."})}function L(e){let{className:t,versionMetadata:n}=e;const{siteConfig:{title:s}}=(0,g.A)(),{pluginId:a}=(0,j.vT)({failfast:!0}),{savePreferredVersionName:o}=(0,N.g1)(a),{latestDocSuggestion:l,latestVersionSuggestion:c}=(0,j.HW)(a),r=l??(d=c).docs.find((e=>e.id===d.mainDocId));var d;return(0,i.jsxs)("div",{className:(0,u.A)(t,v.G.docs.docVersionBanner,"alert alert--warning margin-bottom--md"),role:"alert",children:[(0,i.jsx)("div",{children:(0,i.jsx)(y,{siteTitle:s,versionMetadata:n})}),(0,i.jsx)("div",{className:"margin-top--md",children:(0,i.jsx)(k,{versionLabel:c.label,to:r.path,onClick:()=>o(c.name)})})]})}function B(e){let{className:t}=e;const n=(0,A.r)();return n.banner?(0,i.jsx)(L,{className:t,versionMetadata:n}):null}function _(e){let{className:t}=e;const n=(0,A.r)();return n.badge?(0,i.jsx)("span",{className:(0,u.A)(t,v.G.docs.docVersionBadge,"badge badge--secondary"),children:(0,i.jsx)(h.A,{id:"theme.docs.versionBadge.label",values:{versionLabel:n.label},children:"Version: {versionLabel}"})}):null}const w={tag:"tag_zVej",tagRegular:"tagRegular_sFm0",tagWithCount:"tagWithCount_h2kH"};function T(e){let{permalink:t,label:n,count:s,description:a}=e;return(0,i.jsxs)(p.A,{href:t,title:a,className:(0,u.A)(w.tag,s?w.tagWithCount:w.tagRegular),children:[n,s&&(0,i.jsx)("span",{children:s})]})}const E={tags:"tags_jXut",tag:"tag_QGVx"};function H(e){let{tags:t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("b",{children:(0,i.jsx)(h.A,{id:"theme.tags.tagsListLabel",description:"The label alongside a tag list",children:"Tags:"})}),(0,i.jsx)("ul",{className:(0,u.A)(E.tags,"padding--none","margin-left--sm"),children:t.map((e=>(0,i.jsx)("li",{className:E.tag,children:(0,i.jsx)(T,{...e})},e.permalink)))})]})}const M={iconEdit:"iconEdit_Z9Sw"};function I(e){let{className:t,...n}=e;return(0,i.jsx)("svg",{fill:"currentColor",height:"20",width:"20",viewBox:"0 0 40 40",className:(0,u.A)(M.iconEdit,t),"aria-hidden":"true",...n,children:(0,i.jsx)("g",{children:(0,i.jsx)("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"})})})}function S(e){let{editUrl:t}=e;return(0,i.jsxs)(p.A,{to:t,className:v.G.common.editThisPage,children:[(0,i.jsx)(I,{}),(0,i.jsx)(h.A,{id:"theme.common.editThisPage",description:"The link label to edit the current page",children:"Edit this page"})]})}function U(e){void 0===e&&(e={});const{i18n:{currentLocale:t}}=(0,g.A)(),n=function(){const{i18n:{currentLocale:e,localeConfigs:t}}=(0,g.A)();return t[e].calendar}();return new Intl.DateTimeFormat(t,{calendar:n,...e})}function V(e){let{lastUpdatedAt:t}=e;const n=new Date(t),s=U({day:"numeric",month:"short",year:"numeric",timeZone:"UTC"}).format(n);return(0,i.jsx)(h.A,{id:"theme.lastUpdated.atDate",description:"The words used to describe on which date a page has been last updated",values:{date:(0,i.jsx)("b",{children:(0,i.jsx)("time",{dateTime:n.toISOString(),itemProp:"dateModified",children:s})})},children:" on {date}"})}function R(e){let{lastUpdatedBy:t}=e;return(0,i.jsx)(h.A,{id:"theme.lastUpdated.byUser",description:"The words used to describe by who the page has been last updated",values:{user:(0,i.jsx)("b",{children:t})},children:" by {user}"})}function z(e){let{lastUpdatedAt:t,lastUpdatedBy:n}=e;return(0,i.jsxs)("span",{className:v.G.common.lastUpdated,children:[(0,i.jsx)(h.A,{id:"theme.lastUpdated.lastUpdatedAtBy",description:"The sentence used to display when a page has been last updated, and by who",values:{atDate:t?(0,i.jsx)(V,{lastUpdatedAt:t}):"",byUser:n?(0,i.jsx)(R,{lastUpdatedBy:n}):""},children:"Last updated{atDate}{byUser}"}),!1]})}const O={lastUpdated:"lastUpdated_JAkA"};function P(e){let{className:t,editUrl:n,lastUpdatedAt:s,lastUpdatedBy:a}=e;return(0,i.jsxs)("div",{className:(0,u.A)("row",t),children:[(0,i.jsx)("div",{className:"col",children:n&&(0,i.jsx)(S,{editUrl:n})}),(0,i.jsx)("div",{className:(0,u.A)("col",O.lastUpdated),children:(s||a)&&(0,i.jsx)(z,{lastUpdatedAt:s,lastUpdatedBy:a})})]})}function G(){const{metadata:e}=r(),{editUrl:t,lastUpdatedAt:n,lastUpdatedBy:s,tags:a}=e,o=a.length>0,l=!!(t||n||s);return o||l?(0,i.jsxs)("footer",{className:(0,u.A)(v.G.docs.docFooter,"docusaurus-mt-lg"),children:[o&&(0,i.jsx)("div",{className:(0,u.A)("row margin-top--sm",v.G.docs.docFooterTagsRow),children:(0,i.jsx)("div",{className:"col",children:(0,i.jsx)(H,{tags:a})})}),l&&(0,i.jsx)(P,{className:(0,u.A)("margin-top--sm",v.G.docs.docFooterEditMetaRow),editUrl:t,lastUpdatedAt:n,lastUpdatedBy:s})]}):null}var D=n(4549),W=n(1507);const $={tocCollapsibleButton:"tocCollapsibleButton_TO0P",tocCollapsibleButtonExpanded:"tocCollapsibleButtonExpanded_MG3E"};function F(e){let{collapsed:t,...n}=e;return(0,i.jsx)("button",{type:"button",...n,className:(0,u.A)("clean-btn",$.tocCollapsibleButton,!t&&$.tocCollapsibleButtonExpanded,n.className),children:(0,i.jsx)(h.A,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component",children:"On this page"})})}const q={tocCollapsible:"tocCollapsible_ETCw",tocCollapsibleContent:"tocCollapsibleContent_vkbj",tocCollapsibleExpanded:"tocCollapsibleExpanded_sAul"};function Z(e){let{toc:t,className:n,minHeadingLevel:s,maxHeadingLevel:a}=e;const{collapsed:o,toggleCollapsed:l}=(0,D.u)({initialState:!0});return(0,i.jsxs)("div",{className:(0,u.A)(q.tocCollapsible,!o&&q.tocCollapsibleExpanded,n),children:[(0,i.jsx)(F,{collapsed:o,onClick:l}),(0,i.jsx)(D.N,{lazy:!0,className:q.tocCollapsibleContent,collapsed:o,children:(0,i.jsx)(W.A,{toc:t,minHeadingLevel:s,maxHeadingLevel:a})})]})}const J={tocMobile:"tocMobile_ITEo"};function Y(){const{toc:e,frontMatter:t}=r();return(0,i.jsx)(Z,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:(0,u.A)(v.G.docs.docTocMobile,J.tocMobile)})}const K={tableOfContents:"tableOfContents_bqdL",docItemContainer:"docItemContainer_F8PC"},Q="table-of-contents__link toc-highlight",X="table-of-contents__link--active";function ee(e){let{className:t,...n}=e;return(0,i.jsx)("div",{className:(0,u.A)(K.tableOfContents,"thin-scrollbar",t),children:(0,i.jsx)(W.A,{...n,linkClassName:Q,linkActiveClassName:X})})}function te(){const{toc:e,frontMatter:t}=r();return(0,i.jsx)(ee,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:v.G.docs.docTocDesktop})}var ne=n(5225),se=n(8453),ae=n(1141),oe=n(1062),ie=n(7710),le=n(6957);function ce(){const{prism:e}=(0,le.p)(),{colorMode:t}=(0,ie.G)(),n=e.theme,s=e.darkTheme||n;return"dark"===t?s:n}var re=n(8426),de=n.n(re);const ue=/title=(?["'])(?.*?)\1/,me=/\{(?<range>[\d,-]+)\}/,he={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},pe={...he,lua:{start:"--",end:""},wasm:{start:"\\;\\;",end:""},tex:{start:"%",end:""},vb:{start:"['\u2018\u2019]",end:""},vbnet:{start:"(?:_\\s*)?['\u2018\u2019]",end:""},rem:{start:"[Rr][Ee][Mm]\\b",end:""},f90:{start:"!",end:""},ml:{start:"\\(\\*",end:"\\*\\)"},cobol:{start:"\\*>",end:""}},fe=Object.keys(he);function xe(e,t){const n=e.map((e=>{const{start:n,end:s}=pe[e];return`(?:${n}\\s*(${t.flatMap((e=>[e.line,e.block?.start,e.block?.end].filter(Boolean))).join("|")})\\s*${s})`})).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function be(e,t){let n=e.replace(/\n$/,"");const{language:s,magicComments:a,metastring:o}=t;if(o&&me.test(o)){const e=o.match(me).groups.range;if(0===a.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${o}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const t=a[0].className,s=de()(e).filter((e=>e>0)).map((e=>[e-1,[t]]));return{lineClassNames:Object.fromEntries(s),code:n}}if(void 0===s)return{lineClassNames:{},code:n};const i=function(e,t){switch(e){case"js":case"javascript":case"ts":case"typescript":return xe(["js","jsBlock"],t);case"jsx":case"tsx":return xe(["js","jsBlock","jsx"],t);case"html":return xe(["js","jsBlock","html"],t);case"python":case"py":case"bash":return xe(["bash"],t);case"markdown":case"md":return xe(["html","jsx","bash"],t);case"tex":case"latex":case"matlab":return xe(["tex"],t);case"lua":case"haskell":case"sql":return xe(["lua"],t);case"wasm":return xe(["wasm"],t);case"vb":case"vba":case"visual-basic":return xe(["vb","rem"],t);case"vbnet":return xe(["vbnet","rem"],t);case"batch":return xe(["rem"],t);case"basic":return xe(["rem","f90"],t);case"fsharp":return xe(["js","ml"],t);case"ocaml":case"sml":return xe(["ml"],t);case"fortran":return xe(["f90"],t);case"cobol":return xe(["cobol"],t);default:return xe(fe,t)}}(s,a),l=n.split("\n"),c=Object.fromEntries(a.map((e=>[e.className,{start:0,range:""}]))),r=Object.fromEntries(a.filter((e=>e.line)).map((e=>{let{className:t,line:n}=e;return[n,t]}))),d=Object.fromEntries(a.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.start,t]}))),u=Object.fromEntries(a.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.end,t]})));for(let h=0;h<l.length;){const e=l[h].match(i);if(!e){h+=1;continue}const t=e.slice(1).find((e=>void 0!==e));r[t]?c[r[t]].range+=`${h},`:d[t]?c[d[t]].start=h:u[t]&&(c[u[t]].range+=`${c[u[t]].start}-${h-1},`),l.splice(h,1)}n=l.join("\n");const m={};return Object.entries(c).forEach((e=>{let[t,{range:n}]=e;de()(n).forEach((e=>{m[e]??=[],m[e].push(t)}))})),{lineClassNames:m,code:n}}const ge={codeBlockContainer:"codeBlockContainer_Ckt0"};function je(e){let{as:t,...n}=e;const s=function(e){const t={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(e.plain).forEach((e=>{let[s,a]=e;const o=t[s];o&&"string"==typeof a&&(n[o]=a)})),n}(ce());return(0,i.jsx)(t,{...n,style:s,className:(0,u.A)(n.className,ge.codeBlockContainer,v.G.common.codeBlock)})}const ve={codeBlockContent:"codeBlockContent_biex",codeBlockTitle:"codeBlockTitle_Ktv7",codeBlock:"codeBlock_bY9V",codeBlockStandalone:"codeBlockStandalone_MEMb",codeBlockLines:"codeBlockLines_e6Vv",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_o6Pm",buttonGroup:"buttonGroup__atx"};function Ne(e){let{children:t,className:n}=e;return(0,i.jsx)(je,{as:"pre",tabIndex:0,className:(0,u.A)(ve.codeBlockStandalone,"thin-scrollbar",n),children:(0,i.jsx)("code",{className:ve.codeBlockLines,children:t})})}const Ae={attributes:!0,characterData:!0,childList:!0,subtree:!0};function Ce(e,t){const[n,a]=(0,s.useState)(),i=(0,s.useCallback)((()=>{a(e.current?.closest("[role=tabpanel][hidden]"))}),[e,a]);(0,s.useEffect)((()=>{i()}),[i]),function(e,t,n){void 0===n&&(n=Ae);const a=(0,o._q)(t),i=(0,o.Be)(n);(0,s.useEffect)((()=>{const t=new MutationObserver(a);return e&&t.observe(e,i),()=>t.disconnect()}),[e,a,i])}(n,(e=>{e.forEach((e=>{"attributes"===e.type&&"hidden"===e.attributeName&&(t(),i())}))}),{attributes:!0,characterData:!1,childList:!1,subtree:!1})}var ye=n(1765);const ke={codeLine:"codeLine_lJS_",codeLineNumber:"codeLineNumber_Tfdd",codeLineContent:"codeLineContent_feaV"};function Le(e){let{line:t,classNames:n,showLineNumbers:s,getLineProps:a,getTokenProps:o}=e;1===t.length&&"\n"===t[0].content&&(t[0].content="");const l=a({line:t,className:(0,u.A)(n,s&&ke.codeLine)}),c=t.map(((e,t)=>(0,i.jsx)("span",{...o({token:e})},t)));return(0,i.jsxs)("span",{...l,children:[s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:ke.codeLineNumber}),(0,i.jsx)("span",{className:ke.codeLineContent,children:c})]}):c,(0,i.jsx)("br",{})]})}function Be(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"})})}function _e(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})}const we={copyButtonCopied:"copyButtonCopied_obH4",copyButtonIcons:"copyButtonIcons_eSgA",copyButtonIcon:"copyButtonIcon_y97N",copyButtonSuccessIcon:"copyButtonSuccessIcon_LjdS"};function Te(e){let{code:t,className:n}=e;const[a,o]=(0,s.useState)(!1),l=(0,s.useRef)(void 0),c=(0,s.useCallback)((()=>{!function(e,t){let{target:n=document.body}=void 0===t?{}:t;if("string"!=typeof e)throw new TypeError(`Expected parameter \`text\` to be a \`string\`, got \`${typeof e}\`.`);const s=document.createElement("textarea"),a=document.activeElement;s.value=e,s.setAttribute("readonly",""),s.style.contain="strict",s.style.position="absolute",s.style.left="-9999px",s.style.fontSize="12pt";const o=document.getSelection(),i=o.rangeCount>0&&o.getRangeAt(0);n.append(s),s.select(),s.selectionStart=0,s.selectionEnd=e.length;let l=!1;try{l=document.execCommand("copy")}catch{}s.remove(),i&&(o.removeAllRanges(),o.addRange(i)),a&&a.focus()}(t),o(!0),l.current=window.setTimeout((()=>{o(!1)}),1e3)}),[t]);return(0,s.useEffect)((()=>()=>window.clearTimeout(l.current)),[]),(0,i.jsx)("button",{type:"button","aria-label":a?(0,h.T)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,h.T)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,h.T)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,u.A)("clean-btn",n,we.copyButton,a&&we.copyButtonCopied),onClick:c,children:(0,i.jsxs)("span",{className:we.copyButtonIcons,"aria-hidden":"true",children:[(0,i.jsx)(Be,{className:we.copyButtonIcon}),(0,i.jsx)(_e,{className:we.copyButtonSuccessIcon})]})})}function Ee(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"})})}const He={wordWrapButtonIcon:"wordWrapButtonIcon_Bwma",wordWrapButtonEnabled:"wordWrapButtonEnabled_EoeP"};function Me(e){let{className:t,onClick:n,isEnabled:s}=e;const a=(0,h.T)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return(0,i.jsx)("button",{type:"button",onClick:n,className:(0,u.A)("clean-btn",t,s&&He.wordWrapButtonEnabled),"aria-label":a,title:a,children:(0,i.jsx)(Ee,{className:He.wordWrapButtonIcon,"aria-hidden":"true"})})}function Ie(e){let{children:t,className:n="",metastring:a,title:o,showLineNumbers:l,language:c}=e;const{prism:{defaultLanguage:r,magicComments:d}}=(0,le.p)(),m=function(e){return e?.toLowerCase()}(c??function(e){const t=e.split(" ").find((e=>e.startsWith("language-")));return t?.replace(/language-/,"")}(n)??r),h=ce(),p=function(){const[e,t]=(0,s.useState)(!1),[n,a]=(0,s.useState)(!1),o=(0,s.useRef)(null),i=(0,s.useCallback)((()=>{const n=o.current.querySelector("code");e?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),t((e=>!e))}),[o,e]),l=(0,s.useCallback)((()=>{const{scrollWidth:e,clientWidth:t}=o.current,n=e>t||o.current.querySelector("code").hasAttribute("style");a(n)}),[o]);return Ce(o,l),(0,s.useEffect)((()=>{l()}),[e,l]),(0,s.useEffect)((()=>(window.addEventListener("resize",l,{passive:!0}),()=>{window.removeEventListener("resize",l)})),[l]),{codeBlockRef:o,isEnabled:e,isCodeScrollable:n,toggle:i}}(),f=function(e){return e?.match(ue)?.groups.title??""}(a)||o,{lineClassNames:x,code:b}=be(t,{metastring:a,language:m,magicComments:d}),g=l??function(e){return Boolean(e?.includes("showLineNumbers"))}(a);return(0,i.jsxs)(je,{as:"div",className:(0,u.A)(n,m&&!n.includes(`language-${m}`)&&`language-${m}`),children:[f&&(0,i.jsx)("div",{className:ve.codeBlockTitle,children:f}),(0,i.jsxs)("div",{className:ve.codeBlockContent,children:[(0,i.jsx)(ye.f4,{theme:h,code:b,language:m??"text",children:e=>{let{className:t,style:n,tokens:s,getLineProps:a,getTokenProps:o}=e;return(0,i.jsx)("pre",{tabIndex:0,ref:p.codeBlockRef,className:(0,u.A)(t,ve.codeBlock,"thin-scrollbar"),style:n,children:(0,i.jsx)("code",{className:(0,u.A)(ve.codeBlockLines,g&&ve.codeBlockLinesWithNumbering),children:s.map(((e,t)=>(0,i.jsx)(Le,{line:e,getLineProps:a,getTokenProps:o,classNames:x[t],showLineNumbers:g},t)))})})}}),(0,i.jsxs)("div",{className:ve.buttonGroup,children:[(p.isEnabled||p.isCodeScrollable)&&(0,i.jsx)(Me,{className:ve.codeButton,onClick:()=>p.toggle(),isEnabled:p.isEnabled}),(0,i.jsx)(Te,{className:ve.codeButton,code:b})]})]})]})}function Se(e){let{children:t,...n}=e;const a=(0,oe.A)(),o=function(e){return s.Children.toArray(e).some((e=>(0,s.isValidElement)(e)))?e:Array.isArray(e)?e.join(""):e}(t),l="string"==typeof o?Ie:Ne;return(0,i.jsx)(l,{...n,children:o},String(a))}function Ue(e){return(0,i.jsx)("code",{...e})}var Ve=n(7344);const Re={details:"details_lb9f",isBrowser:"isBrowser_bmU9",collapsibleContent:"collapsibleContent_i85q"};function ze(e){return!!e&&("SUMMARY"===e.tagName||ze(e.parentElement))}function Oe(e,t){return!!e&&(e===t||Oe(e.parentElement,t))}function Pe(e){let{summary:t,children:n,...a}=e;(0,Ve.A)().collectAnchor(a.id);const o=(0,oe.A)(),l=(0,s.useRef)(null),{collapsed:c,setCollapsed:r}=(0,D.u)({initialState:!a.open}),[d,m]=(0,s.useState)(a.open),h=s.isValidElement(t)?t:(0,i.jsx)("summary",{children:t??"Details"});return(0,i.jsxs)("details",{...a,ref:l,open:d,"data-collapsed":c,className:(0,u.A)(Re.details,o&&Re.isBrowser,a.className),onMouseDown:e=>{ze(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const t=e.target;ze(t)&&Oe(t,l.current)&&(e.preventDefault(),c?(r(!1),m(!0)):r(!0))},children:[h,(0,i.jsx)(D.N,{lazy:!1,collapsed:c,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{r(e),m(!e)},children:(0,i.jsx)("div",{className:Re.collapsibleContent,children:n})})]})}const Ge={details:"details_b_Ee"},De="alert alert--info";function We(e){let{...t}=e;return(0,i.jsx)(Pe,{...t,className:(0,u.A)(De,Ge.details,t.className)})}function $e(e){const t=s.Children.toArray(e.children),n=t.find((e=>s.isValidElement(e)&&"summary"===e.type)),a=(0,i.jsx)(i.Fragment,{children:t.filter((e=>e!==n))});return(0,i.jsx)(We,{...e,summary:n,children:a})}function Fe(e){return(0,i.jsx)(ne.A,{...e})}const qe={containsTaskList:"containsTaskList_mC6p"};function Ze(e){if(void 0!==e)return(0,u.A)(e,e?.includes("contains-task-list")&&qe.containsTaskList)}const Je={img:"img_ev3q"};function Ye(e){const{mdxAdmonitionTitle:t,rest:n}=function(e){const t=s.Children.toArray(e),n=t.find((e=>s.isValidElement(e)&&"mdxAdmonitionTitle"===e.type)),a=t.filter((e=>e!==n)),o=n?.props.children;return{mdxAdmonitionTitle:o,rest:a.length>0?(0,i.jsx)(i.Fragment,{children:a}):null}}(e.children),a=e.title??t;return{...e,...a&&{title:a},children:n}}const Ke={admonition:"admonition_xJq3",admonitionHeading:"admonitionHeading_Gvgb",admonitionIcon:"admonitionIcon_Rf37",admonitionContent:"admonitionContent_BuS1"};function Qe(e){let{type:t,className:n,children:s}=e;return(0,i.jsx)("div",{className:(0,u.A)(v.G.common.admonition,v.G.common.admonitionType(t),Ke.admonition,n),children:s})}function Xe(e){let{icon:t,title:n}=e;return(0,i.jsxs)("div",{className:Ke.admonitionHeading,children:[(0,i.jsx)("span",{className:Ke.admonitionIcon,children:t}),n]})}function et(e){let{children:t}=e;return t?(0,i.jsx)("div",{className:Ke.admonitionContent,children:t}):null}function tt(e){const{type:t,icon:n,title:s,children:a,className:o}=e;return(0,i.jsxs)(Qe,{type:t,className:o,children:[s||n?(0,i.jsx)(Xe,{title:s,icon:n}):null,(0,i.jsx)(et,{children:a})]})}function nt(e){return(0,i.jsx)("svg",{viewBox:"0 0 14 16",...e,children:(0,i.jsx)("path",{fillRule:"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"})})}const st={icon:(0,i.jsx)(nt,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.note",description:"The default label used for the Note admonition (:::note)",children:"note"})};function at(e){return(0,i.jsx)(tt,{...st,...e,className:(0,u.A)("alert alert--secondary",e.className),children:e.children})}function ot(e){return(0,i.jsx)("svg",{viewBox:"0 0 12 16",...e,children:(0,i.jsx)("path",{fillRule:"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"})})}const it={icon:(0,i.jsx)(ot,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.tip",description:"The default label used for the Tip admonition (:::tip)",children:"tip"})};function lt(e){return(0,i.jsx)(tt,{...it,...e,className:(0,u.A)("alert alert--success",e.className),children:e.children})}function ct(e){return(0,i.jsx)("svg",{viewBox:"0 0 14 16",...e,children:(0,i.jsx)("path",{fillRule:"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"})})}const rt={icon:(0,i.jsx)(ct,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.info",description:"The default label used for the Info admonition (:::info)",children:"info"})};function dt(e){return(0,i.jsx)(tt,{...rt,...e,className:(0,u.A)("alert alert--info",e.className),children:e.children})}function ut(e){return(0,i.jsx)("svg",{viewBox:"0 0 16 16",...e,children:(0,i.jsx)("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})})}const mt={icon:(0,i.jsx)(ut,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.warning",description:"The default label used for the Warning admonition (:::warning)",children:"warning"})};function ht(e){return(0,i.jsx)("svg",{viewBox:"0 0 12 16",...e,children:(0,i.jsx)("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})})}const pt={icon:(0,i.jsx)(ht,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.danger",description:"The default label used for the Danger admonition (:::danger)",children:"danger"})};const ft={icon:(0,i.jsx)(ut,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.caution",description:"The default label used for the Caution admonition (:::caution)",children:"caution"})};const xt={...{note:at,tip:lt,info:dt,warning:function(e){return(0,i.jsx)(tt,{...mt,...e,className:(0,u.A)("alert alert--warning",e.className),children:e.children})},danger:function(e){return(0,i.jsx)(tt,{...pt,...e,className:(0,u.A)("alert alert--danger",e.className),children:e.children})}},...{secondary:e=>(0,i.jsx)(at,{title:"secondary",...e}),important:e=>(0,i.jsx)(dt,{title:"important",...e}),success:e=>(0,i.jsx)(lt,{title:"success",...e}),caution:function(e){return(0,i.jsx)(tt,{...ft,...e,className:(0,u.A)("alert alert--warning",e.className),children:e.children})}}};function bt(e){const t=Ye(e),n=(s=t.type,xt[s]||(console.warn(`No admonition component found for admonition type "${s}". Using Info as fallback.`),xt.info));var s;return(0,i.jsx)(n,{...t})}const gt={Head:ae.A,details:$e,Details:$e,code:function(e){return function(e){return void 0!==e.children&&s.Children.toArray(e.children).every((e=>"string"==typeof e&&!e.includes("\n")))}(e)?(0,i.jsx)(Ue,{...e}):(0,i.jsx)(Se,{...e})},a:function(e){return(0,i.jsx)(p.A,{...e})},pre:function(e){return(0,i.jsx)(i.Fragment,{children:e.children})},ul:function(e){return(0,i.jsx)("ul",{...e,className:Ze(e.className)})},li:function(e){return(0,Ve.A)().collectAnchor(e.id),(0,i.jsx)("li",{...e})},img:function(e){return(0,i.jsx)("img",{decoding:"async",loading:"lazy",...e,className:(t=e.className,(0,u.A)(t,Je.img))});var t},h1:e=>(0,i.jsx)(Fe,{as:"h1",...e}),h2:e=>(0,i.jsx)(Fe,{as:"h2",...e}),h3:e=>(0,i.jsx)(Fe,{as:"h3",...e}),h4:e=>(0,i.jsx)(Fe,{as:"h4",...e}),h5:e=>(0,i.jsx)(Fe,{as:"h5",...e}),h6:e=>(0,i.jsx)(Fe,{as:"h6",...e}),admonition:bt,mermaid:()=>null};function jt(e){let{children:t}=e;return(0,i.jsx)(se.x,{components:gt,children:t})}function vt(e){let{children:t}=e;const n=function(){const{metadata:e,frontMatter:t,contentTitle:n}=r();return t.hide_title||void 0!==n?null:e.title}();return(0,i.jsxs)("div",{className:(0,u.A)(v.G.docs.docMarkdown,"markdown"),children:[n&&(0,i.jsx)("header",{children:(0,i.jsx)(ne.A,{as:"h1",children:n})}),(0,i.jsx)(jt,{children:t})]})}var Nt=n(5357),At=n(260),Ct=n(8180);function yt(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{d:"M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z",fill:"currentColor"})})}const kt={breadcrumbHomeIcon:"breadcrumbHomeIcon_YNFT"};function Lt(){const e=(0,Ct.Ay)("/");return(0,i.jsx)("li",{className:"breadcrumbs__item",children:(0,i.jsx)(p.A,{"aria-label":(0,h.T)({id:"theme.docs.breadcrumbs.home",message:"Home page",description:"The ARIA label for the home page in the breadcrumbs"}),className:"breadcrumbs__link",href:e,children:(0,i.jsx)(yt,{className:kt.breadcrumbHomeIcon})})})}const Bt={breadcrumbsContainer:"breadcrumbsContainer_Z_bl"};function _t(e){let{children:t,href:n,isLast:s}=e;const a="breadcrumbs__link";return s?(0,i.jsx)("span",{className:a,itemProp:"name",children:t}):n?(0,i.jsx)(p.A,{className:a,href:n,itemProp:"item",children:(0,i.jsx)("span",{itemProp:"name",children:t})}):(0,i.jsx)("span",{className:a,children:t})}function wt(e){let{children:t,active:n,index:s,addMicrodata:a}=e;return(0,i.jsxs)("li",{...a&&{itemScope:!0,itemProp:"itemListElement",itemType:"https://schema.org/ListItem"},className:(0,u.A)("breadcrumbs__item",{"breadcrumbs__item--active":n}),children:[t,(0,i.jsx)("meta",{itemProp:"position",content:String(s+1)})]})}function Tt(){const e=(0,Nt.OF)(),t=(0,At.Dt)();return e?(0,i.jsx)("nav",{className:(0,u.A)(v.G.docs.docBreadcrumbs,Bt.breadcrumbsContainer),"aria-label":(0,h.T)({id:"theme.docs.breadcrumbs.navAriaLabel",message:"Breadcrumbs",description:"The ARIA label for the breadcrumbs"}),children:(0,i.jsxs)("ul",{className:"breadcrumbs",itemScope:!0,itemType:"https://schema.org/BreadcrumbList",children:[t&&(0,i.jsx)(Lt,{}),e.map(((t,n)=>{const s=n===e.length-1,a="category"===t.type&&t.linkUnlisted?void 0:t.href;return(0,i.jsx)(wt,{active:s,index:n,addMicrodata:!!a,children:(0,i.jsx)(_t,{href:a,isLast:s,children:t.label})},n)}))]})}):null}function Et(){return(0,i.jsx)(h.A,{id:"theme.contentVisibility.unlistedBanner.title",description:"The unlisted content banner title",children:"Unlisted page"})}function Ht(){return(0,i.jsx)(h.A,{id:"theme.contentVisibility.unlistedBanner.message",description:"The unlisted content banner message",children:"This page is unlisted. Search engines will not index it, and only users having a direct link can access it."})}function Mt(){return(0,i.jsx)(ae.A,{children:(0,i.jsx)("meta",{name:"robots",content:"noindex, nofollow"})})}function It(){return(0,i.jsx)(h.A,{id:"theme.contentVisibility.draftBanner.title",description:"The draft content banner title",children:"Draft page"})}function St(){return(0,i.jsx)(h.A,{id:"theme.contentVisibility.draftBanner.message",description:"The draft content banner message",children:"This page is a draft. It will only be visible in dev and be excluded from the production build."})}function Ut(e){let{className:t}=e;return(0,i.jsx)(bt,{type:"caution",title:(0,i.jsx)(It,{}),className:(0,u.A)(t,v.G.common.draftBanner),children:(0,i.jsx)(St,{})})}function Vt(e){let{className:t}=e;return(0,i.jsx)(bt,{type:"caution",title:(0,i.jsx)(Et,{}),className:(0,u.A)(t,v.G.common.unlistedBanner),children:(0,i.jsx)(Ht,{})})}function Rt(e){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Mt,{}),(0,i.jsx)(Vt,{...e})]})}function zt(e){let{metadata:t}=e;const{unlisted:n,frontMatter:s}=t;return(0,i.jsxs)(i.Fragment,{children:[(n||s.unlisted)&&(0,i.jsx)(Rt,{}),s.draft&&(0,i.jsx)(Ut,{})]})}const Ot={docItemContainer:"docItemContainer_Djhp",docItemCol:"docItemCol_VOVn"};function Pt(e){let{children:t}=e;const n=function(){const{frontMatter:e,toc:t}=r(),n=(0,m.l)(),s=e.hide_table_of_contents,a=!s&&t.length>0;return{hidden:s,mobile:a?(0,i.jsx)(Y,{}):void 0,desktop:!a||"desktop"!==n&&"ssr"!==n?void 0:(0,i.jsx)(te,{})}}(),{metadata:s}=r();return(0,i.jsxs)("div",{className:"row",children:[(0,i.jsxs)("div",{className:(0,u.A)("col",!n.hidden&&Ot.docItemCol),children:[(0,i.jsx)(zt,{metadata:s}),(0,i.jsx)(B,{}),(0,i.jsxs)("div",{className:Ot.docItemContainer,children:[(0,i.jsxs)("article",{children:[(0,i.jsx)(Tt,{}),(0,i.jsx)(_,{}),n.mobile,(0,i.jsx)(vt,{children:t}),(0,i.jsx)(G,{})]}),(0,i.jsx)(b,{})]})]}),n.desktop&&(0,i.jsx)("div",{className:"col col--3",children:n.desktop})]})}function Gt(e){const t=`docs-doc-id-${e.content.metadata.id}`,n=e.content;return(0,i.jsx)(c,{content:e.content,children:(0,i.jsxs)(a.e3,{className:t,children:[(0,i.jsx)(d,{}),(0,i.jsx)(Pt,{children:(0,i.jsx)(n,{})})]})})}},1507:(e,t,n)=>{"use strict";n.d(t,{A:()=>f});var s=n(6540),a=n(6957);function o(e){const t=e.map((e=>({...e,parentIndex:-1,children:[]}))),n=Array(7).fill(-1);t.forEach(((e,t)=>{const s=n.slice(2,e.level);e.parentIndex=Math.max(...s),n[e.level]=t}));const s=[];return t.forEach((e=>{const{parentIndex:n,...a}=e;n>=0?t[n].children.push(a):s.push(a)})),s}function i(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:s}=e;return t.flatMap((e=>{const t=i({toc:e.children,minHeadingLevel:n,maxHeadingLevel:s});return function(e){return e.level>=n&&e.level<=s}(e)?[{...e,children:t}]:t}))}function l(e){const t=e.getBoundingClientRect();return t.top===t.bottom?l(e.parentNode):t}function c(e,t){let{anchorTopOffset:n}=t;const s=e.find((e=>l(e).top>=n));if(s){return function(e){return e.top>0&&e.bottom<window.innerHeight/2}(l(s))?s:e[e.indexOf(s)-1]??null}return e[e.length-1]??null}function r(){const e=(0,s.useRef)(0),{navbar:{hideOnScroll:t}}=(0,a.p)();return(0,s.useEffect)((()=>{e.current=t?0:document.querySelector(".navbar").clientHeight}),[t]),e}function d(e){const t=(0,s.useRef)(void 0),n=r();(0,s.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:s,linkActiveClassName:a,minHeadingLevel:o,maxHeadingLevel:i}=e;function l(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(s),l=function(e){let{minHeadingLevel:t,maxHeadingLevel:n}=e;const s=[];for(let a=t;a<=n;a+=1)s.push(`h${a}.anchor`);return Array.from(document.querySelectorAll(s.join()))}({minHeadingLevel:o,maxHeadingLevel:i}),r=c(l,{anchorTopOffset:n.current}),d=e.find((e=>r&&r.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,n){n?(t.current&&t.current!==e&&t.current.classList.remove(a),e.classList.add(a),t.current=e):e.classList.remove(a)}(e,e===d)}))}return document.addEventListener("scroll",l),document.addEventListener("resize",l),l(),()=>{document.removeEventListener("scroll",l),document.removeEventListener("resize",l)}}),[e,n])}var u=n(4783),m=n(4848);function h(e){let{toc:t,className:n,linkClassName:s,isChild:a}=e;return t.length?(0,m.jsx)("ul",{className:a?void 0:n,children:t.map((e=>(0,m.jsxs)("li",{children:[(0,m.jsx)(u.A,{to:`#${e.id}`,className:s??void 0,dangerouslySetInnerHTML:{__html:e.value}}),(0,m.jsx)(h,{isChild:!0,toc:e.children,className:n,linkClassName:s})]},e.id)))}):null}const p=s.memo(h);function f(e){let{toc:t,className:n="table-of-contents table-of-contents__left-border",linkClassName:l="table-of-contents__link",linkActiveClassName:c,minHeadingLevel:r,maxHeadingLevel:u,...h}=e;const f=(0,a.p)(),x=r??f.tableOfContents.minHeadingLevel,b=u??f.tableOfContents.maxHeadingLevel,g=function(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return(0,s.useMemo)((()=>i({toc:o(t),minHeadingLevel:n,maxHeadingLevel:a})),[t,n,a])}({toc:t,minHeadingLevel:x,maxHeadingLevel:b});return d((0,s.useMemo)((()=>{if(l&&c)return{linkClassName:l,linkActiveClassName:c,minHeadingLevel:x,maxHeadingLevel:b}}),[l,c,x,b])),(0,m.jsx)(p,{toc:g,className:n,linkClassName:l,...h})}},8426:(e,t)=>{function n(e){let t,n=[];for(let s of e.split(",").map((e=>e.trim())))if(/^-?\d+$/.test(s))n.push(parseInt(s,10));else if(t=s.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[e,s,a,o]=t;if(s&&o){s=parseInt(s),o=parseInt(o);const e=s<o?1:-1;"-"!==a&&".."!==a&&"\u2025"!==a||(o+=e);for(let t=s;t!==o;t+=e)n.push(t)}}return n}t.default=n,e.exports=n},8453:(e,t,n)=>{"use strict";n.d(t,{R:()=>i,x:()=>l});var s=n(6540);const a={},o=s.createContext(a);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/17896441.bc529dae.js b/assets/js/17896441.bc529dae.js new file mode 100644 index 0000000000..687d1229a6 --- /dev/null +++ b/assets/js/17896441.bc529dae.js @@ -0,0 +1 @@ +(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8401],{5744:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>Gt});var s=n(6540),a=n(9024),o=n(9532),i=n(4848);const l=s.createContext(null);function c(e){let{children:t,content:n}=e;const a=function(e){return(0,s.useMemo)((()=>({metadata:e.metadata,frontMatter:e.frontMatter,assets:e.assets,contentTitle:e.contentTitle,toc:e.toc})),[e])}(n);return(0,i.jsx)(l.Provider,{value:a,children:t})}function r(){const e=(0,s.useContext)(l);if(null===e)throw new o.dV("DocProvider");return e}function d(){const{metadata:e,frontMatter:t,assets:n}=r();return(0,i.jsx)(a.be,{title:e.title,description:e.description,keywords:t.keywords,image:n.image??t.image})}var u=n(4164),m=n(4581),h=n(1312),p=n(8774);function f(e){const{permalink:t,title:n,subLabel:s,isNext:a}=e;return(0,i.jsxs)(p.A,{className:(0,u.A)("pagination-nav__link",a?"pagination-nav__link--next":"pagination-nav__link--prev"),to:t,children:[s&&(0,i.jsx)("div",{className:"pagination-nav__sublabel",children:s}),(0,i.jsx)("div",{className:"pagination-nav__label",children:n})]})}function x(e){const{previous:t,next:n}=e;return(0,i.jsxs)("nav",{className:"pagination-nav docusaurus-mt-lg","aria-label":(0,h.T)({id:"theme.docs.paginator.navAriaLabel",message:"Docs pages",description:"The ARIA label for the docs pagination"}),children:[t&&(0,i.jsx)(f,{...t,subLabel:(0,i.jsx)(h.A,{id:"theme.docs.paginator.previous",description:"The label used to navigate to the previous doc",children:"Previous"})}),n&&(0,i.jsx)(f,{...n,subLabel:(0,i.jsx)(h.A,{id:"theme.docs.paginator.next",description:"The label used to navigate to the next doc",children:"Next"}),isNext:!0})]})}function b(){const{metadata:e}=r();return(0,i.jsx)(x,{previous:e.previous,next:e.next})}var g=n(4586),j=n(4070),v=n(7559),N=n(3886),A=n(3025);const C={unreleased:function(e){let{siteTitle:t,versionMetadata:n}=e;return(0,i.jsx)(h.A,{id:"theme.docs.versions.unreleasedVersionLabel",description:"The label used to tell the user that he's browsing an unreleased doc version",values:{siteTitle:t,versionLabel:(0,i.jsx)("b",{children:n.label})},children:"This is unreleased documentation for {siteTitle} {versionLabel} version."})},unmaintained:function(e){let{siteTitle:t,versionMetadata:n}=e;return(0,i.jsx)(h.A,{id:"theme.docs.versions.unmaintainedVersionLabel",description:"The label used to tell the user that he's browsing an unmaintained doc version",values:{siteTitle:t,versionLabel:(0,i.jsx)("b",{children:n.label})},children:"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained."})}};function y(e){const t=C[e.versionMetadata.banner];return(0,i.jsx)(t,{...e})}function k(e){let{versionLabel:t,to:n,onClick:s}=e;return(0,i.jsx)(h.A,{id:"theme.docs.versions.latestVersionSuggestionLabel",description:"The label used to tell the user to check the latest version",values:{versionLabel:t,latestVersionLink:(0,i.jsx)("b",{children:(0,i.jsx)(p.A,{to:n,onClick:s,children:(0,i.jsx)(h.A,{id:"theme.docs.versions.latestVersionLinkLabel",description:"The label used for the latest version suggestion link label",children:"latest version"})})})},children:"For up-to-date documentation, see the {latestVersionLink} ({versionLabel})."})}function L(e){let{className:t,versionMetadata:n}=e;const{siteConfig:{title:s}}=(0,g.A)(),{pluginId:a}=(0,j.vT)({failfast:!0}),{savePreferredVersionName:o}=(0,N.g1)(a),{latestDocSuggestion:l,latestVersionSuggestion:c}=(0,j.HW)(a),r=l??(d=c).docs.find((e=>e.id===d.mainDocId));var d;return(0,i.jsxs)("div",{className:(0,u.A)(t,v.G.docs.docVersionBanner,"alert alert--warning margin-bottom--md"),role:"alert",children:[(0,i.jsx)("div",{children:(0,i.jsx)(y,{siteTitle:s,versionMetadata:n})}),(0,i.jsx)("div",{className:"margin-top--md",children:(0,i.jsx)(k,{versionLabel:c.label,to:r.path,onClick:()=>o(c.name)})})]})}function B(e){let{className:t}=e;const n=(0,A.r)();return n.banner?(0,i.jsx)(L,{className:t,versionMetadata:n}):null}function _(e){let{className:t}=e;const n=(0,A.r)();return n.badge?(0,i.jsx)("span",{className:(0,u.A)(t,v.G.docs.docVersionBadge,"badge badge--secondary"),children:(0,i.jsx)(h.A,{id:"theme.docs.versionBadge.label",values:{versionLabel:n.label},children:"Version: {versionLabel}"})}):null}const w={tag:"tag_zVej",tagRegular:"tagRegular_sFm0",tagWithCount:"tagWithCount_h2kH"};function T(e){let{permalink:t,label:n,count:s,description:a}=e;return(0,i.jsxs)(p.A,{href:t,title:a,className:(0,u.A)(w.tag,s?w.tagWithCount:w.tagRegular),children:[n,s&&(0,i.jsx)("span",{children:s})]})}const E={tags:"tags_jXut",tag:"tag_QGVx"};function H(e){let{tags:t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("b",{children:(0,i.jsx)(h.A,{id:"theme.tags.tagsListLabel",description:"The label alongside a tag list",children:"Tags:"})}),(0,i.jsx)("ul",{className:(0,u.A)(E.tags,"padding--none","margin-left--sm"),children:t.map((e=>(0,i.jsx)("li",{className:E.tag,children:(0,i.jsx)(T,{...e})},e.permalink)))})]})}const M={iconEdit:"iconEdit_Z9Sw"};function I(e){let{className:t,...n}=e;return(0,i.jsx)("svg",{fill:"currentColor",height:"20",width:"20",viewBox:"0 0 40 40",className:(0,u.A)(M.iconEdit,t),"aria-hidden":"true",...n,children:(0,i.jsx)("g",{children:(0,i.jsx)("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"})})})}function S(e){let{editUrl:t}=e;return(0,i.jsxs)(p.A,{to:t,className:v.G.common.editThisPage,children:[(0,i.jsx)(I,{}),(0,i.jsx)(h.A,{id:"theme.common.editThisPage",description:"The link label to edit the current page",children:"Edit this page"})]})}function U(e){void 0===e&&(e={});const{i18n:{currentLocale:t}}=(0,g.A)(),n=function(){const{i18n:{currentLocale:e,localeConfigs:t}}=(0,g.A)();return t[e].calendar}();return new Intl.DateTimeFormat(t,{calendar:n,...e})}function V(e){let{lastUpdatedAt:t}=e;const n=new Date(t),s=U({day:"numeric",month:"short",year:"numeric",timeZone:"UTC"}).format(n);return(0,i.jsx)(h.A,{id:"theme.lastUpdated.atDate",description:"The words used to describe on which date a page has been last updated",values:{date:(0,i.jsx)("b",{children:(0,i.jsx)("time",{dateTime:n.toISOString(),itemProp:"dateModified",children:s})})},children:" on {date}"})}function R(e){let{lastUpdatedBy:t}=e;return(0,i.jsx)(h.A,{id:"theme.lastUpdated.byUser",description:"The words used to describe by who the page has been last updated",values:{user:(0,i.jsx)("b",{children:t})},children:" by {user}"})}function z(e){let{lastUpdatedAt:t,lastUpdatedBy:n}=e;return(0,i.jsxs)("span",{className:v.G.common.lastUpdated,children:[(0,i.jsx)(h.A,{id:"theme.lastUpdated.lastUpdatedAtBy",description:"The sentence used to display when a page has been last updated, and by who",values:{atDate:t?(0,i.jsx)(V,{lastUpdatedAt:t}):"",byUser:n?(0,i.jsx)(R,{lastUpdatedBy:n}):""},children:"Last updated{atDate}{byUser}"}),!1]})}const O={lastUpdated:"lastUpdated_JAkA"};function P(e){let{className:t,editUrl:n,lastUpdatedAt:s,lastUpdatedBy:a}=e;return(0,i.jsxs)("div",{className:(0,u.A)("row",t),children:[(0,i.jsx)("div",{className:"col",children:n&&(0,i.jsx)(S,{editUrl:n})}),(0,i.jsx)("div",{className:(0,u.A)("col",O.lastUpdated),children:(s||a)&&(0,i.jsx)(z,{lastUpdatedAt:s,lastUpdatedBy:a})})]})}function G(){const{metadata:e}=r(),{editUrl:t,lastUpdatedAt:n,lastUpdatedBy:s,tags:a}=e,o=a.length>0,l=!!(t||n||s);return o||l?(0,i.jsxs)("footer",{className:(0,u.A)(v.G.docs.docFooter,"docusaurus-mt-lg"),children:[o&&(0,i.jsx)("div",{className:(0,u.A)("row margin-top--sm",v.G.docs.docFooterTagsRow),children:(0,i.jsx)("div",{className:"col",children:(0,i.jsx)(H,{tags:a})})}),l&&(0,i.jsx)(P,{className:(0,u.A)("margin-top--sm",v.G.docs.docFooterEditMetaRow),editUrl:t,lastUpdatedAt:n,lastUpdatedBy:s})]}):null}var D=n(1422),W=n(5195);const $={tocCollapsibleButton:"tocCollapsibleButton_TO0P",tocCollapsibleButtonExpanded:"tocCollapsibleButtonExpanded_MG3E"};function F(e){let{collapsed:t,...n}=e;return(0,i.jsx)("button",{type:"button",...n,className:(0,u.A)("clean-btn",$.tocCollapsibleButton,!t&&$.tocCollapsibleButtonExpanded,n.className),children:(0,i.jsx)(h.A,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component",children:"On this page"})})}const q={tocCollapsible:"tocCollapsible_ETCw",tocCollapsibleContent:"tocCollapsibleContent_vkbj",tocCollapsibleExpanded:"tocCollapsibleExpanded_sAul"};function Z(e){let{toc:t,className:n,minHeadingLevel:s,maxHeadingLevel:a}=e;const{collapsed:o,toggleCollapsed:l}=(0,D.u)({initialState:!0});return(0,i.jsxs)("div",{className:(0,u.A)(q.tocCollapsible,!o&&q.tocCollapsibleExpanded,n),children:[(0,i.jsx)(F,{collapsed:o,onClick:l}),(0,i.jsx)(D.N,{lazy:!0,className:q.tocCollapsibleContent,collapsed:o,children:(0,i.jsx)(W.A,{toc:t,minHeadingLevel:s,maxHeadingLevel:a})})]})}const J={tocMobile:"tocMobile_ITEo"};function Y(){const{toc:e,frontMatter:t}=r();return(0,i.jsx)(Z,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:(0,u.A)(v.G.docs.docTocMobile,J.tocMobile)})}const K={tableOfContents:"tableOfContents_bqdL",docItemContainer:"docItemContainer_F8PC"},Q="table-of-contents__link toc-highlight",X="table-of-contents__link--active";function ee(e){let{className:t,...n}=e;return(0,i.jsx)("div",{className:(0,u.A)(K.tableOfContents,"thin-scrollbar",t),children:(0,i.jsx)(W.A,{...n,linkClassName:Q,linkActiveClassName:X})})}function te(){const{toc:e,frontMatter:t}=r();return(0,i.jsx)(ee,{toc:e,minHeadingLevel:t.toc_min_heading_level,maxHeadingLevel:t.toc_max_heading_level,className:v.G.docs.docTocDesktop})}var ne=n(1107),se=n(8453),ae=n(5260),oe=n(2303),ie=n(5293),le=n(6342);function ce(){const{prism:e}=(0,le.p)(),{colorMode:t}=(0,ie.G)(),n=e.theme,s=e.darkTheme||n;return"dark"===t?s:n}var re=n(8426),de=n.n(re);const ue=/title=(?<quote>["'])(?<title>.*?)\1/,me=/\{(?<range>[\d,-]+)\}/,he={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},pe={...he,lua:{start:"--",end:""},wasm:{start:"\\;\\;",end:""},tex:{start:"%",end:""},vb:{start:"['\u2018\u2019]",end:""},vbnet:{start:"(?:_\\s*)?['\u2018\u2019]",end:""},rem:{start:"[Rr][Ee][Mm]\\b",end:""},f90:{start:"!",end:""},ml:{start:"\\(\\*",end:"\\*\\)"},cobol:{start:"\\*>",end:""}},fe=Object.keys(he);function xe(e,t){const n=e.map((e=>{const{start:n,end:s}=pe[e];return`(?:${n}\\s*(${t.flatMap((e=>[e.line,e.block?.start,e.block?.end].filter(Boolean))).join("|")})\\s*${s})`})).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function be(e,t){let n=e.replace(/\n$/,"");const{language:s,magicComments:a,metastring:o}=t;if(o&&me.test(o)){const e=o.match(me).groups.range;if(0===a.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${o}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const t=a[0].className,s=de()(e).filter((e=>e>0)).map((e=>[e-1,[t]]));return{lineClassNames:Object.fromEntries(s),code:n}}if(void 0===s)return{lineClassNames:{},code:n};const i=function(e,t){switch(e){case"js":case"javascript":case"ts":case"typescript":return xe(["js","jsBlock"],t);case"jsx":case"tsx":return xe(["js","jsBlock","jsx"],t);case"html":return xe(["js","jsBlock","html"],t);case"python":case"py":case"bash":return xe(["bash"],t);case"markdown":case"md":return xe(["html","jsx","bash"],t);case"tex":case"latex":case"matlab":return xe(["tex"],t);case"lua":case"haskell":return xe(["lua"],t);case"sql":return xe(["lua","jsBlock"],t);case"wasm":return xe(["wasm"],t);case"vb":case"vba":case"visual-basic":return xe(["vb","rem"],t);case"vbnet":return xe(["vbnet","rem"],t);case"batch":return xe(["rem"],t);case"basic":return xe(["rem","f90"],t);case"fsharp":return xe(["js","ml"],t);case"ocaml":case"sml":return xe(["ml"],t);case"fortran":return xe(["f90"],t);case"cobol":return xe(["cobol"],t);default:return xe(fe,t)}}(s,a),l=n.split("\n"),c=Object.fromEntries(a.map((e=>[e.className,{start:0,range:""}]))),r=Object.fromEntries(a.filter((e=>e.line)).map((e=>{let{className:t,line:n}=e;return[n,t]}))),d=Object.fromEntries(a.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.start,t]}))),u=Object.fromEntries(a.filter((e=>e.block)).map((e=>{let{className:t,block:n}=e;return[n.end,t]})));for(let h=0;h<l.length;){const e=l[h].match(i);if(!e){h+=1;continue}const t=e.slice(1).find((e=>void 0!==e));r[t]?c[r[t]].range+=`${h},`:d[t]?c[d[t]].start=h:u[t]&&(c[u[t]].range+=`${c[u[t]].start}-${h-1},`),l.splice(h,1)}n=l.join("\n");const m={};return Object.entries(c).forEach((e=>{let[t,{range:n}]=e;de()(n).forEach((e=>{m[e]??=[],m[e].push(t)}))})),{lineClassNames:m,code:n}}const ge={codeBlockContainer:"codeBlockContainer_Ckt0"};function je(e){let{as:t,...n}=e;const s=function(e){const t={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(e.plain).forEach((e=>{let[s,a]=e;const o=t[s];o&&"string"==typeof a&&(n[o]=a)})),n}(ce());return(0,i.jsx)(t,{...n,style:s,className:(0,u.A)(n.className,ge.codeBlockContainer,v.G.common.codeBlock)})}const ve={codeBlockContent:"codeBlockContent_biex",codeBlockTitle:"codeBlockTitle_Ktv7",codeBlock:"codeBlock_bY9V",codeBlockStandalone:"codeBlockStandalone_MEMb",codeBlockLines:"codeBlockLines_e6Vv",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_o6Pm",buttonGroup:"buttonGroup__atx"};function Ne(e){let{children:t,className:n}=e;return(0,i.jsx)(je,{as:"pre",tabIndex:0,className:(0,u.A)(ve.codeBlockStandalone,"thin-scrollbar",n),children:(0,i.jsx)("code",{className:ve.codeBlockLines,children:t})})}const Ae={attributes:!0,characterData:!0,childList:!0,subtree:!0};function Ce(e,t){const[n,a]=(0,s.useState)(),i=(0,s.useCallback)((()=>{a(e.current?.closest("[role=tabpanel][hidden]"))}),[e,a]);(0,s.useEffect)((()=>{i()}),[i]),function(e,t,n){void 0===n&&(n=Ae);const a=(0,o._q)(t),i=(0,o.Be)(n);(0,s.useEffect)((()=>{const t=new MutationObserver(a);return e&&t.observe(e,i),()=>t.disconnect()}),[e,a,i])}(n,(e=>{e.forEach((e=>{"attributes"===e.type&&"hidden"===e.attributeName&&(t(),i())}))}),{attributes:!0,characterData:!1,childList:!1,subtree:!1})}var ye=n(1765);const ke={codeLine:"codeLine_lJS_",codeLineNumber:"codeLineNumber_Tfdd",codeLineContent:"codeLineContent_feaV"};function Le(e){let{line:t,classNames:n,showLineNumbers:s,getLineProps:a,getTokenProps:o}=e;1===t.length&&"\n"===t[0].content&&(t[0].content="");const l=a({line:t,className:(0,u.A)(n,s&&ke.codeLine)}),c=t.map(((e,t)=>(0,i.jsx)("span",{...o({token:e})},t)));return(0,i.jsxs)("span",{...l,children:[s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:ke.codeLineNumber}),(0,i.jsx)("span",{className:ke.codeLineContent,children:c})]}):c,(0,i.jsx)("br",{})]})}function Be(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"})})}function _e(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})}const we={copyButtonCopied:"copyButtonCopied_obH4",copyButtonIcons:"copyButtonIcons_eSgA",copyButtonIcon:"copyButtonIcon_y97N",copyButtonSuccessIcon:"copyButtonSuccessIcon_LjdS"};function Te(e){let{code:t,className:n}=e;const[a,o]=(0,s.useState)(!1),l=(0,s.useRef)(void 0),c=(0,s.useCallback)((()=>{!function(e,t){let{target:n=document.body}=void 0===t?{}:t;if("string"!=typeof e)throw new TypeError(`Expected parameter \`text\` to be a \`string\`, got \`${typeof e}\`.`);const s=document.createElement("textarea"),a=document.activeElement;s.value=e,s.setAttribute("readonly",""),s.style.contain="strict",s.style.position="absolute",s.style.left="-9999px",s.style.fontSize="12pt";const o=document.getSelection(),i=o.rangeCount>0&&o.getRangeAt(0);n.append(s),s.select(),s.selectionStart=0,s.selectionEnd=e.length;let l=!1;try{l=document.execCommand("copy")}catch{}s.remove(),i&&(o.removeAllRanges(),o.addRange(i)),a&&a.focus()}(t),o(!0),l.current=window.setTimeout((()=>{o(!1)}),1e3)}),[t]);return(0,s.useEffect)((()=>()=>window.clearTimeout(l.current)),[]),(0,i.jsx)("button",{type:"button","aria-label":a?(0,h.T)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,h.T)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,h.T)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,u.A)("clean-btn",n,we.copyButton,a&&we.copyButtonCopied),onClick:c,children:(0,i.jsxs)("span",{className:we.copyButtonIcons,"aria-hidden":"true",children:[(0,i.jsx)(Be,{className:we.copyButtonIcon}),(0,i.jsx)(_e,{className:we.copyButtonSuccessIcon})]})})}function Ee(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{fill:"currentColor",d:"M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"})})}const He={wordWrapButtonIcon:"wordWrapButtonIcon_Bwma",wordWrapButtonEnabled:"wordWrapButtonEnabled_EoeP"};function Me(e){let{className:t,onClick:n,isEnabled:s}=e;const a=(0,h.T)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return(0,i.jsx)("button",{type:"button",onClick:n,className:(0,u.A)("clean-btn",t,s&&He.wordWrapButtonEnabled),"aria-label":a,title:a,children:(0,i.jsx)(Ee,{className:He.wordWrapButtonIcon,"aria-hidden":"true"})})}function Ie(e){let{children:t,className:n="",metastring:a,title:o,showLineNumbers:l,language:c}=e;const{prism:{defaultLanguage:r,magicComments:d}}=(0,le.p)(),m=function(e){return e?.toLowerCase()}(c??function(e){const t=e.split(" ").find((e=>e.startsWith("language-")));return t?.replace(/language-/,"")}(n)??r),h=ce(),p=function(){const[e,t]=(0,s.useState)(!1),[n,a]=(0,s.useState)(!1),o=(0,s.useRef)(null),i=(0,s.useCallback)((()=>{const n=o.current.querySelector("code");e?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),t((e=>!e))}),[o,e]),l=(0,s.useCallback)((()=>{const{scrollWidth:e,clientWidth:t}=o.current,n=e>t||o.current.querySelector("code").hasAttribute("style");a(n)}),[o]);return Ce(o,l),(0,s.useEffect)((()=>{l()}),[e,l]),(0,s.useEffect)((()=>(window.addEventListener("resize",l,{passive:!0}),()=>{window.removeEventListener("resize",l)})),[l]),{codeBlockRef:o,isEnabled:e,isCodeScrollable:n,toggle:i}}(),f=function(e){return e?.match(ue)?.groups.title??""}(a)||o,{lineClassNames:x,code:b}=be(t,{metastring:a,language:m,magicComments:d}),g=l??function(e){return Boolean(e?.includes("showLineNumbers"))}(a);return(0,i.jsxs)(je,{as:"div",className:(0,u.A)(n,m&&!n.includes(`language-${m}`)&&`language-${m}`),children:[f&&(0,i.jsx)("div",{className:ve.codeBlockTitle,children:f}),(0,i.jsxs)("div",{className:ve.codeBlockContent,children:[(0,i.jsx)(ye.f4,{theme:h,code:b,language:m??"text",children:e=>{let{className:t,style:n,tokens:s,getLineProps:a,getTokenProps:o}=e;return(0,i.jsx)("pre",{tabIndex:0,ref:p.codeBlockRef,className:(0,u.A)(t,ve.codeBlock,"thin-scrollbar"),style:n,children:(0,i.jsx)("code",{className:(0,u.A)(ve.codeBlockLines,g&&ve.codeBlockLinesWithNumbering),children:s.map(((e,t)=>(0,i.jsx)(Le,{line:e,getLineProps:a,getTokenProps:o,classNames:x[t],showLineNumbers:g},t)))})})}}),(0,i.jsxs)("div",{className:ve.buttonGroup,children:[(p.isEnabled||p.isCodeScrollable)&&(0,i.jsx)(Me,{className:ve.codeButton,onClick:()=>p.toggle(),isEnabled:p.isEnabled}),(0,i.jsx)(Te,{className:ve.codeButton,code:b})]})]})]})}function Se(e){let{children:t,...n}=e;const a=(0,oe.A)(),o=function(e){return s.Children.toArray(e).some((e=>(0,s.isValidElement)(e)))?e:Array.isArray(e)?e.join(""):e}(t),l="string"==typeof o?Ie:Ne;return(0,i.jsx)(l,{...n,children:o},String(a))}function Ue(e){return(0,i.jsx)("code",{...e})}var Ve=n(3427);const Re={details:"details_lb9f",isBrowser:"isBrowser_bmU9",collapsibleContent:"collapsibleContent_i85q"};function ze(e){return!!e&&("SUMMARY"===e.tagName||ze(e.parentElement))}function Oe(e,t){return!!e&&(e===t||Oe(e.parentElement,t))}function Pe(e){let{summary:t,children:n,...a}=e;(0,Ve.A)().collectAnchor(a.id);const o=(0,oe.A)(),l=(0,s.useRef)(null),{collapsed:c,setCollapsed:r}=(0,D.u)({initialState:!a.open}),[d,m]=(0,s.useState)(a.open),h=s.isValidElement(t)?t:(0,i.jsx)("summary",{children:t??"Details"});return(0,i.jsxs)("details",{...a,ref:l,open:d,"data-collapsed":c,className:(0,u.A)(Re.details,o&&Re.isBrowser,a.className),onMouseDown:e=>{ze(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const t=e.target;ze(t)&&Oe(t,l.current)&&(e.preventDefault(),c?(r(!1),m(!0)):r(!0))},children:[h,(0,i.jsx)(D.N,{lazy:!1,collapsed:c,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{r(e),m(!e)},children:(0,i.jsx)("div",{className:Re.collapsibleContent,children:n})})]})}const Ge={details:"details_b_Ee"},De="alert alert--info";function We(e){let{...t}=e;return(0,i.jsx)(Pe,{...t,className:(0,u.A)(De,Ge.details,t.className)})}function $e(e){const t=s.Children.toArray(e.children),n=t.find((e=>s.isValidElement(e)&&"summary"===e.type)),a=(0,i.jsx)(i.Fragment,{children:t.filter((e=>e!==n))});return(0,i.jsx)(We,{...e,summary:n,children:a})}function Fe(e){return(0,i.jsx)(ne.A,{...e})}const qe={containsTaskList:"containsTaskList_mC6p"};function Ze(e){if(void 0!==e)return(0,u.A)(e,e?.includes("contains-task-list")&&qe.containsTaskList)}const Je={img:"img_ev3q"};function Ye(e){const{mdxAdmonitionTitle:t,rest:n}=function(e){const t=s.Children.toArray(e),n=t.find((e=>s.isValidElement(e)&&"mdxAdmonitionTitle"===e.type)),a=t.filter((e=>e!==n)),o=n?.props.children;return{mdxAdmonitionTitle:o,rest:a.length>0?(0,i.jsx)(i.Fragment,{children:a}):null}}(e.children),a=e.title??t;return{...e,...a&&{title:a},children:n}}const Ke={admonition:"admonition_xJq3",admonitionHeading:"admonitionHeading_Gvgb",admonitionIcon:"admonitionIcon_Rf37",admonitionContent:"admonitionContent_BuS1"};function Qe(e){let{type:t,className:n,children:s}=e;return(0,i.jsx)("div",{className:(0,u.A)(v.G.common.admonition,v.G.common.admonitionType(t),Ke.admonition,n),children:s})}function Xe(e){let{icon:t,title:n}=e;return(0,i.jsxs)("div",{className:Ke.admonitionHeading,children:[(0,i.jsx)("span",{className:Ke.admonitionIcon,children:t}),n]})}function et(e){let{children:t}=e;return t?(0,i.jsx)("div",{className:Ke.admonitionContent,children:t}):null}function tt(e){const{type:t,icon:n,title:s,children:a,className:o}=e;return(0,i.jsxs)(Qe,{type:t,className:o,children:[s||n?(0,i.jsx)(Xe,{title:s,icon:n}):null,(0,i.jsx)(et,{children:a})]})}function nt(e){return(0,i.jsx)("svg",{viewBox:"0 0 14 16",...e,children:(0,i.jsx)("path",{fillRule:"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"})})}const st={icon:(0,i.jsx)(nt,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.note",description:"The default label used for the Note admonition (:::note)",children:"note"})};function at(e){return(0,i.jsx)(tt,{...st,...e,className:(0,u.A)("alert alert--secondary",e.className),children:e.children})}function ot(e){return(0,i.jsx)("svg",{viewBox:"0 0 12 16",...e,children:(0,i.jsx)("path",{fillRule:"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"})})}const it={icon:(0,i.jsx)(ot,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.tip",description:"The default label used for the Tip admonition (:::tip)",children:"tip"})};function lt(e){return(0,i.jsx)(tt,{...it,...e,className:(0,u.A)("alert alert--success",e.className),children:e.children})}function ct(e){return(0,i.jsx)("svg",{viewBox:"0 0 14 16",...e,children:(0,i.jsx)("path",{fillRule:"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"})})}const rt={icon:(0,i.jsx)(ct,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.info",description:"The default label used for the Info admonition (:::info)",children:"info"})};function dt(e){return(0,i.jsx)(tt,{...rt,...e,className:(0,u.A)("alert alert--info",e.className),children:e.children})}function ut(e){return(0,i.jsx)("svg",{viewBox:"0 0 16 16",...e,children:(0,i.jsx)("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})})}const mt={icon:(0,i.jsx)(ut,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.warning",description:"The default label used for the Warning admonition (:::warning)",children:"warning"})};function ht(e){return(0,i.jsx)("svg",{viewBox:"0 0 12 16",...e,children:(0,i.jsx)("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})})}const pt={icon:(0,i.jsx)(ht,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.danger",description:"The default label used for the Danger admonition (:::danger)",children:"danger"})};const ft={icon:(0,i.jsx)(ut,{}),title:(0,i.jsx)(h.A,{id:"theme.admonition.caution",description:"The default label used for the Caution admonition (:::caution)",children:"caution"})};const xt={...{note:at,tip:lt,info:dt,warning:function(e){return(0,i.jsx)(tt,{...mt,...e,className:(0,u.A)("alert alert--warning",e.className),children:e.children})},danger:function(e){return(0,i.jsx)(tt,{...pt,...e,className:(0,u.A)("alert alert--danger",e.className),children:e.children})}},...{secondary:e=>(0,i.jsx)(at,{title:"secondary",...e}),important:e=>(0,i.jsx)(dt,{title:"important",...e}),success:e=>(0,i.jsx)(lt,{title:"success",...e}),caution:function(e){return(0,i.jsx)(tt,{...ft,...e,className:(0,u.A)("alert alert--warning",e.className),children:e.children})}}};function bt(e){const t=Ye(e),n=(s=t.type,xt[s]||(console.warn(`No admonition component found for admonition type "${s}". Using Info as fallback.`),xt.info));var s;return(0,i.jsx)(n,{...t})}const gt={Head:ae.A,details:$e,Details:$e,code:function(e){return function(e){return void 0!==e.children&&s.Children.toArray(e.children).every((e=>"string"==typeof e&&!e.includes("\n")))}(e)?(0,i.jsx)(Ue,{...e}):(0,i.jsx)(Se,{...e})},a:function(e){return(0,i.jsx)(p.A,{...e})},pre:function(e){return(0,i.jsx)(i.Fragment,{children:e.children})},ul:function(e){return(0,i.jsx)("ul",{...e,className:Ze(e.className)})},li:function(e){return(0,Ve.A)().collectAnchor(e.id),(0,i.jsx)("li",{...e})},img:function(e){return(0,i.jsx)("img",{decoding:"async",loading:"lazy",...e,className:(t=e.className,(0,u.A)(t,Je.img))});var t},h1:e=>(0,i.jsx)(Fe,{as:"h1",...e}),h2:e=>(0,i.jsx)(Fe,{as:"h2",...e}),h3:e=>(0,i.jsx)(Fe,{as:"h3",...e}),h4:e=>(0,i.jsx)(Fe,{as:"h4",...e}),h5:e=>(0,i.jsx)(Fe,{as:"h5",...e}),h6:e=>(0,i.jsx)(Fe,{as:"h6",...e}),admonition:bt,mermaid:()=>null};function jt(e){let{children:t}=e;return(0,i.jsx)(se.x,{components:gt,children:t})}function vt(e){let{children:t}=e;const n=function(){const{metadata:e,frontMatter:t,contentTitle:n}=r();return t.hide_title||void 0!==n?null:e.title}();return(0,i.jsxs)("div",{className:(0,u.A)(v.G.docs.docMarkdown,"markdown"),children:[n&&(0,i.jsx)("header",{children:(0,i.jsx)(ne.A,{as:"h1",children:n})}),(0,i.jsx)(jt,{children:t})]})}var Nt=n(6972),At=n(9169),Ct=n(6025);function yt(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,i.jsx)("path",{d:"M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z",fill:"currentColor"})})}const kt={breadcrumbHomeIcon:"breadcrumbHomeIcon_YNFT"};function Lt(){const e=(0,Ct.Ay)("/");return(0,i.jsx)("li",{className:"breadcrumbs__item",children:(0,i.jsx)(p.A,{"aria-label":(0,h.T)({id:"theme.docs.breadcrumbs.home",message:"Home page",description:"The ARIA label for the home page in the breadcrumbs"}),className:"breadcrumbs__link",href:e,children:(0,i.jsx)(yt,{className:kt.breadcrumbHomeIcon})})})}const Bt={breadcrumbsContainer:"breadcrumbsContainer_Z_bl"};function _t(e){let{children:t,href:n,isLast:s}=e;const a="breadcrumbs__link";return s?(0,i.jsx)("span",{className:a,itemProp:"name",children:t}):n?(0,i.jsx)(p.A,{className:a,href:n,itemProp:"item",children:(0,i.jsx)("span",{itemProp:"name",children:t})}):(0,i.jsx)("span",{className:a,children:t})}function wt(e){let{children:t,active:n,index:s,addMicrodata:a}=e;return(0,i.jsxs)("li",{...a&&{itemScope:!0,itemProp:"itemListElement",itemType:"https://schema.org/ListItem"},className:(0,u.A)("breadcrumbs__item",{"breadcrumbs__item--active":n}),children:[t,(0,i.jsx)("meta",{itemProp:"position",content:String(s+1)})]})}function Tt(){const e=(0,Nt.OF)(),t=(0,At.Dt)();return e?(0,i.jsx)("nav",{className:(0,u.A)(v.G.docs.docBreadcrumbs,Bt.breadcrumbsContainer),"aria-label":(0,h.T)({id:"theme.docs.breadcrumbs.navAriaLabel",message:"Breadcrumbs",description:"The ARIA label for the breadcrumbs"}),children:(0,i.jsxs)("ul",{className:"breadcrumbs",itemScope:!0,itemType:"https://schema.org/BreadcrumbList",children:[t&&(0,i.jsx)(Lt,{}),e.map(((t,n)=>{const s=n===e.length-1,a="category"===t.type&&t.linkUnlisted?void 0:t.href;return(0,i.jsx)(wt,{active:s,index:n,addMicrodata:!!a,children:(0,i.jsx)(_t,{href:a,isLast:s,children:t.label})},n)}))]})}):null}function Et(){return(0,i.jsx)(h.A,{id:"theme.contentVisibility.unlistedBanner.title",description:"The unlisted content banner title",children:"Unlisted page"})}function Ht(){return(0,i.jsx)(h.A,{id:"theme.contentVisibility.unlistedBanner.message",description:"The unlisted content banner message",children:"This page is unlisted. Search engines will not index it, and only users having a direct link can access it."})}function Mt(){return(0,i.jsx)(ae.A,{children:(0,i.jsx)("meta",{name:"robots",content:"noindex, nofollow"})})}function It(){return(0,i.jsx)(h.A,{id:"theme.contentVisibility.draftBanner.title",description:"The draft content banner title",children:"Draft page"})}function St(){return(0,i.jsx)(h.A,{id:"theme.contentVisibility.draftBanner.message",description:"The draft content banner message",children:"This page is a draft. It will only be visible in dev and be excluded from the production build."})}function Ut(e){let{className:t}=e;return(0,i.jsx)(bt,{type:"caution",title:(0,i.jsx)(It,{}),className:(0,u.A)(t,v.G.common.draftBanner),children:(0,i.jsx)(St,{})})}function Vt(e){let{className:t}=e;return(0,i.jsx)(bt,{type:"caution",title:(0,i.jsx)(Et,{}),className:(0,u.A)(t,v.G.common.unlistedBanner),children:(0,i.jsx)(Ht,{})})}function Rt(e){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Mt,{}),(0,i.jsx)(Vt,{...e})]})}function zt(e){let{metadata:t}=e;const{unlisted:n,frontMatter:s}=t;return(0,i.jsxs)(i.Fragment,{children:[(n||s.unlisted)&&(0,i.jsx)(Rt,{}),s.draft&&(0,i.jsx)(Ut,{})]})}const Ot={docItemContainer:"docItemContainer_Djhp",docItemCol:"docItemCol_VOVn"};function Pt(e){let{children:t}=e;const n=function(){const{frontMatter:e,toc:t}=r(),n=(0,m.l)(),s=e.hide_table_of_contents,a=!s&&t.length>0;return{hidden:s,mobile:a?(0,i.jsx)(Y,{}):void 0,desktop:!a||"desktop"!==n&&"ssr"!==n?void 0:(0,i.jsx)(te,{})}}(),{metadata:s}=r();return(0,i.jsxs)("div",{className:"row",children:[(0,i.jsxs)("div",{className:(0,u.A)("col",!n.hidden&&Ot.docItemCol),children:[(0,i.jsx)(zt,{metadata:s}),(0,i.jsx)(B,{}),(0,i.jsxs)("div",{className:Ot.docItemContainer,children:[(0,i.jsxs)("article",{children:[(0,i.jsx)(Tt,{}),(0,i.jsx)(_,{}),n.mobile,(0,i.jsx)(vt,{children:t}),(0,i.jsx)(G,{})]}),(0,i.jsx)(b,{})]})]}),n.desktop&&(0,i.jsx)("div",{className:"col col--3",children:n.desktop})]})}function Gt(e){const t=`docs-doc-id-${e.content.metadata.id}`,n=e.content;return(0,i.jsx)(c,{content:e.content,children:(0,i.jsxs)(a.e3,{className:t,children:[(0,i.jsx)(d,{}),(0,i.jsx)(Pt,{children:(0,i.jsx)(n,{})})]})})}},5195:(e,t,n)=>{"use strict";n.d(t,{A:()=>f});var s=n(6540),a=n(6342);function o(e){const t=e.map((e=>({...e,parentIndex:-1,children:[]}))),n=Array(7).fill(-1);t.forEach(((e,t)=>{const s=n.slice(2,e.level);e.parentIndex=Math.max(...s),n[e.level]=t}));const s=[];return t.forEach((e=>{const{parentIndex:n,...a}=e;n>=0?t[n].children.push(a):s.push(a)})),s}function i(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:s}=e;return t.flatMap((e=>{const t=i({toc:e.children,minHeadingLevel:n,maxHeadingLevel:s});return function(e){return e.level>=n&&e.level<=s}(e)?[{...e,children:t}]:t}))}function l(e){const t=e.getBoundingClientRect();return t.top===t.bottom?l(e.parentNode):t}function c(e,t){let{anchorTopOffset:n}=t;const s=e.find((e=>l(e).top>=n));if(s){return function(e){return e.top>0&&e.bottom<window.innerHeight/2}(l(s))?s:e[e.indexOf(s)-1]??null}return e[e.length-1]??null}function r(){const e=(0,s.useRef)(0),{navbar:{hideOnScroll:t}}=(0,a.p)();return(0,s.useEffect)((()=>{e.current=t?0:document.querySelector(".navbar").clientHeight}),[t]),e}function d(e){const t=(0,s.useRef)(void 0),n=r();(0,s.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:s,linkActiveClassName:a,minHeadingLevel:o,maxHeadingLevel:i}=e;function l(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(s),l=function(e){let{minHeadingLevel:t,maxHeadingLevel:n}=e;const s=[];for(let a=t;a<=n;a+=1)s.push(`h${a}.anchor`);return Array.from(document.querySelectorAll(s.join()))}({minHeadingLevel:o,maxHeadingLevel:i}),r=c(l,{anchorTopOffset:n.current}),d=e.find((e=>r&&r.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,n){n?(t.current&&t.current!==e&&t.current.classList.remove(a),e.classList.add(a),t.current=e):e.classList.remove(a)}(e,e===d)}))}return document.addEventListener("scroll",l),document.addEventListener("resize",l),l(),()=>{document.removeEventListener("scroll",l),document.removeEventListener("resize",l)}}),[e,n])}var u=n(8774),m=n(4848);function h(e){let{toc:t,className:n,linkClassName:s,isChild:a}=e;return t.length?(0,m.jsx)("ul",{className:a?void 0:n,children:t.map((e=>(0,m.jsxs)("li",{children:[(0,m.jsx)(u.A,{to:`#${e.id}`,className:s??void 0,dangerouslySetInnerHTML:{__html:e.value}}),(0,m.jsx)(h,{isChild:!0,toc:e.children,className:n,linkClassName:s})]},e.id)))}):null}const p=s.memo(h);function f(e){let{toc:t,className:n="table-of-contents table-of-contents__left-border",linkClassName:l="table-of-contents__link",linkActiveClassName:c,minHeadingLevel:r,maxHeadingLevel:u,...h}=e;const f=(0,a.p)(),x=r??f.tableOfContents.minHeadingLevel,b=u??f.tableOfContents.maxHeadingLevel,g=function(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return(0,s.useMemo)((()=>i({toc:o(t),minHeadingLevel:n,maxHeadingLevel:a})),[t,n,a])}({toc:t,minHeadingLevel:x,maxHeadingLevel:b});return d((0,s.useMemo)((()=>{if(l&&c)return{linkClassName:l,linkActiveClassName:c,minHeadingLevel:x,maxHeadingLevel:b}}),[l,c,x,b])),(0,m.jsx)(p,{toc:g,className:n,linkClassName:l,...h})}},8426:(e,t)=>{function n(e){let t,n=[];for(let s of e.split(",").map((e=>e.trim())))if(/^-?\d+$/.test(s))n.push(parseInt(s,10));else if(t=s.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[e,s,a,o]=t;if(s&&o){s=parseInt(s),o=parseInt(o);const e=s<o?1:-1;"-"!==a&&".."!==a&&"\u2025"!==a||(o+=e);for(let t=s;t!==o;t+=e)n.push(t)}}return n}t.default=n,e.exports=n},8453:(e,t,n)=>{"use strict";n.d(t,{R:()=>i,x:()=>l});var s=n(6540);const a={},o=s.createContext(a);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1a421168.08e719a3.js b/assets/js/1a421168.08e719a3.js deleted file mode 100644 index d023da3aeb..0000000000 --- a/assets/js/1a421168.08e719a3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9631],{4807:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>j,frontMatter:()=>c,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"In Jest, a test environment defines the sandbox context in which your tests run.","source":"@site/docs/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/next/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/getting-started/test-environment.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/next/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/next/guides/angular-ivy"}}');var i=n(4848),r=n(8453),o=n(9489),l=n(7227),a=n(1574);const c={id:"test-environment",title:"Test environment"},p=void 0,d={},u=[{value:"Functions",id:"functions",level:2},{value:"<code>setupZoneTestEnv(options)</code>",id:"setupzonetestenvoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Example:",id:"example",level:4},{value:"<code>setupZonelessTestEnv(options)</code>",id:"setupzonelesstestenvoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Example:",id:"example-1",level:4}];function h(e){const t={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.p,{children:"In Jest, a test environment defines the sandbox context in which your tests run.\nFor Angular projects, setting up the correct test environment is essential to ensure compatibility with the\nframework-specific features, such as dependency injection and change detection."}),"\n",(0,i.jsxs)(t.p,{children:[(0,i.jsx)(t.code,{children:"jest-preset-angular"})," provides utility functions to simplify setting up a Jest test environment tailored for Angular projects.\nThese functions support both ",(0,i.jsx)(t.strong,{children:"zone-based"})," and ",(0,i.jsx)(t.strong,{children:"zoneless"})," environments, catering to different testing needs."]}),"\n",(0,i.jsx)(t.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,i.jsx)(a.A,{toc:u.slice(1)}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h3,{id:"setupzonetestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZoneTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that uses ",(0,i.jsx)(t.code,{children:"zone.js"}),", which is the mechanism for tracking asynchronous operations.\nIt is suitable for most Angular applications that rely on ",(0,i.jsx)(t.code,{children:"zone.js"})," for change detection and other framework features."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(t.h3,{id:"setupzonelesstestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZonelessTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that ",(0,i.jsx)(t.strong,{children:"DOESN'T"})," use ",(0,i.jsx)(t.code,{children:"zone.js"}),", as described in ",(0,i.jsx)(t.a,{href:"https://angular.dev/guide/experimental/zoneless",children:"Angular experimental zoneless guide"}),".\nIt is designed for projects that have disabled ",(0,i.jsx)(t.code,{children:"zone.js"}),", which can lead to improved performance and simplified testing."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example-1",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless/index.mjs';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}}}]); \ No newline at end of file diff --git a/assets/js/1a421168.f7ed44e7.js b/assets/js/1a421168.f7ed44e7.js new file mode 100644 index 0000000000..d75210f27a --- /dev/null +++ b/assets/js/1a421168.f7ed44e7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9631],{7723:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>j,frontMatter:()=>c,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"In Jest, a test environment defines the sandbox context in which your tests run.","source":"@site/docs/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/next/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/getting-started/test-environment.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/next/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/next/guides/angular-ivy"}}');var i=n(4848),r=n(8453),o=n(1470),l=n(9365),a=n(4252);const c={id:"test-environment",title:"Test environment"},p=void 0,d={},u=[{value:"Functions",id:"functions",level:2},{value:"<code>setupZoneTestEnv(options)</code>",id:"setupzonetestenvoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Example:",id:"example",level:4},{value:"<code>setupZonelessTestEnv(options)</code>",id:"setupzonelesstestenvoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Example:",id:"example-1",level:4}];function h(e){const t={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.p,{children:"In Jest, a test environment defines the sandbox context in which your tests run.\nFor Angular projects, setting up the correct test environment is essential to ensure compatibility with the\nframework-specific features, such as dependency injection and change detection."}),"\n",(0,i.jsxs)(t.p,{children:[(0,i.jsx)(t.code,{children:"jest-preset-angular"})," provides utility functions to simplify setting up a Jest test environment tailored for Angular projects.\nThese functions support both ",(0,i.jsx)(t.strong,{children:"zone-based"})," and ",(0,i.jsx)(t.strong,{children:"zoneless"})," environments, catering to different testing needs."]}),"\n",(0,i.jsx)(t.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,i.jsx)(a.A,{toc:u.slice(1)}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h3,{id:"setupzonetestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZoneTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that uses ",(0,i.jsx)(t.code,{children:"zone.js"}),", which is the mechanism for tracking asynchronous operations.\nIt is suitable for most Angular applications that rely on ",(0,i.jsx)(t.code,{children:"zone.js"})," for change detection and other framework features."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(t.h3,{id:"setupzonelesstestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZonelessTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that ",(0,i.jsx)(t.strong,{children:"DOESN'T"})," use ",(0,i.jsx)(t.code,{children:"zone.js"}),", as described in ",(0,i.jsx)(t.a,{href:"https://angular.dev/guide/experimental/zoneless",children:"Angular experimental zoneless guide"}),".\nIt is designed for projects that have disabled ",(0,i.jsx)(t.code,{children:"zone.js"}),", which can lead to improved performance and simplified testing."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example-1",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless/index.mjs';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.0f622ad9.js b/assets/js/1a4e3797.0f622ad9.js new file mode 100644 index 0000000000..5a977c5a3a --- /dev/null +++ b/assets/js/1a4e3797.0f622ad9.js @@ -0,0 +1 @@ +(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2138],{2733:e=>{function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function n(e){return void 0===e}e.exports=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,s,a,c,o,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(n(s=this._events[e]))return!1;if(r(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:c=Array.prototype.slice.call(arguments,1),s.apply(this,c)}else if(i(s))for(c=Array.prototype.slice.call(arguments,1),a=(u=s.slice()).length,o=0;o<a;o++)u[o].apply(this,c);return!0},t.prototype.addListener=function(e,s){var a;if(!r(s))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(s.listener)?s.listener:s),this._events[e]?i(this._events[e])?this._events[e].push(s):this._events[e]=[this._events[e],s]:this._events[e]=s,i(this._events[e])&&!this._events[e].warned&&(a=n(this._maxListeners)?t.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var i=!1;function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}return n.listener=t,this.on(e,n),this},t.prototype.removeListener=function(e,t){var n,s,a,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,s=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(c=a;c-- >0;)if(n[c]===t||n[c].listener&&n[c].listener===t){s=c;break}if(s<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(i=this._events[e]))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},4103:(e,t,r)=>{"use strict";var i=r(6571),n=r(9127),s=r(2223),a=r(3371),c=r(7691);function o(e,t,r,n){return new i(e,t,r,n)}o.version=r(6938),o.AlgoliaSearchHelper=i,o.SearchParameters=a,o.RecommendParameters=n,o.SearchResults=c,o.RecommendResults=s,e.exports=o},6732:(e,t,r)=>{"use strict";var i=r(2733);function n(e,t,r){this.main=e,this.fn=t,this.recommendFn=r,this.lastResults=null,this.lastRecommendResults=null}r(3014)(n,i),n.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},n.prototype.getModifiedState=function(e){return this.fn(e)},n.prototype.getModifiedRecommendState=function(e){return this.recommendFn(e)},e.exports=n},9127:e=>{"use strict";function t(e){e=e||{},this.params=e.params||[]}t.prototype={constructor:t,addParams:function(e){var r=this.params.slice();return r.push(e),new t({params:r})},removeParams:function(e){return new t({params:this.params.filter((function(t){return t.$$id!==e}))})},addFrequentlyBoughtTogether:function(e){return this.addParams(Object.assign({},e,{model:"bought-together"}))},addRelatedProducts:function(e){return this.addParams(Object.assign({},e,{model:"related-products"}))},addTrendingItems:function(e){return this.addParams(Object.assign({},e,{model:"trending-items"}))},addTrendingFacets:function(e){return this.addParams(Object.assign({},e,{model:"trending-facets"}))},addLookingSimilar:function(e){return this.addParams(Object.assign({},e,{model:"looking-similar"}))},_buildQueries:function(e,t){return this.params.filter((function(e){return void 0===t[e.$$id]})).map((function(t){var r=Object.assign({},t,{indexName:e,threshold:t.threshold||0});return delete r.$$id,r}))}},e.exports=t},2223:e=>{"use strict";function t(e,t){this._state=e,this._rawResults={};var r=this;e.params.forEach((function(e){var i=e.$$id;r[i]=t[i],r._rawResults[i]=t[i]}))}t.prototype={constructor:t},e.exports=t},1673:(e,t,r)=>{"use strict";var i=r(9110),n=r(317),s=r(1383),a={addRefinement:function(e,t,r){if(a.isRefined(e,t,r))return e;var n=""+r,s=e[t]?e[t].concat(n):[n],c={};return c[t]=s,i(c,e)},removeRefinement:function(e,t,r){if(void 0===r)return a.clearRefinement(e,(function(e,r){return t===r}));var i=""+r;return a.clearRefinement(e,(function(e,r){return t===r&&i===e}))},toggleRefinement:function(e,t,r){if(void 0===r)throw new Error("toggleRefinement should be used with a value");return a.isRefined(e,t,r)?a.removeRefinement(e,t,r):a.addRefinement(e,t,r)},clearRefinement:function(e,t,r){if(void 0===t)return n(e)?{}:e;if("string"==typeof t)return s(e,[t]);if("function"==typeof t){var i=!1,a=Object.keys(e).reduce((function(n,s){var a=e[s]||[],c=a.filter((function(e){return!t(e,s,r)}));return c.length!==a.length&&(i=!0),n[s]=c,n}),{});return i?a:e}},isRefined:function(e,t,r){var i=Boolean(e[t])&&e[t].length>0;if(void 0===r||!i)return i;var n=""+r;return-1!==e[t].indexOf(n)}};e.exports=a},3371:(e,t,r)=>{"use strict";var i=r(9110),n=r(849),s=r(4843),a=r(4728),c=r(317),o=r(1383),u=r(7507),h=r(2208),l=r(1673);function f(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((function(e,r){return f(t[r],e)})):e===t}function m(e){var t=e?m._parseNumbers(e):{};void 0===t.userToken||h(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var r=this;Object.keys(t).forEach((function(e){var i=-1!==m.PARAMETERS.indexOf(e),n=void 0!==t[e];!i&&n&&(r[e]=t[e])}))}m.PARAMETERS=Object.keys(new m),m._parseNumbers=function(e){if(e instanceof m)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach((function(r){var i=e[r];if("string"==typeof i){var n=parseFloat(i);t[r]=isNaN(n)?i:n}})),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map((function(e){return Array.isArray(e)?e.map((function(e){return parseFloat(e)})):e}))),e.numericRefinements){var r={};Object.keys(e.numericRefinements).forEach((function(t){var i=e.numericRefinements[t]||{};r[t]={},Object.keys(i).forEach((function(e){var n=i[e].map((function(e){return Array.isArray(e)?e.map((function(e){return"string"==typeof e?parseFloat(e):e})):"string"==typeof e?parseFloat(e):e}));r[t][e]=n}))})),t.numericRefinements=r}return a(e,t)},m.make=function(e){var t=new m(e);return(e.hierarchicalFacets||[]).forEach((function(e){if(e.rootPath){var r=t.getHierarchicalRefinement(e.name);r.length>0&&0!==r[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),0===(r=t.getHierarchicalRefinement(e.name)).length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}})),t},m.validate=function(e,t){var r=t||{};return e.tagFilters&&r.tagRefinements&&r.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&r.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&r.numericRefinements&&c(r.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):c(e.numericRefinements)&&r.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},m.prototype={constructor:m,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:l.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:l.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:l.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:l.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,r){var i=u(r);if(this.isNumericRefined(e,t,i))return this;var n=a({},this.numericRefinements);return n[e]=a({},n[e]),n[e][t]?(n[e][t]=n[e][t].slice(),n[e][t].push(i)):n[e][t]=[i],this.setQueryParameters({numericRefinements:n})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)&&this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,r){var i=r;return void 0!==i?this.isNumericRefined(e,t,i)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,n){return n===e&&r.op===t&&f(r.val,u(i))}))}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,i){return i===e&&r.op===t}))}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(t,r){return r===e}))}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return c(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return o(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,r=this.numericRefinements,i=Object.keys(r).reduce((function(i,n){var s=r[n],a={};return s=s||{},Object.keys(s).forEach((function(r){var i=s[r]||[],c=[];i.forEach((function(t){e({val:t,op:r},n,"numeric")||c.push(t)})),c.length!==i.length&&(t=!0),a[r]=c})),i[n]=a,i}),{});return t?i:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:l.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:l.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return l.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:l.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter((function(t){return t!==e}))}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter((function(t){return t!==e}))}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter((function(t){return t.name!==e}))}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:l.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:l.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return l.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:l.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter((function(t){return t!==e}))};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:l.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:l.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:l.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),n={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+r))?-1===t.indexOf(r)?n[e]=[]:n[e]=[t.slice(0,t.lastIndexOf(r))]:n[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:i(n,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var r={};return r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:i(r,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:i(t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&l.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&l.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&l.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var r=this.getHierarchicalRefinement(e);return t?-1!==r.indexOf(t):r.length>0},isNumericRefined:function(e,t,r){if(void 0===r&&void 0===t)return Boolean(this.numericRefinements[e]);var i=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===r||!i)return i;var s,a,c=u(r),o=void 0!==(s=this.numericRefinements[e][t],a=c,n(s,(function(e){return f(e,a)})));return i&&o},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=s(Object.keys(this.numericRefinements).filter((function(t){return Object.keys(e.numericRefinements[t]).length>0})),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter((function(t){return e.disjunctiveFacetsRefinements[t].length>0})).concat(t).concat(this.getRefinedHierarchicalFacets()).sort()},getRefinedHierarchicalFacets:function(){var e=this;return s(this.hierarchicalFacets.map((function(e){return e.name})),Object.keys(this.hierarchicalFacetsRefinements).filter((function(t){return e.hierarchicalFacetsRefinements[t].length>0}))).sort()},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter((function(t){return-1===e.indexOf(t)}))},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},r=this;return Object.keys(this).forEach((function(i){var n=r[i];-1===e.indexOf(i)&&void 0!==n&&(t[i]=n)})),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var r={};return r[e]=t,this.setQueryParameters(r)},setQueryParameters:function(e){if(!e)return this;var t=m.validate(this,e);if(t)throw t;var r=this,i=m._parseNumbers(e),n=Object.keys(this).reduce((function(e,t){return e[t]=r[t],e}),{}),s=Object.keys(i).reduce((function(e,t){var r=void 0!==e[t],n=void 0!==i[t];return r&&!n?o(e,[t]):(n&&(e[t]=i[t]),e)}),n);return new this.constructor(s)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return n(this.hierarchicalFacets,(function(t){return t.name===e}))},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(r).map((function(e){return e.trim()}))},toString:function(){return JSON.stringify(this,null,2)}},e.exports=m},6673:(e,t,r)=>{"use strict";e.exports=function(e){return function(t,r){var i=e.hierarchicalFacets[r],u=e.hierarchicalFacetsRefinements[i.name]&&e.hierarchicalFacetsRefinements[i.name][0]||"",h=e._getHierarchicalFacetSeparator(i),l=e._getHierarchicalRootPath(i),f=e._getHierarchicalShowParentLevel(i),m=s(e._getHierarchicalFacetSortBy(i)),d=t.every((function(e){return e.exhaustive})),p=function(e,t,r,i,s){return function(u,h,l){var f=u;if(l>0){var m=0;for(f=u;m<l;){var d=f&&Array.isArray(f.data)?f.data:[];f=n(d,(function(e){return e.isRefined})),m++}}if(f){var p=Object.keys(h.data).map((function(e){return[e,h.data[e]]})).filter((function(e){return function(e,t,r,i,n,s){if(n&&(0!==e.indexOf(n)||n===e))return!1;return!n&&-1===e.indexOf(i)||n&&e.split(i).length-n.split(i).length==1||-1===e.indexOf(i)&&-1===r.indexOf(i)||0===r.indexOf(e)||0===e.indexOf(t+i)&&(s||0===e.indexOf(r))}(e[0],f.path||r,s,t,r,i)}));f.data=a(p.map((function(e){var r=e[0];return function(e,t,r,i,n){var s=t.split(r);return{name:s[s.length-1].trim(),path:t,escapedValue:c(t),count:e,isRefined:i===t||0===i.indexOf(t+r),exhaustive:n,data:null}}(e[1],r,t,o(s),h.exhaustive)})),e[0],e[1])}return u}}(m,h,l,f,u),g=t;return l&&(g=t.slice(l.split(h).length)),g.reduce(p,{name:e.hierarchicalFacets[r].name,count:null,isRefined:!0,path:null,escapedValue:null,exhaustive:d,data:null})}};var i=r(2909),n=r(849),s=r(7577),a=r(8601),c=i.escapeFacetValue,o=i.unescapeFacetValue},7691:(e,t,r)=>{"use strict";var i=r(8965),n=r(9110),s=r(2909),a=r(849),c=r(3917),o=r(7577),u=r(8601),h=s.escapeFacetValue,l=s.unescapeFacetValue,f=r(6673);function m(e){var t={};return e.forEach((function(e,r){t[e]=r})),t}function d(e,t,r){t&&t[r]&&(e.stats=t[r])}function p(e,t,r){var s=t[0]||{};this._rawResults=t;var o=this;Object.keys(s).forEach((function(e){o[e]=s[e]}));var u=n(r,{persistHierarchicalRootCount:!1});Object.keys(u).forEach((function(e){o[e]=u[e]})),this.processingTimeMS=t.reduce((function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS}),0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map((function(){return[]})),this.facets=[];var h=e.getRefinedDisjunctiveFacets(),p=m(e.facets),g=m(e.disjunctiveFacets),v=1,y=s.facets||{};Object.keys(y).forEach((function(t){var r,i,n=y[t],u=(r=e.hierarchicalFacets,i=t,a(r,(function(e){return(e.attributes||[]).indexOf(i)>-1})));if(u){var h=u.attributes.indexOf(t),l=c(e.hierarchicalFacets,(function(e){return e.name===u.name}));o.hierarchicalFacets[l][h]={attribute:t,data:n,exhaustive:s.exhaustiveFacetsCount}}else{var f,m=-1!==e.disjunctiveFacets.indexOf(t),v=-1!==e.facets.indexOf(t);m&&(f=g[t],o.disjunctiveFacets[f]={name:t,data:n,exhaustive:s.exhaustiveFacetsCount},d(o.disjunctiveFacets[f],s.facets_stats,t)),v&&(f=p[t],o.facets[f]={name:t,data:n,exhaustive:s.exhaustiveFacetsCount},d(o.facets[f],s.facets_stats,t))}})),this.hierarchicalFacets=i(this.hierarchicalFacets),h.forEach((function(r){var i=t[v],a=i&&i.facets?i.facets:{},u=e.getHierarchicalFacetByName(r);Object.keys(a).forEach((function(t){var r,h=a[t];if(u){r=c(e.hierarchicalFacets,(function(e){return e.name===u.name}));var f=c(o.hierarchicalFacets[r],(function(e){return e.attribute===t}));if(-1===f)return;o.hierarchicalFacets[r][f].data=o.persistHierarchicalRootCount?n(o.hierarchicalFacets[r][f].data,h):n(h,o.hierarchicalFacets[r][f].data)}else{r=g[t];var m=s.facets&&s.facets[t]||{};o.disjunctiveFacets[r]={name:t,data:n(m,h),exhaustive:i.exhaustiveFacetsCount},d(o.disjunctiveFacets[r],i.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach((function(i){!o.disjunctiveFacets[r].data[i]&&e.disjunctiveFacetsRefinements[t].indexOf(l(i))>-1&&(o.disjunctiveFacets[r].data[i]=0)}))}})),v++})),e.getRefinedHierarchicalFacets().forEach((function(r){var i=e.getHierarchicalFacetByName(r),s=e._getHierarchicalFacetSeparator(i),a=e.getHierarchicalRefinement(r);0===a.length||a[0].split(s).length<2||t.slice(v).forEach((function(t){var r=t&&t.facets?t.facets:{};Object.keys(r).forEach((function(t){var u=r[t],h=c(e.hierarchicalFacets,(function(e){return e.name===i.name})),l=c(o.hierarchicalFacets[h],(function(e){return e.attribute===t}));if(-1!==l){var f={};if(a.length>0&&!o.persistHierarchicalRootCount){var m=a[0].split(s)[0];f[m]=o.hierarchicalFacets[h][l].data[m]}o.hierarchicalFacets[h][l].data=n(f,u,o.hierarchicalFacets[h][l].data)}})),v++}))})),Object.keys(e.facetsExcludes).forEach((function(t){var r=e.facetsExcludes[t],i=p[t];o.facets[i]={name:t,data:y[t],exhaustive:s.exhaustiveFacetsCount},r.forEach((function(e){o.facets[i]=o.facets[i]||{name:t},o.facets[i].data=o.facets[i].data||{},o.facets[i].data[e]=0}))})),this.hierarchicalFacets=this.hierarchicalFacets.map(f(e)),this.facets=i(this.facets),this.disjunctiveFacets=i(this.disjunctiveFacets),this._state=e}function g(e,t){function r(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var i=a(e.facets,r);return i?Object.keys(i.data).map((function(r){var n=h(r);return{name:r,escapedValue:n,count:i.data[r],isRefined:e._state.isFacetRefined(t,n),isExcluded:e._state.isExcludeRefined(t,r)}})):[]}if(e._state.isDisjunctiveFacet(t)){var n=a(e.disjunctiveFacets,r);return n?Object.keys(n.data).map((function(r){var i=h(r);return{name:r,escapedValue:i,count:n.data[r],isRefined:e._state.isDisjunctiveFacetRefined(t,i)}})):[]}if(e._state.isHierarchicalFacet(t)){var s=a(e.hierarchicalFacets,r);if(!s)return s;var c=e._state.getHierarchicalFacetByName(t),o=e._state._getHierarchicalFacetSeparator(c),u=l(e._state.getHierarchicalRefinement(t)[0]||"");0===u.indexOf(c.rootPath)&&(u=u.replace(c.rootPath+o,""));var f=u.split(o);return f.unshift(t),v(s,f,0),s}}function v(e,t,r){e.isRefined=e.name===(t[r]&&t[r].trim()),e.data&&e.data.forEach((function(e){v(e,t,r+1)}))}function y(e,t,r,i){if(i=i||0,Array.isArray(t))return e(t,r[i]);if(!t.data||0===t.data.length)return t;var s=t.data.map((function(t){return y(e,t,r,i+1)})),a=e(s,r[i]);return n({data:a},t)}function R(e,t){var r=a(e,(function(e){return e.name===t}));return r&&r.stats}function F(e,t,r,i,n){var s=a(n,(function(e){return e.name===r})),c=s&&s.data&&s.data[i]?s.data[i]:0,o=s&&s.exhaustive||!1;return{type:t,attributeName:r,name:i,count:c,exhaustive:o}}p.prototype.getFacetByName=function(e){function t(t){return t.name===e}return a(this.facets,t)||a(this.disjunctiveFacets,t)||a(this.hierarchicalFacets,t)},p.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],p.prototype.getFacetValues=function(e,t){var r=g(this,e);if(r){var i,s=n(t,{sortBy:p.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),a=this;if(Array.isArray(r))i=[e];else i=a._state.getHierarchicalFacetByName(r.name).attributes;return y((function(e,t){if(s.facetOrdering){var r=function(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}(a,t);if(r)return function(e,t){var r=[],i=[],n=t.hide||[],s=(t.order||[]).reduce((function(e,t,r){return e[t]=r,e}),{});e.forEach((function(e){var t=e.path||e.name,a=n.indexOf(t)>-1;a||void 0===s[t]?a||i.push(e):r[s[t]]=e})),r=r.filter((function(e){return e}));var a,c=t.sortRemainingBy;return"hidden"===c?r:(a="alpha"===c?[["path","name"],["asc","asc"]]:[["count"],["desc"]],r.concat(u(i,a[0],a[1])))}(e,r)}if(Array.isArray(s.sortBy)){var i=o(s.sortBy,p.DEFAULT_SORT);return u(e,i[0],i[1])}if("function"==typeof s.sortBy)return function(e,t){return t.sort(e)}(s.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")}),r,i)}},p.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?R(this.facets,e):this._state.isDisjunctiveFacet(e)?R(this.disjunctiveFacets,e):void 0},p.prototype.getRefinements=function(){var e=this._state,t=this,r=[];return Object.keys(e.facetsRefinements).forEach((function(i){e.facetsRefinements[i].forEach((function(n){r.push(F(e,"facet",i,n,t.facets))}))})),Object.keys(e.facetsExcludes).forEach((function(i){e.facetsExcludes[i].forEach((function(n){r.push(F(e,"exclude",i,n,t.facets))}))})),Object.keys(e.disjunctiveFacetsRefinements).forEach((function(i){e.disjunctiveFacetsRefinements[i].forEach((function(n){r.push(F(e,"disjunctive",i,n,t.disjunctiveFacets))}))})),Object.keys(e.hierarchicalFacetsRefinements).forEach((function(i){e.hierarchicalFacetsRefinements[i].forEach((function(n){r.push(function(e,t,r,i){var n=e.getHierarchicalFacetByName(t),s=e._getHierarchicalFacetSeparator(n),c=r.split(s),o=a(i,(function(e){return e.name===t})),u=c.reduce((function(e,t){var r=e&&a(e.data,(function(e){return e.name===t}));return void 0!==r?r:e}),o),h=u&&u.count||0,l=u&&u.exhaustive||!1,f=u&&u.path||"";return{type:"hierarchical",attributeName:t,name:f,count:h,exhaustive:l}}(e,i,n,t.hierarchicalFacets))}))})),Object.keys(e.numericRefinements).forEach((function(t){var i=e.numericRefinements[t];Object.keys(i).forEach((function(e){i[e].forEach((function(i){r.push({type:"numeric",attributeName:t,name:i,numericValue:i,operator:e})}))}))})),e.tagRefinements.forEach((function(e){r.push({type:"tag",attributeName:"_tags",name:e})})),r},e.exports=p},6571:(e,t,r)=>{"use strict";var i=r(2733),n=r(6732),s=r(2909).escapeFacetValue,a=r(3014),c=r(4728),o=r(317),u=r(1383),h=r(9127),l=r(2223),f=r(9228),m=r(3371),d=r(7691),p=r(7749),g=r(6938);function v(e,t,r,i){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+g+")"),this.setClient(e);var n=r||{};n.index=t,this.state=m.make(n),this.recommendState=new h({params:n.recommendState}),this.lastResults=null,this.lastRecommendResults=null,this._queryId=0,this._recommendQueryId=0,this._lastQueryIdReceived=-1,this._lastRecommendQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._currentNbRecommendQueries=0,this._searchResultsOptions=i,this._recommendCache={}}function y(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function R(){return this.state.page}a(v,i),v.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},v.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},v.prototype.recommend=function(){return this._recommend(),this},v.prototype.getQuery=function(){var e=this.state;return f._getHitsSearchParams(e)},v.prototype.searchOnce=function(e,t){var r=e?this.state.setQueryParameters(e):this.state,i=f._getQueries(r.index,r),n=this;if(this._currentNbQueries++,this.emit("searchOnce",{state:r}),!t)return this.client.search(i).then((function(e){return n._currentNbQueries--,0===n._currentNbQueries&&n.emit("searchQueueEmpty"),{content:new d(r,e.results),state:r,_originalResponse:e}}),(function(e){throw n._currentNbQueries--,0===n._currentNbQueries&&n.emit("searchQueueEmpty"),e}));this.client.search(i).then((function(e){n._currentNbQueries--,0===n._currentNbQueries&&n.emit("searchQueueEmpty"),t(null,new d(r,e.results),r)})).catch((function(e){n._currentNbQueries--,0===n._currentNbQueries&&n.emit("searchQueueEmpty"),t(e,null,r)}))},v.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,r=this.derivedHelpers[0];if(!r)return Promise.resolve([]);var i=r.getModifiedState(t),n=c({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:u(f._getHitsSearchParams(i),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),s="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(s);var a=this.client.initIndex(i.index);if("function"!=typeof a.findAnswers)throw new Error(s);return a.findAnswers(i.query,e.queryLanguages,n)},v.prototype.searchForFacetValues=function(e,t,r,i){var n="function"==typeof this.client.searchForFacetValues&&"function"!=typeof this.client.searchForFacets,a="function"==typeof this.client.initIndex;if(!n&&!a&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var c=this.state.setQueryParameters(i||{}),o=c.isDisjunctiveFacet(e),u=f.getSearchForFacetQuery(e,t,r,c);this._currentNbQueries++;var h,l=this;return n?h=this.client.searchForFacetValues([{indexName:c.index,params:u}]):a?h=this.client.initIndex(c.index).searchForFacetValues(u):(delete u.facetName,h=this.client.search([{type:"facet",facet:e,indexName:c.index,params:u}]).then((function(e){return e.results[0]}))),this.emit("searchForFacetValues",{state:c,facet:e,query:t}),h.then((function(t){return l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),(t=Array.isArray(t)?t[0]:t).facetHits.forEach((function(t){t.escapedValue=s(t.value),t.isRefined=o?c.isDisjunctiveFacetRefined(e,t.escapedValue):c.isFacetRefined(e,t.escapedValue)})),t}),(function(e){throw l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),e}))},v.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},v.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},v.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},v.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},v.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.addNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,r),isPageReset:!0}),this},v.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},v.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},v.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},v.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},v.prototype.addFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.addFrequentlyBoughtTogether(e)}),this},v.prototype.addRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.addRelatedProducts(e)}),this},v.prototype.addTrendingItems=function(e){return this._recommendChange({state:this.recommendState.addTrendingItems(e)}),this},v.prototype.addTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.addTrendingFacets(e)}),this},v.prototype.addLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.addLookingSimilar(e)}),this},v.prototype.removeNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,r),isPageReset:!0}),this},v.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},v.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},v.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},v.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},v.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},v.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},v.prototype.removeFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeTrendingItems=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},v.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},v.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},v.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},v.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},v.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},v.prototype.setCurrentPage=y,v.prototype.setPage=y,v.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},v.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},v.prototype.setState=function(e){return this._change({state:m.make(e),isPageReset:!1}),this},v.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new m(e),this},v.prototype.hasRefinements=function(e){return!!o(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},v.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},v.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},v.prototype.hasTag=function(e){return this.state.isTagRefined(e)},v.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},v.prototype.getIndex=function(){return this.state.index},v.prototype.getCurrentPage=R,v.prototype.getPage=R,v.prototype.getTags=function(){return this.state.tagRefinements},v.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e))this.state.getConjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"conjunctive"})})),this.state.getExcludeRefinements(e).forEach((function(e){t.push({value:e,type:"exclude"})}));else if(this.state.isDisjunctiveFacet(e)){this.state.getDisjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"disjunctive"})}))}var r=this.state.getNumericRefinements(e);return Object.keys(r).forEach((function(e){var i=r[e];t.push({value:i,operator:e,type:"numeric"})})),t},v.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},v.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},v.prototype._search=function(e){var t=this.state,r=[],i=[];e.onlyWithDerivedHelpers||(i=f._getQueries(t.index,t),r.push({state:t,queriesCount:i.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var n=this.derivedHelpers.map((function(e){var i=e.getModifiedState(t),n=i.index?f._getQueries(i.index,i):[];return r.push({state:i,queriesCount:n.length,helper:e}),e.emit("search",{state:i,results:e.lastResults}),n})),s=Array.prototype.concat.apply(i,n),a=this._queryId++;if(this._currentNbQueries++,!s.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,r,a));try{this.client.search(s).then(this._dispatchAlgoliaResponse.bind(this,r,a)).catch(this._dispatchAlgoliaError.bind(this,a))}catch(c){this.emit("error",{error:c})}},v.prototype._recommend=function(){var e=this.state,t=this.recommendState,r=this.getIndex(),i=[{state:t,index:r,helper:this}],n=t.params.map((function(e){return e.$$id}));this.emit("fetch",{recommend:{state:t,results:this.lastRecommendResults}});var s=this._recommendCache,a=this.derivedHelpers.map((function(t){var r=t.getModifiedState(e).index;if(!r)return[];var a=t.getModifiedRecommendState(new h);return i.push({state:a,index:r,helper:t}),n=Array.prototype.concat.apply(n,a.params.map((function(e){return e.$$id}))),t.emit("fetch",{recommend:{state:a,results:t.lastRecommendResults}}),a._buildQueries(r,s)})),c=Array.prototype.concat.apply(this.recommendState._buildQueries(r,s),a);if(0!==c.length)if(c.length>0&&void 0===this.client.getRecommendations)console.warn("Please update algoliasearch/lite to the latest version in order to use recommend widgets.");else{var o=this._recommendQueryId++;this._currentNbRecommendQueries++;try{this.client.getRecommendations(c).then(this._dispatchRecommendResponse.bind(this,o,i,n)).catch(this._dispatchRecommendError.bind(this,o))}catch(u){this.emit("error",{error:u})}}},v.prototype._dispatchAlgoliaResponse=function(e,t,r){var i=this;if(!(t<this._lastQueryIdReceived)){this._currentNbQueries-=t-this._lastQueryIdReceived,this._lastQueryIdReceived=t,0===this._currentNbQueries&&this.emit("searchQueueEmpty");var n=r.results.slice();e.forEach((function(e){var t=e.state,r=e.queriesCount,s=e.helper,a=n.splice(0,r);t.index?(s.lastResults=new d(t,a,i._searchResultsOptions),s.emit("result",{results:s.lastResults,state:t})):s.emit("result",{results:null,state:t})}))}},v.prototype._dispatchRecommendResponse=function(e,t,r,i){if(!(e<this._lastRecommendQueryIdReceived)){this._currentNbRecommendQueries-=e-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=e,0===this._currentNbRecommendQueries&&this.emit("recommendQueueEmpty");var n=this._recommendCache,s={};r.filter((function(e){return void 0===n[e]})).forEach((function(e,t){s[e]||(s[e]=[]),s[e].push(t)})),Object.keys(s).forEach((function(e){var t=s[e],r=i.results[t[0]];1!==t.length?n[e]=Object.assign({},r,{hits:p(t.map((function(e){return i.results[e].hits})))}):n[e]=r}));var a={};r.forEach((function(e){a[e]=n[e]})),t.forEach((function(e){var t=e.state,r=e.helper;e.index?(r.lastRecommendResults=new l(t,a),r.emit("recommend:result",{recommend:{results:r.lastRecommendResults,state:t}})):r.emit("recommend:result",{results:null,state:t})}))}},v.prototype._dispatchAlgoliaError=function(e,t){e<this._lastQueryIdReceived||(this._currentNbQueries-=e-this._lastQueryIdReceived,this._lastQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbQueries&&this.emit("searchQueueEmpty"))},v.prototype._dispatchRecommendError=function(e,t){e<this._lastRecommendQueryIdReceived||(this._currentNbRecommendQueries-=e-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbRecommendQueries&&this.emit("recommendQueueEmpty"))},v.prototype.containsRefinement=function(e,t,r,i){return e||0!==t.length||0!==r.length||0!==i.length},v.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},v.prototype._change=function(e){var t=e.state,r=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:r}))},v.prototype._recommendChange=function(e){var t=e.state;t!==this.recommendState&&(this.recommendState=t,this.emit("recommend:change",{search:{results:this.lastResults,state:this.state},recommend:{results:this.lastRecommendResults,state:this.recommendState}}))},v.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},v.prototype.setClient=function(e){return this.client===e||("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+g+")"),this.client=e),this},v.prototype.getClient=function(){return this.client},v.prototype.derive=function(e,t){var r=new n(this,e,t);return this.derivedHelpers.push(r),r},v.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},v.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},e.exports=v},8965:e=>{"use strict";e.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},9110:e=>{"use strict";e.exports=function(){return Array.prototype.slice.call(arguments).reduceRight((function(e,t){return Object.keys(Object(t)).forEach((function(r){void 0!==t[r]&&(void 0!==e[r]&&delete e[r],e[r]=t[r])})),e}),{})}},2909:e=>{"use strict";e.exports={escapeFacetValue:function(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")},unescapeFacetValue:function(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}}},849:e=>{"use strict";e.exports=function(e,t){if(Array.isArray(e))for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}},3917:e=>{"use strict";e.exports=function(e,t){if(!Array.isArray(e))return-1;for(var r=0;r<e.length;r++)if(t(e[r]))return r;return-1}},8657:e=>{e.exports=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])}},7577:(e,t,r)=>{"use strict";var i=r(849);e.exports=function(e,t){var r=(t||[]).map((function(e){return e.split(":")}));return e.reduce((function(e,t){var n=t.split(":"),s=i(r,(function(e){return e[0]===n[0]}));return n.length>1||!s?(e[0].push(n[0]),e[1].push(n[1]),e):(e[0].push(s[0]),e[1].push(s[1]),e)}),[[],[]])}},3014:e=>{"use strict";e.exports=function(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}},4843:e=>{"use strict";e.exports=function(e,t){return e.filter((function(r,i){return t.indexOf(r)>-1&&e.indexOf(r)===i}))}},4728:e=>{"use strict";function t(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function r(e,i){if(e===i)return e;for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&"__proto__"!==n&&"constructor"!==n){var s=i[n],a=e[n];void 0!==a&&void 0===s||(t(a)&&t(s)?e[n]=r(a,s):e[n]="object"==typeof(c=s)&&null!==c?r(Array.isArray(c)?[]:{},c):c)}var c;return e}e.exports=function(e){t(e)||(e={});for(var i=1,n=arguments.length;i<n;i++){var s=arguments[i];t(s)&&r(e,s)}return e}},317:e=>{"use strict";e.exports=function(e){return e&&Object.keys(e).length>0}},1383:e=>{"use strict";e.exports=function(e,t){if(null===e)return{};var r,i,n={},s=Object.keys(e);for(i=0;i<s.length;i++)r=s[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}},8601:e=>{"use strict";function t(e,t){if(e!==t){var r=void 0!==e,i=null===e,n=void 0!==t,s=null===t;if(!s&&e>t||i&&n||!r)return 1;if(!i&&e<t||s&&r||!n)return-1}return 0}e.exports=function(e,r,i){if(!Array.isArray(e))return[];Array.isArray(i)||(i=[]);var n=e.map((function(e,t){return{criteria:r.map((function(t){return e[t]})),index:t,value:e}}));return n.sort((function(e,r){for(var n=-1;++n<e.criteria.length;){var s=t(e.criteria[n],r.criteria[n]);if(s)return n>=i.length?s:"desc"===i[n]?-s:s}return e.index-r.index})),n.map((function(e){return e.value}))}},7507:e=>{"use strict";e.exports=function e(t){if("number"==typeof t)return t;if("string"==typeof t)return parseFloat(t);if(Array.isArray(t))return t.map(e);throw new Error("The value should be a number, a parsable string or an array of those.")}},9228:(e,t,r)=>{"use strict";var i=r(4728);function n(e){return Object.keys(e).sort().reduce((function(t,r){return t[r]=e[r],t}),{})}var s={_getQueries:function(e,t){var r=[];return r.push({indexName:e,params:s._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach((function(i){r.push({indexName:e,params:s._getDisjunctiveFacetSearchParams(t,i)})})),t.getRefinedHierarchicalFacets().forEach((function(i){var n=t.getHierarchicalFacetByName(i),a=t.getHierarchicalRefinement(i),c=t._getHierarchicalFacetSeparator(n);if(a.length>0&&a[0].split(c).length>1){var o=a[0].split(c).slice(0,-1).reduce((function(e,t,r){return e.concat({attribute:n.attributes[r],value:0===r?t:[e[e.length-1].value,t].join(c)})}),[]);o.forEach((function(i,a){var c=s._getDisjunctiveFacetSearchParams(t,i.attribute,0===a);function u(e){return n.attributes.some((function(t){return t===e.split(":")[0]}))}var h=(c.facetFilters||[]).reduce((function(e,t){if(Array.isArray(t)){var r=t.filter((function(e){return!u(e)}));r.length>0&&e.push(r)}return"string"!=typeof t||u(t)||e.push(t),e}),[]),l=o[a-1];a>0?c.facetFilters=h.concat(l.attribute+":"+l.value):h.length>0?c.facetFilters=h:delete c.facetFilters,r.push({indexName:e,params:c})}))}})),r},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(s._getHitsHierarchicalFacetsAttributes(e)).sort(),r=s._getFacetFilters(e),a=s._getNumericFilters(e),c=s._getTagFilters(e),o={};return t.length>0&&(o.facets=t.indexOf("*")>-1?["*"]:t),c.length>0&&(o.tagFilters=c),r.length>0&&(o.facetFilters=r),a.length>0&&(o.numericFilters=a),n(i({},e.getQueryParams(),o))},_getDisjunctiveFacetSearchParams:function(e,t,r){var a=s._getFacetFilters(e,t,r),c=s._getNumericFilters(e,t),o=s._getTagFilters(e),u={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};o.length>0&&(u.tagFilters=o);var h=e.getHierarchicalFacetByName(t);return u.facets=h?s._getDisjunctiveHierarchicalFacetAttribute(e,h,r):t,c.length>0&&(u.numericFilters=c),a.length>0&&(u.facetFilters=a),n(i({},e.getQueryParams(),u))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var r=[];return Object.keys(e.numericRefinements).forEach((function(i){var n=e.numericRefinements[i]||{};Object.keys(n).forEach((function(e){var s=n[e]||[];t!==i&&s.forEach((function(t){if(Array.isArray(t)){var n=t.map((function(t){return i+e+t}));r.push(n)}else r.push(i+e+t)}))}))})),r},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,r){var i=[],n=e.facetsRefinements||{};Object.keys(n).sort().forEach((function(e){(n[e]||[]).slice().sort().forEach((function(t){i.push(e+":"+t)}))}));var s=e.facetsExcludes||{};Object.keys(s).sort().forEach((function(e){(s[e]||[]).sort().forEach((function(t){i.push(e+":-"+t)}))}));var a=e.disjunctiveFacetsRefinements||{};Object.keys(a).sort().forEach((function(e){var r=a[e]||[];if(e!==t&&r&&0!==r.length){var n=[];r.slice().sort().forEach((function(t){n.push(e+":"+t)})),i.push(n)}}));var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).sort().forEach((function(n){var s=(c[n]||[])[0];if(void 0!==s){var a,o,u=e.getHierarchicalFacetByName(n),h=e._getHierarchicalFacetSeparator(u),l=e._getHierarchicalRootPath(u);if(t===n){if(-1===s.indexOf(h)||!l&&!0===r||l&&l.split(h).length===s.split(h).length)return;l?(o=l.split(h).length-1,s=l):(o=s.split(h).length-2,s=s.slice(0,s.lastIndexOf(h))),a=u.attributes[o]}else o=s.split(h).length-1,a=u.attributes[o];a&&i.push([a+":"+s])}})),i},_getHitsHierarchicalFacetsAttributes:function(e){return e.hierarchicalFacets.reduce((function(t,r){var i=e.getHierarchicalRefinement(r.name)[0];if(!i)return t.push(r.attributes[0]),t;var n=e._getHierarchicalFacetSeparator(r),s=i.split(n).length,a=r.attributes.slice(0,s+1);return t.concat(a)}),[])},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,r){var i=e._getHierarchicalFacetSeparator(t);if(!0===r){var n=e._getHierarchicalRootPath(t),s=0;return n&&(s=n.split(i).length),[t.attributes[s]]}var a=(e.getHierarchicalRefinement(t.name)[0]||"").split(i).length-1;return t.attributes.slice(0,a+1)},getSearchForFacetQuery:function(e,t,r,a){var c=a.isDisjunctiveFacet(e)?a.clearRefinements(e):a,o={facetQuery:t,facetName:e};return"number"==typeof r&&(o.maxFacetHits=r),n(i({},s._getHitsSearchParams(c),o))}};e.exports=s},2208:e=>{"use strict";e.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},7749:(e,t,r)=>{"use strict";var i=r(849),n=r(8657);e.exports=function(e){var t={};return e.forEach((function(e){e.forEach((function(e,r){t[e.objectID]?t[e.objectID]={indexSum:t[e.objectID].indexSum+r,count:t[e.objectID].count+1}:t[e.objectID]={indexSum:r,count:1}}))})),function(e,t){var r=[];return Object.keys(e).forEach((function(i){e[i].count<2&&(e[i].indexSum+=100),r.push({objectID:i,avgOfIndices:e[i].indexSum/t})})),r.sort((function(e,t){return e.avgOfIndices>t.avgOfIndices?1:-1}))}(t,e.length).reduce((function(t,r){var s=i(n(e),(function(e){return e.objectID===r.objectID}));return s?t.concat(s):t}),[])}},6938:e=>{"use strict";e.exports="3.22.6"},917:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>U});var i=r(6540),n=r(4164),s=r(4103),a=r.n(s);function c(e){let t;const r=`algolia-client-js-${e.key}`;function i(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function n(){return JSON.parse(i().getItem(r)||"{}")}function s(e){i().setItem(r,JSON.stringify(e))}return{get:(t,r,i={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=n(),i=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(s(i),!t)return;s(Object.fromEntries(Object.entries(i).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),n()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||i.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const s=n();return s[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},i().setItem(r,JSON.stringify(s)),t})),delete:e=>Promise.resolve().then((()=>{const t=n();delete t[JSON.stringify(e)],i().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{i().removeItem(r)}))}}function o(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,i,n={miss:()=>Promise.resolve()})=>r.get(e,i,n).catch((()=>o({caches:t}).get(e,i,n))),set:(e,i)=>r.set(e,i).catch((()=>o({caches:t}).set(e,i))),delete:e=>r.delete(e).catch((()=>o({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>o({caches:t}).clear()))}}function u(e={serializable:!0}){let t={};return{get(r,i,n={miss:()=>Promise.resolve()}){const s=JSON.stringify(r);if(s in t)return Promise.resolve(e.serializable?JSON.parse(t[s]):t[s]);const a=i();return a.then((e=>n.miss(e))).then((()=>a))},set:(r,i)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(i):i,Promise.resolve(i)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}function h({algoliaAgents:e,client:t,version:r}){const i=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>i.add(e))),i}var l=12e4;function f(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>l},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=l}}}var m=class extends Error{name="AlgoliaError";constructor(e,t){super(e),t&&(this.name=t)}},d=class extends m{stackTrace;constructor(e,t,r){super(e,r),this.stackTrace=t}},p=class extends d{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",e,"RetryError")}},g=class extends d{status;constructor(e,t,r,i="ApiError"){super(e,r,i),this.status=t}},v=class extends m{response;constructor(e,t){super(e,"DeserializationError"),this.response=t}},y=class extends g{error;constructor(e,t,r,i){super(e,t,i,"DetailedApiError"),this.error=r}};function R(e,t,r){const i=(n=r,Object.keys(n).filter((e=>void 0!==n[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(n[e])?n[e].join(","):n[e]).replace(/\+/g,"%20")}`)).join("&"));var n;let s=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return i.length&&(s+=`?${i}`),s}function F(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function b({hosts:e,hostsCache:t,baseHeaders:r,logger:i,baseQueryParameters:n,algoliaAgent:s,timeouts:a,requester:c,requestsCache:o,responsesCache:u}){async function h(o,u,h=!0){const l=[],m=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(o,u),d=function(e,t,r){const i={Accept:"application/json",...e,...t,...r},n={};return Object.keys(i).forEach((e=>{const t=i[e];n[e.toLowerCase()]=t})),n}(r,o.headers,u.headers),b="GET"===o.method?{...o.data,...u.data}:{},P={...n,...o.queryParameters,...b};if(s.value&&(P["x-algolia-agent"]=s.value),u&&u.queryParameters)for(const e of Object.keys(u.queryParameters))u.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(u.queryParameters[e])?P[e]=u.queryParameters[e].toString():P[e]=u.queryParameters[e];let _=0;const j=async(e,r)=>{const n=e.pop();if(void 0===n)throw new p(function(e){return e.map((e=>F(e)))}(l));const s={...a,...u.timeouts},b={data:m,headers:d,method:o.method,url:R(n,o.path,P),connectTimeout:r(_,s.connect),responseTimeout:r(_,h?s.read:s.write)},x=t=>{const r={request:b,response:t,host:n,triesLeft:e.length};return l.push(r),r},E=await c.send(b);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(E)){const s=x(E);return E.isTimedOut&&_++,i.info("Retryable failure",F(s)),await t.set(n,f(n,E.isTimedOut?"timed out":"down")),j(e,r)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(t){throw new v(t.message,e)}}(E);throw x(E),function({content:e,status:t},r){try{const i=JSON.parse(e);return"error"in i?new y(i.message,t,i.error,r):new g(i.message,t,r)}catch{}return new g(e,t,r)}(E,l)},x=e.filter((e=>"readWrite"===e.accept||(h?"read"===e.accept:"write"===e.accept))),E=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(f(e))))))),i=r.filter((e=>e.isUp())),n=r.filter((e=>e.isTimedOut())),s=[...i,...n];return{hosts:s.length>0?s:e,getTimeout:(e,t)=>(0===n.length&&0===e?1:n.length+3+e)*t}}(x);return j([...E.hosts].reverse(),E.getTimeout)}return{hostsCache:t,requester:c,timeouts:a,logger:i,algoliaAgent:s,baseHeaders:r,baseQueryParameters:n,hosts:e,request:function(e,t={}){const i=e.useReadTransporter||"GET"===e.method;if(!i)return h(e,t,i);const s=()=>h(e,t);if(!0!==(t.cacheable||e.cacheable))return s();const a={request:e,requestOptions:t,transporter:{queryParameters:n,headers:r}};return u.get(a,(()=>o.get(a,(()=>o.set(a,s()).then((e=>Promise.all([o.delete(a),e])),(e=>Promise.all([o.delete(a),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>u.set(a,e)})},requestsCache:o,responsesCache:u}}var P="5.18.0";function _(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const i=Math.floor(Math.random()*(r+1)),n=e[r];t[r]=e[i],t[i]=n}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function j(e,t,r){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:i,...n}){const s=function(e,t,r="WithinHeaders"){const i={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?i:{},queryParameters:()=>"WithinQueryParameters"===r?i:{}}}(e,t,r),a=b({hosts:_(e),...n,algoliaAgent:h({algoliaAgents:i,client:"Lite",version:P}),baseHeaders:{"content-type":"text/plain",...s.headers(),...n.baseHeaders},baseQueryParameters:{...s.queryParameters(),...n.baseQueryParameters}});return{transporter:a,appId:e,clearCache:()=>Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((()=>{})),get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(e,t){a.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){r&&"WithinHeaders"!==r?a.baseQueryParameters["x-algolia-api-key"]=e:a.baseHeaders["x-algolia-api-key"]=e},searchForHits(e,t){return this.search(e,t)},searchForFacets(e,t){return this.search(e,t)},customPost({path:e,parameters:t,body:r},i){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const n={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return a.request(n,i)},getRecommendations(e,t){if(e&&Array.isArray(e)&&(e={requests:e}),!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");const r={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return a.request(r,t)},search(e,t){if(e&&Array.isArray(e)){const t={requests:e.map((({params:e,...t})=>"facet"===t.type?{...t,...e,type:"facet"}:{...t,...e,facet:void 0,maxFacetHits:void 0,facetQuery:void 0}))};e=t}if(!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");const r={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return a.request(r,t)}}}({appId:e,apiKey:t,timeouts:{connect:1e3,read:2e3,write:3e4},logger:{debug:(e,t)=>Promise.resolve(),info:(e,t)=>Promise.resolve(),error:(e,t)=>Promise.resolve()},requester:{send:function(e){return new Promise((t=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));let i,n=(e,i)=>setTimeout((()=>{r.abort(),t({status:0,content:i,isTimedOut:!0})}),e),s=n(e.connectTimeout,"Connection timeout");r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===i&&(clearTimeout(s),i=n(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(s),clearTimeout(i),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(s),clearTimeout(i),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:o({caches:[c({key:`${P}-${e}`}),u()]}),...r})}var x=r(8193),E=r(5260),w=r(8774),O=r(4070),A=r(4586);const S=["zero","one","two","few","many","other"];function T(e){return S.filter((t=>e.includes(t)))}const H={locale:"en",pluralForms:T(["one","other"]),select:e=>1===e?"one":"other"};function N(){const{i18n:{currentLocale:e}}=(0,A.A)();return(0,i.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:T(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),H}}),[e])}function Q(){const e=N();return{selectMessage:(t,r)=>function(e,t,r){const i=e.split("|");if(1===i.length)return i[0];i.length>r.pluralForms.length&&console.error(`For locale=${r.locale}, a maximum of ${r.pluralForms.length} plural forms are expected (${r.pluralForms.join(",")}), but the message contains ${i.length}: ${e}`);const n=r.select(t),s=r.pluralForms.indexOf(n);return i[Math.min(s,i.length-1)]}(r,t,e)}}var C=r(4255),I=r(9532),D=r(9024),k=r(481),q=r(1312),L=r(8126),V=r(1062),$=r(1957),B=r(1107);const M={searchQueryInput:"searchQueryInput_u2C7",searchVersionInput:"searchVersionInput_m0Ui",searchResultsColumn:"searchResultsColumn_JPFH",algoliaLogo:"algoliaLogo_rT1R",algoliaLogoPathFill:"algoliaLogoPathFill_WdUC",searchResultItem:"searchResultItem_Tv2o",searchResultItemHeading:"searchResultItemHeading_KbCB",searchResultItemPath:"searchResultItemPath_lhe1",searchResultItemSummary:"searchResultItemSummary_AEaO",searchQueryColumn:"searchQueryColumn_RTkw",searchVersionColumn:"searchVersionColumn_ypXd",searchLogoColumn:"searchLogoColumn_rJIA",loadingSpinner:"loadingSpinner_XVxU","loading-spin":"loading-spin_vzvp",loader:"loader_vvXV"};var z=r(4848);function J(e){let{docsSearchVersionsHelpers:t}=e;const r=Object.entries(t.allDocsData).filter((e=>{let[,t]=e;return t.versions.length>1}));return(0,z.jsx)("div",{className:(0,n.A)("col","col--3","padding-left--none",M.searchVersionColumn),children:r.map((e=>{let[i,n]=e;const s=r.length>1?`${i}: `:"";return(0,z.jsx)("select",{onChange:e=>t.setSearchVersion(i,e.target.value),defaultValue:t.searchVersions[i],className:M.searchVersionInput,children:n.versions.map(((e,t)=>(0,z.jsx)("option",{label:`${s}${e.label}`,value:e.name},t)))},i)}))})}function W(){const{i18n:{currentLocale:e}}=(0,A.A)(),{algolia:{appId:t,apiKey:r,indexName:s,contextualSearch:c}}=(0,L.c)(),o=(0,V.C)(),u=function(){const{selectMessage:e}=Q();return t=>e(t,(0,q.T)({id:"theme.SearchPage.documentsFound.plurals",description:'Pluralized label for "{count} documents found". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One document found|{count} documents found"},{count:t}))}(),h=function(){const e=(0,O.Gy)(),[t,r]=(0,i.useState)((()=>Object.entries(e).reduce(((e,t)=>{let[r,i]=t;return{...e,[r]:i.versions[0].name}}),{}))),n=Object.values(e).some((e=>e.versions.length>1));return{allDocsData:e,versioningEnabled:n,searchVersions:t,setSearchVersion:(e,t)=>r((r=>({...r,[e]:t})))}}(),[l,f]=(0,C.b)(),m={items:[],query:null,totalResults:null,totalPages:null,lastPage:null,hasMore:null,loading:null},[d,p]=(0,i.useReducer)(((e,t)=>{switch(t.type){case"reset":return m;case"loading":return{...e,loading:!0};case"update":return l!==t.value.query?e:{...t.value,items:0===t.value.lastPage?t.value.items:e.items.concat(t.value.items)};case"advance":{const t=e.totalPages>e.lastPage+1;return{...e,lastPage:t?e.lastPage+1:e.lastPage,hasMore:t}}default:return e}}),m),g=c?["language","docusaurus_tag"]:[],v=j(t,r),y=a()(v,s,{hitsPerPage:15,advancedSyntax:!0,disjunctiveFacets:g});y.on("result",(e=>{let{results:{query:t,hits:r,page:i,nbHits:n,nbPages:s}}=e;if(""===t||!Array.isArray(r))return void p({type:"reset"});const a=e=>e.replace(/algolia-docsearch-suggestion--highlight/g,"search-result-match"),c=r.map((e=>{let{url:t,_highlightResult:{hierarchy:r},_snippetResult:i={}}=e;const n=Object.keys(r).map((e=>a(r[e].value)));return{title:n.pop(),url:o(t),summary:i.content?`${a(i.content.value)}...`:"",breadcrumbs:n}}));p({type:"update",value:{items:c,query:t,totalResults:n,totalPages:s,lastPage:i,hasMore:s>i+1,loading:!1}})}));const[R,F]=(0,i.useState)(null),b=(0,i.useRef)(0),P=(0,i.useRef)(x.A.canUseIntersectionObserver&&new IntersectionObserver((e=>{const{isIntersecting:t,boundingClientRect:{y:r}}=e[0];t&&b.current>r&&p({type:"advance"}),b.current=r}),{threshold:1})),_=()=>l?(0,q.T)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:l}):(0,q.T)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"}),S=(0,I._q)((function(t){void 0===t&&(t=0),c&&(y.addDisjunctiveFacetRefinement("docusaurus_tag","default"),y.addDisjunctiveFacetRefinement("language",e),Object.entries(h.searchVersions).forEach((e=>{let[t,r]=e;y.addDisjunctiveFacetRefinement("docusaurus_tag",`docs-${t}-${r}`)}))),y.setQuery(l).setPage(t).search()}));return(0,i.useEffect)((()=>{if(!R)return;const e=P.current;return e?(e.observe(R),()=>e.unobserve(R)):()=>!0}),[R]),(0,i.useEffect)((()=>{p({type:"reset"}),l&&(p({type:"loading"}),setTimeout((()=>{S()}),300))}),[l,h.searchVersions,S]),(0,i.useEffect)((()=>{d.lastPage&&0!==d.lastPage&&S(d.lastPage)}),[S,d.lastPage]),(0,z.jsxs)($.A,{children:[(0,z.jsxs)(E.A,{children:[(0,z.jsx)("title",{children:(0,k.s)(_())}),(0,z.jsx)("meta",{property:"robots",content:"noindex, follow"})]}),(0,z.jsxs)("div",{className:"container margin-vert--lg",children:[(0,z.jsx)(B.A,{as:"h1",children:_()}),(0,z.jsxs)("form",{className:"row",onSubmit:e=>e.preventDefault(),children:[(0,z.jsx)("div",{className:(0,n.A)("col",M.searchQueryColumn,{"col--9":h.versioningEnabled,"col--12":!h.versioningEnabled}),children:(0,z.jsx)("input",{type:"search",name:"q",className:M.searchQueryInput,placeholder:(0,q.T)({id:"theme.SearchPage.inputPlaceholder",message:"Type your search here",description:"The placeholder for search page input"}),"aria-label":(0,q.T)({id:"theme.SearchPage.inputLabel",message:"Search",description:"The ARIA label for search page input"}),onChange:e=>f(e.target.value),value:l,autoComplete:"off",autoFocus:!0})}),c&&h.versioningEnabled&&(0,z.jsx)(J,{docsSearchVersionsHelpers:h})]}),(0,z.jsxs)("div",{className:"row",children:[(0,z.jsx)("div",{className:(0,n.A)("col","col--8",M.searchResultsColumn),children:!!d.totalResults&&u(d.totalResults)}),(0,z.jsx)("div",{className:(0,n.A)("col","col--4","text--right",M.searchLogoColumn),children:(0,z.jsx)(w.A,{to:"https://www.algolia.com/","aria-label":(0,q.T)({id:"theme.SearchPage.algoliaLabel",message:"Search by Algolia",description:"The ARIA label for Algolia mention"}),children:(0,z.jsx)("svg",{viewBox:"0 0 168 24",className:M.algoliaLogo,children:(0,z.jsxs)("g",{fill:"none",children:[(0,z.jsx)("path",{className:M.algoliaLogoPathFill,d:"M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"}),(0,z.jsx)("path",{fill:"#5468FF",d:"M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"}),(0,z.jsx)("path",{fill:"white",d:"M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"})]})})})})]}),d.items.length>0?(0,z.jsx)("main",{children:d.items.map(((e,t)=>{let{title:r,url:i,summary:s,breadcrumbs:a}=e;return(0,z.jsxs)("article",{className:M.searchResultItem,children:[(0,z.jsx)(B.A,{as:"h2",className:M.searchResultItemHeading,children:(0,z.jsx)(w.A,{to:i,dangerouslySetInnerHTML:{__html:r}})}),a.length>0&&(0,z.jsx)("nav",{"aria-label":"breadcrumbs",children:(0,z.jsx)("ul",{className:(0,n.A)("breadcrumbs",M.searchResultItemPath),children:a.map(((e,t)=>(0,z.jsx)("li",{className:"breadcrumbs__item",dangerouslySetInnerHTML:{__html:e}},t)))})}),s&&(0,z.jsx)("p",{className:M.searchResultItemSummary,dangerouslySetInnerHTML:{__html:s}})]},t)}))}):[l&&!d.loading&&(0,z.jsx)("p",{children:(0,z.jsx)(q.A,{id:"theme.SearchPage.noResultsText",description:"The paragraph for empty search result",children:"No results were found"})},"no-results"),!!d.loading&&(0,z.jsx)("div",{className:M.loadingSpinner},"spinner")],d.hasMore&&(0,z.jsx)("div",{className:M.loader,ref:F,children:(0,z.jsx)(q.A,{id:"theme.SearchPage.fetchingNewResults",description:"The paragraph for fetching new search results",children:"Fetching new results..."})})]})]})}function U(){return(0,z.jsx)(D.e3,{className:"search-page-wrapper",children:(0,z.jsx)(W,{})})}}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.ad537829.js b/assets/js/1a4e3797.ad537829.js deleted file mode 100644 index 306c12c59e..0000000000 --- a/assets/js/1a4e3797.ad537829.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 1a4e3797.ad537829.js.LICENSE.txt */ -(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2138],{2733:e=>{function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,s,a,c,u,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i(s=this._events[e]))return!1;if(r(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:c=Array.prototype.slice.call(arguments,1),s.apply(this,c)}else if(n(s))for(c=Array.prototype.slice.call(arguments,1),a=(o=s.slice()).length,u=0;u<a;u++)o[u].apply(this,c);return!0},t.prototype.addListener=function(e,s){var a;if(!r(s))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(s.listener)?s.listener:s),this._events[e]?n(this._events[e])?this._events[e].push(s):this._events[e]=[this._events[e],s]:this._events[e]=s,n(this._events[e])&&!this._events[e].warned&&(a=i(this._maxListeners)?t.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},t.prototype.removeListener=function(e,t){var i,s,a,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(i=this._events[e]).length,s=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(i)){for(c=a;c-- >0;)if(i[c]===t||i[c].listener&&i[c].listener===t){s=c;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},4103:(e,t,r)=>{"use strict";var n=r(6571),i=r(3371),s=r(7691);function a(e,t,r,i){return new n(e,t,r,i)}a.version=r(6938),a.AlgoliaSearchHelper=n,a.SearchParameters=i,a.SearchResults=s,e.exports=a},6732:(e,t,r)=>{"use strict";var n=r(2733);function i(e,t){this.main=e,this.fn=t,this.lastResults=null}r(3014)(i,n),i.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},i.prototype.getModifiedState=function(e){return this.fn(e)},e.exports=i},1673:(e,t,r)=>{"use strict";var n=r(9110),i=r(317),s=r(1383),a={addRefinement:function(e,t,r){if(a.isRefined(e,t,r))return e;var i=""+r,s=e[t]?e[t].concat(i):[i],c={};return c[t]=s,n({},c,e)},removeRefinement:function(e,t,r){if(void 0===r)return a.clearRefinement(e,(function(e,r){return t===r}));var n=""+r;return a.clearRefinement(e,(function(e,r){return t===r&&n===e}))},toggleRefinement:function(e,t,r){if(void 0===r)throw new Error("toggleRefinement should be used with a value");return a.isRefined(e,t,r)?a.removeRefinement(e,t,r):a.addRefinement(e,t,r)},clearRefinement:function(e,t,r){if(void 0===t)return i(e)?{}:e;if("string"==typeof t)return s(e,[t]);if("function"==typeof t){var n=!1,a=Object.keys(e).reduce((function(i,s){var a=e[s]||[],c=a.filter((function(e){return!t(e,s,r)}));return c.length!==a.length&&(n=!0),i[s]=c,i}),{});return n?a:e}},isRefined:function(e,t,r){var n=Boolean(e[t])&&e[t].length>0;if(void 0===r||!n)return n;var i=""+r;return-1!==e[t].indexOf(i)}};e.exports=a},3371:(e,t,r)=>{"use strict";var n=r(9110),i=r(849),s=r(4843),a=r(4728),c=r(317),u=r(1383),o=r(7507),h=r(2208),f=r(1673);function l(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((function(e,r){return l(t[r],e)})):e===t}function m(e){var t=e?m._parseNumbers(e):{};void 0===t.userToken||h(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var r=this;Object.keys(t).forEach((function(e){var n=-1!==m.PARAMETERS.indexOf(e),i=void 0!==t[e];!n&&i&&(r[e]=t[e])}))}m.PARAMETERS=Object.keys(new m),m._parseNumbers=function(e){if(e instanceof m)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach((function(r){var n=e[r];if("string"==typeof n){var i=parseFloat(n);t[r]=isNaN(i)?n:i}})),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map((function(e){return Array.isArray(e)?e.map((function(e){return parseFloat(e)})):e}))),e.numericRefinements){var r={};Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t]||{};r[t]={},Object.keys(n).forEach((function(e){var i=n[e].map((function(e){return Array.isArray(e)?e.map((function(e){return"string"==typeof e?parseFloat(e):e})):"string"==typeof e?parseFloat(e):e}));r[t][e]=i}))})),t.numericRefinements=r}return a(e,t)},m.make=function(e){var t=new m(e);return(e.hierarchicalFacets||[]).forEach((function(e){if(e.rootPath){var r=t.getHierarchicalRefinement(e.name);r.length>0&&0!==r[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),0===(r=t.getHierarchicalRefinement(e.name)).length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}})),t},m.validate=function(e,t){var r=t||{};return e.tagFilters&&r.tagRefinements&&r.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&r.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&r.numericRefinements&&c(r.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):c(e.numericRefinements)&&r.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},m.prototype={constructor:m,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:f.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:f.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:f.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:f.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,r){var n=o(r);if(this.isNumericRefined(e,t,n))return this;var i=a({},this.numericRefinements);return i[e]=a({},i[e]),i[e][t]?(i[e][t]=i[e][t].slice(),i[e][t].push(n)):i[e][t]=[n],this.setQueryParameters({numericRefinements:i})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)&&this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,r){var n=r;return void 0!==n?this.isNumericRefined(e,t,n)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,i){return i===e&&r.op===t&&l(r.val,o(n))}))}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,n){return n===e&&r.op===t}))}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(t,r){return r===e}))}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return c(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return u(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,r=this.numericRefinements,n=Object.keys(r).reduce((function(n,i){var s=r[i],a={};return s=s||{},Object.keys(s).forEach((function(r){var n=s[r]||[],c=[];n.forEach((function(t){e({val:t,op:r},i,"numeric")||c.push(t)})),c.length!==n.length&&(t=!0),a[r]=c})),n[i]=a,n}),{});return t?n:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:f.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:f.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return f.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:f.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter((function(t){return t!==e}))}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter((function(t){return t!==e}))}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter((function(t){return t.name!==e}))}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:f.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:f.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return f.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:f.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter((function(t){return t!==e}))};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:f.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:f.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:f.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),i={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+r))?-1===t.indexOf(r)?i[e]=[]:i[e]=[t.slice(0,t.lastIndexOf(r))]:i[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},i,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var r={};return r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},r,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:n({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&f.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&f.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&f.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var r=this.getHierarchicalRefinement(e);return t?-1!==r.indexOf(t):r.length>0},isNumericRefined:function(e,t,r){if(void 0===r&&void 0===t)return Boolean(this.numericRefinements[e]);var n=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===r||!n)return n;var s,a,c=o(r),u=void 0!==(s=this.numericRefinements[e][t],a=c,i(s,(function(e){return l(e,a)})));return n&&u},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=s(Object.keys(this.numericRefinements).filter((function(t){return Object.keys(e.numericRefinements[t]).length>0})),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter((function(t){return e.disjunctiveFacetsRefinements[t].length>0})).concat(t).concat(this.getRefinedHierarchicalFacets()).sort()},getRefinedHierarchicalFacets:function(){var e=this;return s(this.hierarchicalFacets.map((function(e){return e.name})),Object.keys(this.hierarchicalFacetsRefinements).filter((function(t){return e.hierarchicalFacetsRefinements[t].length>0}))).sort()},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter((function(t){return-1===e.indexOf(t)}))},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},r=this;return Object.keys(this).forEach((function(n){var i=r[n];-1===e.indexOf(n)&&void 0!==i&&(t[n]=i)})),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var r={};return r[e]=t,this.setQueryParameters(r)},setQueryParameters:function(e){if(!e)return this;var t=m.validate(this,e);if(t)throw t;var r=this,n=m._parseNumbers(e),i=Object.keys(this).reduce((function(e,t){return e[t]=r[t],e}),{}),s=Object.keys(n).reduce((function(e,t){var r=void 0!==e[t],i=void 0!==n[t];return r&&!i?u(e,[t]):(i&&(e[t]=n[t]),e)}),i);return new this.constructor(s)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return i(this.hierarchicalFacets,(function(t){return t.name===e}))},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(r).map((function(e){return e.trim()}))},toString:function(){return JSON.stringify(this,null,2)}},e.exports=m},6673:(e,t,r)=>{"use strict";e.exports=function(e){return function(t,r){var n=e.hierarchicalFacets[r],o=e.hierarchicalFacetsRefinements[n.name]&&e.hierarchicalFacetsRefinements[n.name][0]||"",h=e._getHierarchicalFacetSeparator(n),f=e._getHierarchicalRootPath(n),l=e._getHierarchicalShowParentLevel(n),m=s(e._getHierarchicalFacetSortBy(n)),d=t.every((function(e){return e.exhaustive})),p=function(e,t,r,n,s){return function(o,h,f){var l=o;if(f>0){var m=0;for(l=o;m<f;){var d=l&&Array.isArray(l.data)?l.data:[];l=i(d,(function(e){return e.isRefined})),m++}}if(l){var p=Object.keys(h.data).map((function(e){return[e,h.data[e]]})).filter((function(e){return function(e,t,r,n,i,s){if(i&&(0!==e.indexOf(i)||i===e))return!1;return!i&&-1===e.indexOf(n)||i&&e.split(n).length-i.split(n).length==1||-1===e.indexOf(n)&&-1===r.indexOf(n)||0===r.indexOf(e)||0===e.indexOf(t+n)&&(s||0===e.indexOf(r))}(e[0],l.path||r,s,t,r,n)}));l.data=a(p.map((function(e){var r=e[0];return function(e,t,r,n,i){var s=t.split(r);return{name:s[s.length-1].trim(),path:t,escapedValue:c(t),count:e,isRefined:n===t||0===n.indexOf(t+r),exhaustive:i,data:null}}(e[1],r,t,u(s),h.exhaustive)})),e[0],e[1])}return o}}(m,h,f,l,o),v=t;return f&&(v=t.slice(f.split(h).length)),v.reduce(p,{name:e.hierarchicalFacets[r].name,count:null,isRefined:!0,path:null,escapedValue:null,exhaustive:d,data:null})}};var n=r(2909),i=r(849),s=r(7577),a=r(8601),c=n.escapeFacetValue,u=n.unescapeFacetValue},7691:(e,t,r)=>{"use strict";var n=r(8965),i=r(9110),s=r(2909),a=r(849),c=r(3917),u=r(7577),o=r(4728),h=r(8601),f=s.escapeFacetValue,l=s.unescapeFacetValue,m=r(6673);function d(e){var t={};return e.forEach((function(e,r){t[e]=r})),t}function p(e,t,r){t&&t[r]&&(e.stats=t[r])}function v(e,t,r){var s=t[0];this._rawResults=t;var u=this;Object.keys(s).forEach((function(e){u[e]=s[e]}));var h=o({persistHierarchicalRootCount:!1},r);Object.keys(h).forEach((function(e){u[e]=h[e]})),this.processingTimeMS=t.reduce((function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS}),0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map((function(){return[]})),this.facets=[];var f=e.getRefinedDisjunctiveFacets(),v=d(e.facets),g=d(e.disjunctiveFacets),y=1,R=s.facets||{};Object.keys(R).forEach((function(t){var r,n,i=R[t],o=(r=e.hierarchicalFacets,n=t,a(r,(function(e){return(e.attributes||[]).indexOf(n)>-1})));if(o){var h=o.attributes.indexOf(t),f=c(e.hierarchicalFacets,(function(e){return e.name===o.name}));u.hierarchicalFacets[f][h]={attribute:t,data:i,exhaustive:s.exhaustiveFacetsCount}}else{var l,m=-1!==e.disjunctiveFacets.indexOf(t),d=-1!==e.facets.indexOf(t);m&&(l=g[t],u.disjunctiveFacets[l]={name:t,data:i,exhaustive:s.exhaustiveFacetsCount},p(u.disjunctiveFacets[l],s.facets_stats,t)),d&&(l=v[t],u.facets[l]={name:t,data:i,exhaustive:s.exhaustiveFacetsCount},p(u.facets[l],s.facets_stats,t))}})),this.hierarchicalFacets=n(this.hierarchicalFacets),f.forEach((function(r){var n=t[y],a=n&&n.facets?n.facets:{},h=e.getHierarchicalFacetByName(r);Object.keys(a).forEach((function(t){var r,f=a[t];if(h){r=c(e.hierarchicalFacets,(function(e){return e.name===h.name}));var m=c(u.hierarchicalFacets[r],(function(e){return e.attribute===t}));if(-1===m)return;u.hierarchicalFacets[r][m].data=o({},u.hierarchicalFacets[r][m].data,f)}else{r=g[t];var d=s.facets&&s.facets[t]||{};u.disjunctiveFacets[r]={name:t,data:i({},f,d),exhaustive:n.exhaustiveFacetsCount},p(u.disjunctiveFacets[r],n.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach((function(n){!u.disjunctiveFacets[r].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(l(n))>-1&&(u.disjunctiveFacets[r].data[n]=0)}))}})),y++})),e.getRefinedHierarchicalFacets().forEach((function(r){var n=e.getHierarchicalFacetByName(r),s=e._getHierarchicalFacetSeparator(n),a=e.getHierarchicalRefinement(r);0===a.length||a[0].split(s).length<2||t.slice(y).forEach((function(t){var r=t&&t.facets?t.facets:{};Object.keys(r).forEach((function(t){var o=r[t],h=c(e.hierarchicalFacets,(function(e){return e.name===n.name})),f=c(u.hierarchicalFacets[h],(function(e){return e.attribute===t}));if(-1!==f){var l={};if(a.length>0&&!u.persistHierarchicalRootCount){var m=a[0].split(s)[0];l[m]=u.hierarchicalFacets[h][f].data[m]}u.hierarchicalFacets[h][f].data=i(l,o,u.hierarchicalFacets[h][f].data)}})),y++}))})),Object.keys(e.facetsExcludes).forEach((function(t){var r=e.facetsExcludes[t],n=v[t];u.facets[n]={name:t,data:R[t],exhaustive:s.exhaustiveFacetsCount},r.forEach((function(e){u.facets[n]=u.facets[n]||{name:t},u.facets[n].data=u.facets[n].data||{},u.facets[n].data[e]=0}))})),this.hierarchicalFacets=this.hierarchicalFacets.map(m(e)),this.facets=n(this.facets),this.disjunctiveFacets=n(this.disjunctiveFacets),this._state=e}function g(e,t){function r(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var n=a(e.facets,r);return n?Object.keys(n.data).map((function(r){var i=f(r);return{name:r,escapedValue:i,count:n.data[r],isRefined:e._state.isFacetRefined(t,i),isExcluded:e._state.isExcludeRefined(t,r)}})):[]}if(e._state.isDisjunctiveFacet(t)){var i=a(e.disjunctiveFacets,r);return i?Object.keys(i.data).map((function(r){var n=f(r);return{name:r,escapedValue:n,count:i.data[r],isRefined:e._state.isDisjunctiveFacetRefined(t,n)}})):[]}if(e._state.isHierarchicalFacet(t)){var s=a(e.hierarchicalFacets,r);if(!s)return s;var c=e._state.getHierarchicalFacetByName(t),u=e._state._getHierarchicalFacetSeparator(c),o=l(e._state.getHierarchicalRefinement(t)[0]||"");0===o.indexOf(c.rootPath)&&(o=o.replace(c.rootPath+u,""));var h=o.split(u);return h.unshift(t),y(s,h,0),s}}function y(e,t,r){e.isRefined=e.name===t[r],e.data&&e.data.forEach((function(e){y(e,t,r+1)}))}function R(e,t,r,n){if(n=n||0,Array.isArray(t))return e(t,r[n]);if(!t.data||0===t.data.length)return t;var s=t.data.map((function(t){return R(e,t,r,n+1)})),a=e(s,r[n]);return i({data:a},t)}function F(e,t){var r=a(e,(function(e){return e.name===t}));return r&&r.stats}function b(e,t,r,n,i){var s=a(i,(function(e){return e.name===r})),c=s&&s.data&&s.data[n]?s.data[n]:0,u=s&&s.exhaustive||!1;return{type:t,attributeName:r,name:n,count:c,exhaustive:u}}v.prototype.getFacetByName=function(e){function t(t){return t.name===e}return a(this.facets,t)||a(this.disjunctiveFacets,t)||a(this.hierarchicalFacets,t)},v.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],v.prototype.getFacetValues=function(e,t){var r=g(this,e);if(r){var n,s=i({},t,{sortBy:v.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),a=this;if(Array.isArray(r))n=[e];else n=a._state.getHierarchicalFacetByName(r.name).attributes;return R((function(e,t){if(s.facetOrdering){var r=function(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}(a,t);if(r)return function(e,t){var r=[],n=[],i=(t.order||[]).reduce((function(e,t,r){return e[t]=r,e}),{});e.forEach((function(e){var t=e.path||e.name;void 0!==i[t]?r[i[t]]=e:n.push(e)})),r=r.filter((function(e){return e}));var s,a=t.sortRemainingBy;return"hidden"===a?r:(s="alpha"===a?[["path","name"],["asc","asc"]]:[["count"],["desc"]],r.concat(h(n,s[0],s[1])))}(e,r)}if(Array.isArray(s.sortBy)){var n=u(s.sortBy,v.DEFAULT_SORT);return h(e,n[0],n[1])}if("function"==typeof s.sortBy)return function(e,t){return t.sort(e)}(s.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")}),r,n)}},v.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?F(this.facets,e):this._state.isDisjunctiveFacet(e)?F(this.disjunctiveFacets,e):void 0},v.prototype.getRefinements=function(){var e=this._state,t=this,r=[];return Object.keys(e.facetsRefinements).forEach((function(n){e.facetsRefinements[n].forEach((function(i){r.push(b(e,"facet",n,i,t.facets))}))})),Object.keys(e.facetsExcludes).forEach((function(n){e.facetsExcludes[n].forEach((function(i){r.push(b(e,"exclude",n,i,t.facets))}))})),Object.keys(e.disjunctiveFacetsRefinements).forEach((function(n){e.disjunctiveFacetsRefinements[n].forEach((function(i){r.push(b(e,"disjunctive",n,i,t.disjunctiveFacets))}))})),Object.keys(e.hierarchicalFacetsRefinements).forEach((function(n){e.hierarchicalFacetsRefinements[n].forEach((function(i){r.push(function(e,t,r,n){var i=e.getHierarchicalFacetByName(t),s=e._getHierarchicalFacetSeparator(i),c=r.split(s),u=a(n,(function(e){return e.name===t})),o=c.reduce((function(e,t){var r=e&&a(e.data,(function(e){return e.name===t}));return void 0!==r?r:e}),u),h=o&&o.count||0,f=o&&o.exhaustive||!1,l=o&&o.path||"";return{type:"hierarchical",attributeName:t,name:l,count:h,exhaustive:f}}(e,n,i,t.hierarchicalFacets))}))})),Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t];Object.keys(n).forEach((function(e){n[e].forEach((function(n){r.push({type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})}))}))})),e.tagRefinements.forEach((function(e){r.push({type:"tag",attributeName:"_tags",name:e})})),r},e.exports=v},6571:(e,t,r)=>{"use strict";var n=r(2733),i=r(6732),s=r(2909).escapeFacetValue,a=r(3014),c=r(4728),u=r(317),o=r(1383),h=r(9228),f=r(3371),l=r(7691),m=r(6938);function d(e,t,r,n){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+m+")"),this.setClient(e);var i=r||{};i.index=t,this.state=f.make(i),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._searchResultsOptions=n}function p(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function v(){return this.state.page}a(d,n),d.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},d.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},d.prototype.getQuery=function(){var e=this.state;return h._getHitsSearchParams(e)},d.prototype.searchOnce=function(e,t){var r=e?this.state.setQueryParameters(e):this.state,n=h._getQueries(r.index,r),i=this;if(this._currentNbQueries++,this.emit("searchOnce",{state:r}),!t)return this.client.search(n).then((function(e){return i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),{content:new l(r,e.results),state:r,_originalResponse:e}}),(function(e){throw i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),e}));this.client.search(n).then((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(null,new l(r,e.results),r)})).catch((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(e,null,r)}))},d.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,r=this.derivedHelpers[0];if(!r)return Promise.resolve([]);var n=r.getModifiedState(t),i=c({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:o(h._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),s="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(s);var a=this.client.initIndex(n.index);if("function"!=typeof a.findAnswers)throw new Error(s);return a.findAnswers(n.query,e.queryLanguages,i)},d.prototype.searchForFacetValues=function(e,t,r,n){var i="function"==typeof this.client.searchForFacetValues,a="function"==typeof this.client.initIndex;if(!i&&!a&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var c=this.state.setQueryParameters(n||{}),u=c.isDisjunctiveFacet(e),o=h.getSearchForFacetQuery(e,t,r,c);this._currentNbQueries++;var f,l=this;return i?f=this.client.searchForFacetValues([{indexName:c.index,params:o}]):a?f=this.client.initIndex(c.index).searchForFacetValues(o):(delete o.facetName,f=this.client.search([{type:"facet",facet:e,indexName:c.index,params:o}]).then((function(e){return e.results[0]}))),this.emit("searchForFacetValues",{state:c,facet:e,query:t}),f.then((function(t){return l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),(t=Array.isArray(t)?t[0]:t).facetHits.forEach((function(t){t.escapedValue=s(t.value),t.isRefined=u?c.isDisjunctiveFacetRefined(e,t.escapedValue):c.isFacetRefined(e,t.escapedValue)})),t}),(function(e){throw l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),e}))},d.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},d.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},d.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},d.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},d.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.addNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,r),isPageReset:!0}),this},d.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},d.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},d.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},d.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},d.prototype.removeNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,r),isPageReset:!0}),this},d.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},d.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},d.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},d.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},d.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},d.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},d.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},d.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},d.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},d.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},d.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},d.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},d.prototype.setCurrentPage=p,d.prototype.setPage=p,d.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},d.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},d.prototype.setState=function(e){return this._change({state:f.make(e),isPageReset:!1}),this},d.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new f(e),this},d.prototype.hasRefinements=function(e){return!!u(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},d.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},d.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},d.prototype.hasTag=function(e){return this.state.isTagRefined(e)},d.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},d.prototype.getIndex=function(){return this.state.index},d.prototype.getCurrentPage=v,d.prototype.getPage=v,d.prototype.getTags=function(){return this.state.tagRefinements},d.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e))this.state.getConjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"conjunctive"})})),this.state.getExcludeRefinements(e).forEach((function(e){t.push({value:e,type:"exclude"})}));else if(this.state.isDisjunctiveFacet(e)){this.state.getDisjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"disjunctive"})}))}var r=this.state.getNumericRefinements(e);return Object.keys(r).forEach((function(e){var n=r[e];t.push({value:n,operator:e,type:"numeric"})})),t},d.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},d.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},d.prototype._search=function(e){var t=this.state,r=[],n=[];e.onlyWithDerivedHelpers||(n=h._getQueries(t.index,t),r.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var i=this.derivedHelpers.map((function(e){var n=e.getModifiedState(t),i=n.index?h._getQueries(n.index,n):[];return r.push({state:n,queriesCount:i.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),i})),s=Array.prototype.concat.apply(n,i),a=this._queryId++;if(this._currentNbQueries++,!s.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,r,a));try{this.client.search(s).then(this._dispatchAlgoliaResponse.bind(this,r,a)).catch(this._dispatchAlgoliaError.bind(this,a))}catch(c){this.emit("error",{error:c})}},d.prototype._dispatchAlgoliaResponse=function(e,t,r){var n=this;if(!(t<this._lastQueryIdReceived)){this._currentNbQueries-=t-this._lastQueryIdReceived,this._lastQueryIdReceived=t,0===this._currentNbQueries&&this.emit("searchQueueEmpty");var i=r.results.slice();e.forEach((function(e){var t=e.state,r=e.queriesCount,s=e.helper,a=i.splice(0,r);t.index?(s.lastResults=new l(t,a,n._searchResultsOptions),s.emit("result",{results:s.lastResults,state:t})):s.emit("result",{results:null,state:t})}))}},d.prototype._dispatchAlgoliaError=function(e,t){e<this._lastQueryIdReceived||(this._currentNbQueries-=e-this._lastQueryIdReceived,this._lastQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbQueries&&this.emit("searchQueueEmpty"))},d.prototype.containsRefinement=function(e,t,r,n){return e||0!==t.length||0!==r.length||0!==n.length},d.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},d.prototype._change=function(e){var t=e.state,r=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:r}))},d.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},d.prototype.setClient=function(e){return this.client===e||("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+m+")"),this.client=e),this},d.prototype.getClient=function(){return this.client},d.prototype.derive=function(e){var t=new i(this,e);return this.derivedHelpers.push(t),t},d.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},d.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},e.exports=d},8965:e=>{"use strict";e.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},9110:e=>{"use strict";e.exports=function(){return Array.prototype.slice.call(arguments).reduceRight((function(e,t){return Object.keys(Object(t)).forEach((function(r){void 0!==t[r]&&(void 0!==e[r]&&delete e[r],e[r]=t[r])})),e}),{})}},2909:e=>{"use strict";e.exports={escapeFacetValue:function(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")},unescapeFacetValue:function(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}}},849:e=>{"use strict";e.exports=function(e,t){if(Array.isArray(e))for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}},3917:e=>{"use strict";e.exports=function(e,t){if(!Array.isArray(e))return-1;for(var r=0;r<e.length;r++)if(t(e[r]))return r;return-1}},7577:(e,t,r)=>{"use strict";var n=r(849);e.exports=function(e,t){var r=(t||[]).map((function(e){return e.split(":")}));return e.reduce((function(e,t){var i=t.split(":"),s=n(r,(function(e){return e[0]===i[0]}));return i.length>1||!s?(e[0].push(i[0]),e[1].push(i[1]),e):(e[0].push(s[0]),e[1].push(s[1]),e)}),[[],[]])}},3014:e=>{"use strict";e.exports=function(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}},4843:e=>{"use strict";e.exports=function(e,t){return e.filter((function(r,n){return t.indexOf(r)>-1&&e.indexOf(r)===n}))}},4728:e=>{"use strict";function t(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function r(e,n){if(e===n)return e;for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"__proto__"!==i&&"constructor"!==i){var s=n[i],a=e[i];void 0!==a&&void 0===s||(t(a)&&t(s)?e[i]=r(a,s):e[i]="object"==typeof(c=s)&&null!==c?r(Array.isArray(c)?[]:{},c):c)}var c;return e}e.exports=function(e){t(e)||(e={});for(var n=1,i=arguments.length;n<i;n++){var s=arguments[n];t(s)&&r(e,s)}return e}},317:e=>{"use strict";e.exports=function(e){return e&&Object.keys(e).length>0}},1383:e=>{"use strict";e.exports=function(e,t){if(null===e)return{};var r,n,i={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}},8601:e=>{"use strict";function t(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=void 0!==t,s=null===t;if(!s&&e>t||n&&i||!r)return 1;if(!n&&e<t||s&&r||!i)return-1}return 0}e.exports=function(e,r,n){if(!Array.isArray(e))return[];Array.isArray(n)||(n=[]);var i=e.map((function(e,t){return{criteria:r.map((function(t){return e[t]})),index:t,value:e}}));return i.sort((function(e,r){for(var i=-1;++i<e.criteria.length;){var s=t(e.criteria[i],r.criteria[i]);if(s)return i>=n.length?s:"desc"===n[i]?-s:s}return e.index-r.index})),i.map((function(e){return e.value}))}},7507:e=>{"use strict";e.exports=function e(t){if("number"==typeof t)return t;if("string"==typeof t)return parseFloat(t);if(Array.isArray(t))return t.map(e);throw new Error("The value should be a number, a parsable string or an array of those.")}},9228:(e,t,r)=>{"use strict";var n=r(4728);function i(e){return Object.keys(e).sort().reduce((function(t,r){return t[r]=e[r],t}),{})}var s={_getQueries:function(e,t){var r=[];return r.push({indexName:e,params:s._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach((function(n){r.push({indexName:e,params:s._getDisjunctiveFacetSearchParams(t,n)})})),t.getRefinedHierarchicalFacets().forEach((function(n){var i=t.getHierarchicalFacetByName(n),a=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(i);if(a.length>0&&a[0].split(c).length>1){var u=a[0].split(c).slice(0,-1).reduce((function(e,t,r){return e.concat({attribute:i.attributes[r],value:0===r?t:[e[e.length-1].value,t].join(c)})}),[]);u.forEach((function(n,a){var c=s._getDisjunctiveFacetSearchParams(t,n.attribute,0===a);function o(e){return i.attributes.some((function(t){return t===e.split(":")[0]}))}var h=(c.facetFilters||[]).reduce((function(e,t){if(Array.isArray(t)){var r=t.filter((function(e){return!o(e)}));r.length>0&&e.push(r)}return"string"!=typeof t||o(t)||e.push(t),e}),[]),f=u[a-1];c.facetFilters=a>0?h.concat(f.attribute+":"+f.value):h.length>0?h:void 0,r.push({indexName:e,params:c})}))}})),r},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(s._getHitsHierarchicalFacetsAttributes(e)).sort(),r=s._getFacetFilters(e),a=s._getNumericFilters(e),c=s._getTagFilters(e),u={facets:t.indexOf("*")>-1?["*"]:t,tagFilters:c};return r.length>0&&(u.facetFilters=r),a.length>0&&(u.numericFilters=a),i(n({},e.getQueryParams(),u))},_getDisjunctiveFacetSearchParams:function(e,t,r){var a=s._getFacetFilters(e,t,r),c=s._getNumericFilters(e,t),u=s._getTagFilters(e),o={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};u.length>0&&(o.tagFilters=u);var h=e.getHierarchicalFacetByName(t);return o.facets=h?s._getDisjunctiveHierarchicalFacetAttribute(e,h,r):t,c.length>0&&(o.numericFilters=c),a.length>0&&(o.facetFilters=a),i(n({},e.getQueryParams(),o))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var r=[];return Object.keys(e.numericRefinements).forEach((function(n){var i=e.numericRefinements[n]||{};Object.keys(i).forEach((function(e){var s=i[e]||[];t!==n&&s.forEach((function(t){if(Array.isArray(t)){var i=t.map((function(t){return n+e+t}));r.push(i)}else r.push(n+e+t)}))}))})),r},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,r){var n=[],i=e.facetsRefinements||{};Object.keys(i).sort().forEach((function(e){(i[e]||[]).slice().sort().forEach((function(t){n.push(e+":"+t)}))}));var s=e.facetsExcludes||{};Object.keys(s).sort().forEach((function(e){(s[e]||[]).sort().forEach((function(t){n.push(e+":-"+t)}))}));var a=e.disjunctiveFacetsRefinements||{};Object.keys(a).sort().forEach((function(e){var r=a[e]||[];if(e!==t&&r&&0!==r.length){var i=[];r.slice().sort().forEach((function(t){i.push(e+":"+t)})),n.push(i)}}));var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).sort().forEach((function(i){var s=(c[i]||[])[0];if(void 0!==s){var a,u,o=e.getHierarchicalFacetByName(i),h=e._getHierarchicalFacetSeparator(o),f=e._getHierarchicalRootPath(o);if(t===i){if(-1===s.indexOf(h)||!f&&!0===r||f&&f.split(h).length===s.split(h).length)return;f?(u=f.split(h).length-1,s=f):(u=s.split(h).length-2,s=s.slice(0,s.lastIndexOf(h))),a=o.attributes[u]}else u=s.split(h).length-1,a=o.attributes[u];a&&n.push([a+":"+s])}})),n},_getHitsHierarchicalFacetsAttributes:function(e){return e.hierarchicalFacets.reduce((function(t,r){var n=e.getHierarchicalRefinement(r.name)[0];if(!n)return t.push(r.attributes[0]),t;var i=e._getHierarchicalFacetSeparator(r),s=n.split(i).length,a=r.attributes.slice(0,s+1);return t.concat(a)}),[])},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,r){var n=e._getHierarchicalFacetSeparator(t);if(!0===r){var i=e._getHierarchicalRootPath(t),s=0;return i&&(s=i.split(n).length),[t.attributes[s]]}var a=(e.getHierarchicalRefinement(t.name)[0]||"").split(n).length-1;return t.attributes.slice(0,a+1)},getSearchForFacetQuery:function(e,t,r,a){var c=a.isDisjunctiveFacet(e)?a.clearRefinements(e):a,u={facetQuery:t,facetName:e};return"number"==typeof r&&(u.maxFacetHits=r),i(n({},s._getHitsSearchParams(c),u))}};e.exports=s},2208:e=>{"use strict";e.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},6938:e=>{"use strict";e.exports="3.16.2"},3643:function(e){e.exports=function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach((function(t){e(r,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}function n(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,i=!1,s=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,s=e}finally{try{n||null==c.return||c.return()}finally{if(i)throw s}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function s(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function a(e){var t,r="algoliasearch-client-js-".concat(e.key),n=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},s=function(){return JSON.parse(n().getItem(r)||"{}")},a=function(e){n().setItem(r,JSON.stringify(e))},c=function(){var t=e.timeToLive?1e3*e.timeToLive:null,r=s(),n=Object.fromEntries(Object.entries(r).filter((function(e){return void 0!==i(e,2)[1].timestamp})));if(a(n),t){var c=Object.fromEntries(Object.entries(n).filter((function(e){var r=i(e,2)[1],n=(new Date).getTime();return!(r.timestamp+t<n)})));a(c)}};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){c();var t=JSON.stringify(e);return s()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=i(e,2),n=t[0],s=t[1];return Promise.all([n,s||r.miss(n)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var i=s();return i[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(i)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=s();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function c(e){var t=s(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,i).catch((function(){return c({caches:t}).get(e,n,i)}))},set:function(e,n){return r.set(e,n).catch((function(){return c({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return c({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return c({caches:t}).clear()}))}}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},s=JSON.stringify(r);if(s in t)return Promise.resolve(e.serializable?JSON.parse(t[s]):t[s]);var a=n(),c=i&&i.miss||function(){return Promise.resolve()};return a.then((function(e){return c(e)})).then((function(){return a}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function o(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function h(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function f(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[i++])}))}var l={WithinQueryParameters:0,WithinHeaders:1};function m(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var d={Read:1,Write:2,Any:3},p=1,v=2,g=3;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function R(e){return"string"==typeof e?{protocol:"https",url:e,accept:d.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||d.Any}}var F="GET",b="POST";function j(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(y(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===p||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===g&&Date.now()-e.lastUpdate<=12e4}(e)})),i=[].concat(s(r),s(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:i.length>0?i.map((function(e){return R(e)})):t}}))}function P(e,t,n,i){var a=[],c=function(e,t){if(e.method!==F&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}}(n,i),u=function(e,t){var n=r(r({},e.headers),t.headers),i={};return Object.keys(n).forEach((function(e){var t=n[e];i[e.toLowerCase()]=t})),i}(e,i),o=n.method,h=n.method!==F?{}:r(r({},n.data),i.data),f=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),h),i.queryParameters),l=0,m=function t(r,s){var h=r.pop();if(void 0===h)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:O(a)};var m={data:c,headers:u,method:o,url:_(h,n.path,f),connectTimeout:s(l,e.timeouts.connect),responseTimeout:s(l,i.timeout)},d=function(e){var t={request:m,response:e,host:h,triesLeft:r.length};return a.push(t),t},p={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var i=d(n);return n.isTimedOut&&l++,Promise.all([e.logger.info("Retryable failure",w(i)),e.hostsCache.set(h,y(h,n.isTimedOut?g:v))]).then((function(){return t(r,s)}))},onFail:function(e){throw d(e),function(e,t){var r=e.content,n=e.status,i=r;try{i=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(i,n,t)}(e,O(a))}};return e.requester.send(m).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,p)}))};return j(e.hostsCache,t).then((function(e){return m(s(e.statelessHosts).reverse(),e.getTimeout)}))}function x(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function _(e,t,r){var n=E(r),i="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(i+="?".concat(n)),i}function E(e){return Object.keys(e).map((function(t){return f("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function O(e){return e.map((function(e){return w(e)}))}function w(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var A=function(e){var t=e.appId,n=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===l.WithinHeaders?n:{}},queryParameters:function(){return e===l.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:l.WithinHeaders,t,e.apiKey),s=function(e){var t=e.hostsCache,r=e.logger,n=e.requester,s=e.requestsCache,a=e.responsesCache,c=e.timeouts,u=e.userAgent,o=e.hosts,h=e.queryParameters,f={hostsCache:t,logger:r,requester:n,requestsCache:s,responsesCache:a,timeouts:c,userAgent:u,headers:e.headers,queryParameters:h,hosts:o.map((function(e){return R(e)})),read:function(e,t){var r=m(t,f.timeouts.read),n=function(){return P(f,f.hosts.filter((function(e){return 0!=(e.accept&d.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var s={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(s,(function(){return f.requestsCache.get(s,(function(){return f.requestsCache.set(s,n()).then((function(e){return Promise.all([f.requestsCache.delete(s),e])}),(function(e){return Promise.all([f.requestsCache.delete(s),Promise.reject(e)])})).then((function(e){var t=i(e,2);return t[0],t[1]}))}))}),{miss:function(e){return f.responsesCache.set(s,e)}})},write:function(e,t){return P(f,f.hosts.filter((function(e){return 0!=(e.accept&d.Write)})),e,m(t,f.timeouts.write))}};return f}(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:d.Read},{url:"".concat(t,".algolia.net"),accept:d.Write}].concat(o([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({transporter:s,appId:t,addAlgoliaAgent:function(e,t){s.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([s.requestsCache.clear(),s.responsesCache.clear()]).then((function(){}))}},e.methods)},N=function(e){return function(t,r){return t.method===F?e.transporter.read(t,r):e.transporter.write(t,r)}},H=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h({transporter:e.transporter,appId:e.appId,indexName:t},r.methods)}},S=function(e){return function(t,n){var i=t.map((function(e){return r(r({},e),{},{params:E(e.params||{})})}));return e.transporter.read({method:b,path:"1/indexes/*/queries",data:{requests:i},cacheable:!0},n)}},T=function(e){return function(t,i){return Promise.all(t.map((function(t){var s=t.params,a=s.facetName,c=s.facetQuery,u=n(s,["facetName","facetQuery"]);return H(e)(t.indexName,{methods:{searchForFacetValues:D}}).searchForFacetValues(a,c,r(r({},i),u))})))}},Q=function(e){return function(t,r,n){return e.transporter.read({method:b,path:f("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},C=function(e){return function(t,r){return e.transporter.read({method:b,path:f("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},D=function(e){return function(t,r,n){return e.transporter.read({method:b,path:f("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},I=1,k=2,q=3;function V(e,t,n){var i,s={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,i=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},s=i(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(s),n=i(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(s),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(s),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(i=q,{debug:function(e,t){return I>=i&&console.debug(e,t),Promise.resolve()},info:function(e,t){return k>=i&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:c({caches:[a({key:"".concat("4.22.1","-").concat(e)}),u()]}),userAgent:x("4.22.1").add({segment:"Browser",version:"lite"}),authMode:l.WithinQueryParameters};return A(r(r(r({},s),n),{},{methods:{search:S,searchForFacetValues:T,multipleQueries:S,multipleSearchForFacetValues:T,customRequest:N,initIndex:function(e){return function(t){return H(e)(t,{methods:{search:C,searchForFacetValues:D,findAnswers:Q}})}}}}))}return V.version="4.22.1",V}()},4267:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>S});var n=r(6540),i=r(4164),s=r(4103),a=r.n(s),c=r(3643),u=r.n(c),o=r(1712),h=r(1141),f=r(4783),l=r(4721),m=r(7639);const d=["zero","one","two","few","many","other"];function p(e){return d.filter((t=>e.includes(t)))}const v={locale:"en",pluralForms:p(["one","other"]),select:e=>1===e?"one":"other"};function g(){const{i18n:{currentLocale:e}}=(0,m.A)();return(0,n.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:p(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),v}}),[e])}function y(){const e=g();return{selectMessage:(t,r)=>function(e,t,r){const n=e.split("|");if(1===n.length)return n[0];n.length>r.pluralForms.length&&console.error(`For locale=${r.locale}, a maximum of ${r.pluralForms.length} plural forms are expected (${r.pluralForms.join(",")}), but the message contains ${n.length}: ${e}`);const i=r.select(t),s=r.pluralForms.indexOf(i);return n[Math.min(s,n.length-1)]}(r,t,e)}}var R=r(1142),F=r(4799),b=r(4239),j=r(7942),P=r(3230),x=r(6349),_=r(2177),E=r(7784),O=r(5225);const w={searchQueryInput:"searchQueryInput_u2C7",searchVersionInput:"searchVersionInput_m0Ui",searchResultsColumn:"searchResultsColumn_JPFH",algoliaLogo:"algoliaLogo_rT1R",algoliaLogoPathFill:"algoliaLogoPathFill_WdUC",searchResultItem:"searchResultItem_Tv2o",searchResultItemHeading:"searchResultItemHeading_KbCB",searchResultItemPath:"searchResultItemPath_lhe1",searchResultItemSummary:"searchResultItemSummary_AEaO",searchQueryColumn:"searchQueryColumn_RTkw",searchVersionColumn:"searchVersionColumn_ypXd",searchLogoColumn:"searchLogoColumn_rJIA",loadingSpinner:"loadingSpinner_XVxU","loading-spin":"loading-spin_vzvp",loader:"loader_vvXV"};var A=r(4848);function N(e){let{docsSearchVersionsHelpers:t}=e;const r=Object.entries(t.allDocsData).filter((e=>{let[,t]=e;return t.versions.length>1}));return(0,A.jsx)("div",{className:(0,i.A)("col","col--3","padding-left--none",w.searchVersionColumn),children:r.map((e=>{let[n,i]=e;const s=r.length>1?`${n}: `:"";return(0,A.jsx)("select",{onChange:e=>t.setSearchVersion(n,e.target.value),defaultValue:t.searchVersions[n],className:w.searchVersionInput,children:i.versions.map(((e,t)=>(0,A.jsx)("option",{label:`${s}${e.label}`,value:e.name},t)))},n)}))})}function H(){const{i18n:{currentLocale:e}}=(0,m.A)(),{algolia:{appId:t,apiKey:r,indexName:s,contextualSearch:c}}=(0,x.c)(),d=(0,_.C)(),p=function(){const{selectMessage:e}=y();return t=>e(t,(0,P.T)({id:"theme.SearchPage.documentsFound.plurals",description:'Pluralized label for "{count} documents found". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One document found|{count} documents found"},{count:t}))}(),v=function(){const e=(0,l.Gy)(),[t,r]=(0,n.useState)((()=>Object.entries(e).reduce(((e,t)=>{let[r,n]=t;return{...e,[r]:n.versions[0].name}}),{}))),i=Object.values(e).some((e=>e.versions.length>1));return{allDocsData:e,versioningEnabled:i,searchVersions:t,setSearchVersion:(e,t)=>r((r=>({...r,[e]:t})))}}(),[g,b]=(0,R.b)(),H={items:[],query:null,totalResults:null,totalPages:null,lastPage:null,hasMore:null,loading:null},[S,T]=(0,n.useReducer)(((e,t)=>{switch(t.type){case"reset":return H;case"loading":return{...e,loading:!0};case"update":return g!==t.value.query?e:{...t.value,items:0===t.value.lastPage?t.value.items:e.items.concat(t.value.items)};case"advance":{const t=e.totalPages>e.lastPage+1;return{...e,lastPage:t?e.lastPage+1:e.lastPage,hasMore:t}}default:return e}}),H),Q=c?["language","docusaurus_tag"]:[],C=u()(t,r),D=a()(C,s,{hitsPerPage:15,advancedSyntax:!0,disjunctiveFacets:Q});D.on("result",(e=>{let{results:{query:t,hits:r,page:n,nbHits:i,nbPages:s}}=e;if(""===t||!Array.isArray(r))return void T({type:"reset"});const a=e=>e.replace(/algolia-docsearch-suggestion--highlight/g,"search-result-match"),c=r.map((e=>{let{url:t,_highlightResult:{hierarchy:r},_snippetResult:n={}}=e;const i=Object.keys(r).map((e=>a(r[e].value)));return{title:i.pop(),url:d(t),summary:n.content?`${a(n.content.value)}...`:"",breadcrumbs:i}}));T({type:"update",value:{items:c,query:t,totalResults:i,totalPages:s,lastPage:n,hasMore:s>n+1,loading:!1}})}));const[I,k]=(0,n.useState)(null),q=(0,n.useRef)(0),V=(0,n.useRef)(o.A.canUseIntersectionObserver&&new IntersectionObserver((e=>{const{isIntersecting:t,boundingClientRect:{y:r}}=e[0];t&&q.current>r&&T({type:"advance"}),q.current=r}),{threshold:1})),L=()=>g?(0,P.T)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:g}):(0,P.T)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"}),B=(0,F._q)((function(t){void 0===t&&(t=0),c&&(D.addDisjunctiveFacetRefinement("docusaurus_tag","default"),D.addDisjunctiveFacetRefinement("language",e),Object.entries(v.searchVersions).forEach((e=>{let[t,r]=e;D.addDisjunctiveFacetRefinement("docusaurus_tag",`docs-${t}-${r}`)}))),D.setQuery(g).setPage(t).search()}));return(0,n.useEffect)((()=>{if(!I)return;const e=V.current;return e?(e.observe(I),()=>e.unobserve(I)):()=>!0}),[I]),(0,n.useEffect)((()=>{T({type:"reset"}),g&&(T({type:"loading"}),setTimeout((()=>{B()}),300))}),[g,v.searchVersions,B]),(0,n.useEffect)((()=>{S.lastPage&&0!==S.lastPage&&B(S.lastPage)}),[B,S.lastPage]),(0,A.jsxs)(E.A,{children:[(0,A.jsxs)(h.A,{children:[(0,A.jsx)("title",{children:(0,j.s)(L())}),(0,A.jsx)("meta",{property:"robots",content:"noindex, follow"})]}),(0,A.jsxs)("div",{className:"container margin-vert--lg",children:[(0,A.jsx)(O.A,{as:"h1",children:L()}),(0,A.jsxs)("form",{className:"row",onSubmit:e=>e.preventDefault(),children:[(0,A.jsx)("div",{className:(0,i.A)("col",w.searchQueryColumn,{"col--9":v.versioningEnabled,"col--12":!v.versioningEnabled}),children:(0,A.jsx)("input",{type:"search",name:"q",className:w.searchQueryInput,placeholder:(0,P.T)({id:"theme.SearchPage.inputPlaceholder",message:"Type your search here",description:"The placeholder for search page input"}),"aria-label":(0,P.T)({id:"theme.SearchPage.inputLabel",message:"Search",description:"The ARIA label for search page input"}),onChange:e=>b(e.target.value),value:g,autoComplete:"off",autoFocus:!0})}),c&&v.versioningEnabled&&(0,A.jsx)(N,{docsSearchVersionsHelpers:v})]}),(0,A.jsxs)("div",{className:"row",children:[(0,A.jsx)("div",{className:(0,i.A)("col","col--8",w.searchResultsColumn),children:!!S.totalResults&&p(S.totalResults)}),(0,A.jsx)("div",{className:(0,i.A)("col","col--4","text--right",w.searchLogoColumn),children:(0,A.jsx)(f.A,{to:"https://www.algolia.com/","aria-label":(0,P.T)({id:"theme.SearchPage.algoliaLabel",message:"Search by Algolia",description:"The ARIA label for Algolia mention"}),children:(0,A.jsx)("svg",{viewBox:"0 0 168 24",className:w.algoliaLogo,children:(0,A.jsxs)("g",{fill:"none",children:[(0,A.jsx)("path",{className:w.algoliaLogoPathFill,d:"M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"}),(0,A.jsx)("path",{fill:"#5468FF",d:"M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"}),(0,A.jsx)("path",{fill:"white",d:"M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"})]})})})})]}),S.items.length>0?(0,A.jsx)("main",{children:S.items.map(((e,t)=>{let{title:r,url:n,summary:s,breadcrumbs:a}=e;return(0,A.jsxs)("article",{className:w.searchResultItem,children:[(0,A.jsx)(O.A,{as:"h2",className:w.searchResultItemHeading,children:(0,A.jsx)(f.A,{to:n,dangerouslySetInnerHTML:{__html:r}})}),a.length>0&&(0,A.jsx)("nav",{"aria-label":"breadcrumbs",children:(0,A.jsx)("ul",{className:(0,i.A)("breadcrumbs",w.searchResultItemPath),children:a.map(((e,t)=>(0,A.jsx)("li",{className:"breadcrumbs__item",dangerouslySetInnerHTML:{__html:e}},t)))})}),s&&(0,A.jsx)("p",{className:w.searchResultItemSummary,dangerouslySetInnerHTML:{__html:s}})]},t)}))}):[g&&!S.loading&&(0,A.jsx)("p",{children:(0,A.jsx)(P.A,{id:"theme.SearchPage.noResultsText",description:"The paragraph for empty search result",children:"No results were found"})},"no-results"),!!S.loading&&(0,A.jsx)("div",{className:w.loadingSpinner},"spinner")],S.hasMore&&(0,A.jsx)("div",{className:w.loader,ref:k,children:(0,A.jsx)(P.A,{id:"theme.SearchPage.fetchingNewResults",description:"The paragraph for fetching new search results",children:"Fetching new results..."})})]})]})}function S(){return(0,A.jsx)(b.e3,{className:"search-page-wrapper",children:(0,A.jsx)(H,{})})}}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.ad537829.js.LICENSE.txt b/assets/js/1a4e3797.ad537829.js.LICENSE.txt deleted file mode 100644 index 9caab8b19c..0000000000 --- a/assets/js/1a4e3797.ad537829.js.LICENSE.txt +++ /dev/null @@ -1 +0,0 @@ -/*! algoliasearch-lite.umd.js | 4.22.1 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */ diff --git a/assets/js/1a5572f6.22ecf73b.js b/assets/js/1a5572f6.22ecf73b.js deleted file mode 100644 index 7de8017c9e..0000000000 --- a/assets/js/1a5572f6.22ecf73b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3676],{2315:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-14.0/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/14.0/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/angular-ivy.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.0/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.0/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"angular-ivy",title:"Angular Ivy"},u=void 0,c={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=u??f;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(u(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1a5572f6.6ebec477.js b/assets/js/1a5572f6.6ebec477.js new file mode 100644 index 0000000000..6aadb5c43e --- /dev/null +++ b/assets/js/1a5572f6.6ebec477.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3676],{1037:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-14.0/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/14.0/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/angular-ivy.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.0/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.0/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"angular-ivy",title:"Angular Ivy"},u=void 0,c={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=u??f;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(u(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1d8e39f8.28a9d5a6.js b/assets/js/1d8e39f8.28a9d5a6.js deleted file mode 100644 index 2bf392063f..0000000000 --- a/assets/js/1d8e39f8.28a9d5a6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4611],{840:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-14.4/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/jsdom-version.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/guides/esm-support"},"next":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/guides/snapshot-testing"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=f({queryString:n,groupId:s}),[h,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),b=(()=>{const e=u??h;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{b&&l(b)}),[b]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,o]),tabValues:o}}var g=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",b.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=h(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1d8e39f8.de7224df.js b/assets/js/1d8e39f8.de7224df.js new file mode 100644 index 0000000000..0209589833 --- /dev/null +++ b/assets/js/1d8e39f8.de7224df.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4611],{365:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-14.4/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/jsdom-version.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/guides/esm-support"},"next":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/guides/snapshot-testing"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=f({queryString:n,groupId:s}),[h,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),b=(()=>{const e=u??h;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{b&&l(b)}),[b]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,o]),tabValues:o}}var g=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",b.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=h(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1df93b7f.0ac154cb.js b/assets/js/1df93b7f.9d5da231.js similarity index 96% rename from assets/js/1df93b7f.0ac154cb.js rename to assets/js/1df93b7f.9d5da231.js index ffecacdf7f..6e5f6fbbe6 100644 --- a/assets/js/1df93b7f.0ac154cb.js +++ b/assets/js/1df93b7f.9d5da231.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4583],{7521:(e,t,n)=>{n.r(t),n.d(t,{default:()=>m});var s=n(4783),a=n(3230),i=n(8180),r=n(7639),c=n(7784),o=n(4164);n(6540);const l={section:"section_rC2D",sectionAlt:"sectionAlt_XiGz",sectionInner:"sectionInner_Y4r1",featureImage:"featureImage_yA8i",featureHeading:"featureHeading_TLGJ",announcement:"announcement_FsS0",announcementDark:"announcementDark_tzC4",announcementInner:"announcementInner_RsrQ",hero:"hero_syme",heroInner:"heroInner_VWeJ",heroProjectTagline:"heroProjectTagline_EkV5",heroTitleTextHtml:"heroTitleTextHtml_zYwv",heroLogo:"heroLogo_jM6J",jackInTheBox:"jackInTheBox_S9I6",indexCtas:"indexCtas_hUA_",indexCtasGetStartedButton:"indexCtasGetStartedButton_UQaK",indexCtasGitHubButtonWrapper:"indexCtasGitHubButtonWrapper_AOht",indexCtasGitHubButton:"indexCtasGitHubButton_sMIS",indexCtaTryNowButton:"indexCtaTryNowButton_wlFR"};var d=n(4848);const u=[{title:"Easy to Use",description:(0,d.jsx)(d.Fragment,{children:"Jest presets to let you start quickly with testing."})},{title:"View Engine/Ivy",description:(0,d.jsx)(d.Fragment,{children:"Support both Angular View Engine and Angular Ivy."})},{title:"Babel support",description:(0,d.jsx)(d.Fragment,{children:"Support working in combination with Babel"})}];function h(e){let{imageUrl:t,title:n,description:s}=e;const a=(0,i.Ay)(t);return(0,d.jsxs)("div",{className:(0,o.A)("col",l.section),children:[a&&(0,d.jsx)("div",{className:"text--center",children:(0,d.jsx)("img",{className:l.featureImage,src:a,alt:n})}),(0,d.jsx)("h3",{className:(0,o.A)(l.featureHeading),children:n}),(0,d.jsx)("p",{className:"padding-horiz--md",children:s})]})}const m=function(){const e=(0,r.A)(),{siteConfig:{tagline:t}={}}=e;return(0,d.jsxs)(c.A,{title:t,description:t,children:[(0,d.jsxs)("header",{children:[(0,d.jsx)("div",{className:l.hero,children:(0,d.jsxs)("div",{className:l.heroInner,children:[(0,d.jsxs)("h1",{className:l.heroProjectTagline,children:[(0,d.jsx)("img",{alt:(0,a.T)({message:"Docusaurus with Keytar"}),className:l.heroLogo,src:(0,i.Ay)("/img/logo.svg")}),(0,d.jsxs)("span",{className:l.heroTitleTextHtml,children:["Delightful testing with ",(0,d.jsx)("b",{children:"Jest"})," and ",(0,d.jsx)("b",{children:"Angular"})]})]}),(0,d.jsxs)("div",{className:l.indexCtas,children:[(0,d.jsx)(s.A,{className:(0,o.A)("button button--primary button--lg"),to:(0,i.Ay)("docs/"),children:"Get Started"}),(0,d.jsx)("span",{className:l.indexCtasGitHubButtonWrapper,children:(0,d.jsx)("iframe",{className:l.indexCtasGitHubButton,src:"https://ghbtns.com/github-btn.html?user=thymikee&repo=jest-preset-angular&type=star&count=true&size=large",width:160,height:30,title:"GitHub Stars"})})]})]})}),(0,d.jsxs)("div",{className:(0,o.A)(l.announcement,l.announcementDark),children:[(0,d.jsxs)("div",{className:l.announcementInner,children:["Angular Ivy? Check out our ",(0,d.jsx)(s.A,{to:"/docs/guides/angular-ivy",children:"Angular Ivy guidance"}),"."]}),(0,d.jsxs)("div",{className:l.announcementInner,children:["Migrate to Angular ",">","=13? Check out our"," ",(0,d.jsxs)(s.A,{to:"/docs/guides/angular-13+",children:["Angular ",">","=13 guidance"]}),"."]})]})]}),(0,d.jsx)("main",{children:u?.length&&(0,d.jsx)("section",{className:l.section,children:(0,d.jsx)("div",{className:"container text--center",children:(0,d.jsx)("div",{className:"row",children:u.map(((e,t)=>(0,d.jsx)(h,{imageUrl:"",...e},t)))})})})})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4583],{9008:(e,t,n)=>{n.r(t),n.d(t,{default:()=>m});var s=n(8774),a=n(1312),i=n(6025),r=n(4586),c=n(1957),o=n(4164);n(6540);const l={section:"section_rC2D",sectionAlt:"sectionAlt_XiGz",sectionInner:"sectionInner_Y4r1",featureImage:"featureImage_yA8i",featureHeading:"featureHeading_TLGJ",announcement:"announcement_FsS0",announcementDark:"announcementDark_tzC4",announcementInner:"announcementInner_RsrQ",hero:"hero_syme",heroInner:"heroInner_VWeJ",heroProjectTagline:"heroProjectTagline_EkV5",heroTitleTextHtml:"heroTitleTextHtml_zYwv",heroLogo:"heroLogo_jM6J",jackInTheBox:"jackInTheBox_S9I6",indexCtas:"indexCtas_hUA_",indexCtasGetStartedButton:"indexCtasGetStartedButton_UQaK",indexCtasGitHubButtonWrapper:"indexCtasGitHubButtonWrapper_AOht",indexCtasGitHubButton:"indexCtasGitHubButton_sMIS",indexCtaTryNowButton:"indexCtaTryNowButton_wlFR"};var d=n(4848);const u=[{title:"Easy to Use",description:(0,d.jsx)(d.Fragment,{children:"Jest presets to let you start quickly with testing."})},{title:"View Engine/Ivy",description:(0,d.jsx)(d.Fragment,{children:"Support both Angular View Engine and Angular Ivy."})},{title:"Babel support",description:(0,d.jsx)(d.Fragment,{children:"Support working in combination with Babel"})}];function h(e){let{imageUrl:t,title:n,description:s}=e;const a=(0,i.Ay)(t);return(0,d.jsxs)("div",{className:(0,o.A)("col",l.section),children:[a&&(0,d.jsx)("div",{className:"text--center",children:(0,d.jsx)("img",{className:l.featureImage,src:a,alt:n})}),(0,d.jsx)("h3",{className:(0,o.A)(l.featureHeading),children:n}),(0,d.jsx)("p",{className:"padding-horiz--md",children:s})]})}const m=function(){const e=(0,r.A)(),{siteConfig:{tagline:t}={}}=e;return(0,d.jsxs)(c.A,{title:t,description:t,children:[(0,d.jsxs)("header",{children:[(0,d.jsx)("div",{className:l.hero,children:(0,d.jsxs)("div",{className:l.heroInner,children:[(0,d.jsxs)("h1",{className:l.heroProjectTagline,children:[(0,d.jsx)("img",{alt:(0,a.T)({message:"Docusaurus with Keytar"}),className:l.heroLogo,src:(0,i.Ay)("/img/logo.svg")}),(0,d.jsxs)("span",{className:l.heroTitleTextHtml,children:["Delightful testing with ",(0,d.jsx)("b",{children:"Jest"})," and ",(0,d.jsx)("b",{children:"Angular"})]})]}),(0,d.jsxs)("div",{className:l.indexCtas,children:[(0,d.jsx)(s.A,{className:(0,o.A)("button button--primary button--lg"),to:(0,i.Ay)("docs/"),children:"Get Started"}),(0,d.jsx)("span",{className:l.indexCtasGitHubButtonWrapper,children:(0,d.jsx)("iframe",{className:l.indexCtasGitHubButton,src:"https://ghbtns.com/github-btn.html?user=thymikee&repo=jest-preset-angular&type=star&count=true&size=large",width:160,height:30,title:"GitHub Stars"})})]})]})}),(0,d.jsxs)("div",{className:(0,o.A)(l.announcement,l.announcementDark),children:[(0,d.jsxs)("div",{className:l.announcementInner,children:["Angular Ivy? Check out our ",(0,d.jsx)(s.A,{to:"/docs/guides/angular-ivy",children:"Angular Ivy guidance"}),"."]}),(0,d.jsxs)("div",{className:l.announcementInner,children:["Migrate to Angular ",">","=13? Check out our"," ",(0,d.jsxs)(s.A,{to:"/docs/guides/angular-13+",children:["Angular ",">","=13 guidance"]}),"."]})]})]}),(0,d.jsx)("main",{children:u?.length&&(0,d.jsx)("section",{className:l.section,children:(0,d.jsx)("div",{className:"container text--center",children:(0,d.jsx)("div",{className:"row",children:u.map(((e,t)=>(0,d.jsx)(h,{imageUrl:"",...e},t)))})})})})]})}}}]); \ No newline at end of file diff --git a/assets/js/1e388ac9.a696ff9b.js b/assets/js/1e388ac9.a696ff9b.js deleted file mode 100644 index e294e88c1c..0000000000 --- a/assets/js/1e388ac9.a696ff9b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6969],{8286:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-14.2/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/14.2/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/getting-started/presets.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.2/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/14.2/getting-started/options"}}');var r=n(4848),a=n(8453),o=n(9489),l=n(7227);const i={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"transform"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"transform"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { defaultTransformerOptions } = require('jest-preset-angular/presets');\n// const { defaultTransformerOptions } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),o=n(6347),l=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:r}),[g,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{j&&i(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=l[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:l.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>l});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1e388ac9.ea3c7fd8.js b/assets/js/1e388ac9.ea3c7fd8.js new file mode 100644 index 0000000000..94ed86be4e --- /dev/null +++ b/assets/js/1e388ac9.ea3c7fd8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6969],{8449:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-14.2/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/14.2/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/getting-started/presets.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.2/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/14.2/getting-started/options"}}');var r=n(4848),a=n(8453),o=n(1470),l=n(9365);const i={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"transform"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"transform"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { defaultTransformerOptions } = require('jest-preset-angular/presets');\n// const { defaultTransformerOptions } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),o=n(6347),l=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:r}),[g,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{j&&i(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=l[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:l.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>l});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/203fc93e.7717a5e9.js b/assets/js/203fc93e.7717a5e9.js deleted file mode 100644 index 8d678c4a75..0000000000 --- a/assets/js/203fc93e.7717a5e9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6038],{9121:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-14.2/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/14.2/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/angular-ivy.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.2/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.2/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"angular-ivy",title:"Angular Ivy"},u=void 0,c={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["to your root ",(0,s.jsx)(t.code,{children:"jest.config.js"})]}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=u??f;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(u(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/203fc93e.bdb97e17.js b/assets/js/203fc93e.bdb97e17.js new file mode 100644 index 0000000000..3bf18d1b49 --- /dev/null +++ b/assets/js/203fc93e.bdb97e17.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6038],{647:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-14.2/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/14.2/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/angular-ivy.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.2/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.2/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"angular-ivy",title:"Angular Ivy"},u=void 0,c={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["to your root ",(0,s.jsx)(t.code,{children:"jest.config.js"})]}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=u??f;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(u(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/2560.7545f406.js b/assets/js/2237.c581d9e3.js similarity index 80% rename from assets/js/2560.7545f406.js rename to assets/js/2237.c581d9e3.js index 60a223ca06..e754528e94 100644 --- a/assets/js/2560.7545f406.js +++ b/assets/js/2237.c581d9e3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2560],{3510:(e,t,i)=>{i.d(t,{A:()=>a});i(6540);var n=i(4164),s=i(3230),o=i(5225),r=i(4848);function a(e){let{className:t}=e;return(0,r.jsx)("main",{className:(0,n.A)("container margin-vert--xl",t),children:(0,r.jsx)("div",{className:"row",children:(0,r.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,r.jsx)(o.A,{as:"h1",className:"hero__title",children:(0,r.jsx)(s.A,{id:"theme.NotFound.title",description:"The title of the 404 page",children:"Page Not Found"})}),(0,r.jsx)("p",{children:(0,r.jsx)(s.A,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page",children:"We could not find what you were looking for."})}),(0,r.jsx)("p",{children:(0,r.jsx)(s.A,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page",children:"Please contact the owner of the site that linked you to the original URL and let them know their link is broken."})})]})})})}},2560:(e,t,i)=>{i.r(t),i.d(t,{default:()=>l});i(6540);var n=i(3230),s=i(4239),o=i(7784),r=i(3510),a=i(4848);function l(){const e=(0,n.T)({id:"theme.NotFound.title",message:"Page Not Found"});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.be,{title:e}),(0,a.jsx)(o.A,{children:(0,a.jsx)(r.A,{})})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2237],{3363:(e,t,i)=>{i.d(t,{A:()=>a});i(6540);var n=i(4164),s=i(1312),o=i(1107),r=i(4848);function a(e){let{className:t}=e;return(0,r.jsx)("main",{className:(0,n.A)("container margin-vert--xl",t),children:(0,r.jsx)("div",{className:"row",children:(0,r.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,r.jsx)(o.A,{as:"h1",className:"hero__title",children:(0,r.jsx)(s.A,{id:"theme.NotFound.title",description:"The title of the 404 page",children:"Page Not Found"})}),(0,r.jsx)("p",{children:(0,r.jsx)(s.A,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page",children:"We could not find what you were looking for."})}),(0,r.jsx)("p",{children:(0,r.jsx)(s.A,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page",children:"Please contact the owner of the site that linked you to the original URL and let them know their link is broken."})})]})})})}},2237:(e,t,i)=>{i.r(t),i.d(t,{default:()=>l});i(6540);var n=i(1312),s=i(9024),o=i(1957),r=i(3363),a=i(4848);function l(){const e=(0,n.T)({id:"theme.NotFound.title",message:"Page Not Found"});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.be,{title:e}),(0,a.jsx)(o.A,{children:(0,a.jsx)(r.A,{})})]})}}}]); \ No newline at end of file diff --git a/assets/js/22e4d634.5953e3db.js b/assets/js/22e4d634.5953e3db.js deleted file mode 100644 index 34e8610b6e..0000000000 --- a/assets/js/22e4d634.5953e3db.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5559],{4314:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-10.x/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/10.x/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/troubleshooting.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/10.x/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/22e4d634.6f42655d.js b/assets/js/22e4d634.6f42655d.js new file mode 100644 index 0000000000..89dca5d836 --- /dev/null +++ b/assets/js/22e4d634.6f42655d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5559],{9153:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-10.x/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/10.x/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/troubleshooting.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/10.x/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9828.03c26e5d.js b/assets/js/2362.a90cc913.js similarity index 88% rename from assets/js/9828.03c26e5d.js rename to assets/js/2362.a90cc913.js index c63c971ca3..0f43867d61 100644 --- a/assets/js/9828.03c26e5d.js +++ b/assets/js/2362.a90cc913.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9828],{9828:(e,t,o)=>{o.r(t),o.d(t,{default:()=>i});var n=o(6540),a=o(4164),s=o(3230);const l={popup:"popup_wph0",buttonContainer:"buttonContainer_ox5C"};var r=o(4848);function i(e){let{onReload:t}=e;const[o,i]=(0,n.useState)(!0);return o&&(0,r.jsxs)("div",{className:(0,a.A)("alert","alert--secondary",l.popup),children:[(0,r.jsx)("p",{children:(0,r.jsx)(s.A,{id:"theme.PwaReloadPopup.info",description:"The text for PWA reload popup",children:"New version available"})}),(0,r.jsxs)("div",{className:l.buttonContainer,children:[(0,r.jsx)("button",{className:"button button--link",type:"button",onClick:()=>{i(!1),t()},children:(0,r.jsx)(s.A,{id:"theme.PwaReloadPopup.refreshButtonText",description:"The text for PWA reload button",children:"Refresh"})}),(0,r.jsx)("button",{"aria-label":(0,s.T)({id:"theme.PwaReloadPopup.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of PWA reload popup"}),className:"close",type:"button",onClick:()=>i(!1),children:(0,r.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2362],{2362:(e,t,o)=>{o.r(t),o.d(t,{default:()=>i});var n=o(6540),a=o(4164),s=o(1312);const l={popup:"popup_wph0",buttonContainer:"buttonContainer_ox5C"};var r=o(4848);function i(e){let{onReload:t}=e;const[o,i]=(0,n.useState)(!0);return o&&(0,r.jsxs)("div",{className:(0,a.A)("alert","alert--secondary",l.popup),children:[(0,r.jsx)("p",{children:(0,r.jsx)(s.A,{id:"theme.PwaReloadPopup.info",description:"The text for PWA reload popup",children:"New version available"})}),(0,r.jsxs)("div",{className:l.buttonContainer,children:[(0,r.jsx)("button",{className:"button button--link",type:"button",onClick:()=>{i(!1),t()},children:(0,r.jsx)(s.A,{id:"theme.PwaReloadPopup.refreshButtonText",description:"The text for PWA reload button",children:"Refresh"})}),(0,r.jsx)("button",{"aria-label":(0,s.T)({id:"theme.PwaReloadPopup.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of PWA reload popup"}),className:"close",type:"button",onClick:()=>i(!1),children:(0,r.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]})]})}}}]); \ No newline at end of file diff --git a/assets/js/252e2b80.534b45e9.js b/assets/js/252e2b80.534b45e9.js new file mode 100644 index 0000000000..ad627f9eb2 --- /dev/null +++ b/assets/js/252e2b80.534b45e9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8955],{8227:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>a});const t=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-10.x/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/10.x/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/getting-started/options.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/10.x/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/10.x/getting-started/test-environment"}}');var o=s(4848),r=s(8453);const i={id:"options",title:"Options"},c=void 0,d={},a=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function l(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(n.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(n.p,{children:["More information about ",(0,o.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsxs)(n.admonition,{type:"important",children:[(0,o.jsxs)(n.p,{children:["Since ",(0,o.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,o.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,o.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,o.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config"]}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})]}),"\n",(0,o.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"const snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n testEnvironment: 'jsdom',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': 'jest-preset-angular',\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json'],\n snapshotSerializers,\n};\n"})}),"\n",(0,o.jsx)(n.admonition,{type:"important",children:(0,o.jsxs)(n.p,{children:["Jest runs with ",(0,o.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,o.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,o.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,o.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["we're using some ",(0,o.jsx)(n.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,o.jsx)(n.code,{children:"TS"}),", ",(0,o.jsx)(n.code,{children:"JS"}),", ",(0,o.jsx)(n.code,{children:"MJS"}),", ",(0,o.jsx)(n.code,{children:"HTML"}),", or ",(0,o.jsx)(n.code,{children:"SVG"})," file through so called ",(0,o.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(n.code,{children:"ts"}),"), HTML (",(0,o.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(n.code,{children:"js"}),") and JSON (",(0,o.jsx)(n.code,{children:"json"}),") files."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses regex."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>c});var t=s(6540);const o={},r=t.createContext(o);function i(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/26cb42b7.9b793bb7.js b/assets/js/26cb42b7.9b793bb7.js new file mode 100644 index 0000000000..dfa8584db0 --- /dev/null +++ b/assets/js/26cb42b7.9b793bb7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[179],{477:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-14.0/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/14.0/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/esm-support.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.0/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.0/guides/jsdom-version"}}');var r=s(4848),a=s(8453),o=s(1470),i=s(9365);const l={id:"esm-support",title:"ESM Support"},u=void 0,c={},d=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/14.0/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsxs)(t.p,{children:["Besides, there is ",(0,r.jsx)(t.code,{children:"setup-jest.mjs"})," to add to Jest setup file to ensure that Jest can set up test environment properly."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html)$',\n useESM: true,\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},1470:(e,t,s)=>{s.d(t,{A:()=>S});var n=s(6540),r=s(4164),a=s(3104),o=s(6347),i=s(205),l=s(7485),u=s(1682),c=s(679);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,l.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[u,d]=m({queryString:s,groupId:r}),[f,g]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),j=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=s(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,s=l.indexOf(t),r=i[s].value;r!==n&&(u(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;t=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;t=l[s]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:i.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>i});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/26cb42b7.ca0b9bce.js b/assets/js/26cb42b7.ca0b9bce.js deleted file mode 100644 index c91b446afe..0000000000 --- a/assets/js/26cb42b7.ca0b9bce.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[179],{9300:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-14.0/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/14.0/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/esm-support.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.0/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.0/guides/jsdom-version"}}');var r=s(4848),a=s(8453),o=s(9489),i=s(7227);const l={id:"esm-support",title:"ESM Support"},u=void 0,c={},d=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/14.0/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsxs)(t.p,{children:["Besides, there is ",(0,r.jsx)(t.code,{children:"setup-jest.mjs"})," to add to Jest setup file to ensure that Jest can set up test environment properly."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html)$',\n useESM: true,\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},9489:(e,t,s)=>{s.d(t,{A:()=>S});var n=s(6540),r=s(4164),a=s(4245),o=s(6347),i=s(6494),l=s(2814),u=s(5167),c=s(9900);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,l.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[u,d]=m({queryString:s,groupId:r}),[f,g]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),j=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=s(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,s=l.indexOf(t),r=i[s].value;r!==n&&(u(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;t=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;t=l[s]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:i.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>i});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/27299a3b.0baa2ff1.js b/assets/js/27299a3b.0baa2ff1.js deleted file mode 100644 index ac78bd01ec..0000000000 --- a/assets/js/27299a3b.0baa2ff1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7036],{3661:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-9.x/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/9.x/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/getting-started/installation.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/9.x/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/9.x/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/27299a3b.22bdc7e3.js b/assets/js/27299a3b.22bdc7e3.js new file mode 100644 index 0000000000..84070515c4 --- /dev/null +++ b/assets/js/27299a3b.22bdc7e3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7036],{7536:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-9.x/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/9.x/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/getting-started/installation.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/9.x/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/9.x/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/27af8d7b.85d2d0c3.js b/assets/js/27af8d7b.85d2d0c3.js new file mode 100644 index 0000000000..c82539aace --- /dev/null +++ b/assets/js/27af8d7b.85d2d0c3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4868],{337:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-14.3/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/14.3/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/esm-support.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.3/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.3/guides/jsdom-version"}}');var r=t(4848),o=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["To use ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(s.code,{children:"ts-jest"})," config option ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["There is also a ",(0,r.jsx)(s.a,{href:"/jest-preset-angular/docs/14.3/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(s.admonition,{type:"tip",children:(0,r.jsxs)(s.p,{children:["We have ",(0,r.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsx)(s.p,{children:"Besides, there is utility function to ensure that Jest can set up test environment properly."}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})}),"\n",(0,r.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(s.admonition,{type:"tip",children:[(0,r.jsxs)(s.p,{children:["Jest will attempt to load ",(0,r.jsx)(s.strong,{children:"ESM"})," files from ",(0,r.jsx)(s.code,{children:"node_modules"})," with default ",(0,r.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(s.strong,{children:"ESM"})," built files or ",(0,r.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(s.p,{children:["To fix that, one can use ",(0,r.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})]})}function p(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const r={},o=n.createContext(r);function i(e){const s=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/27af8d7b.9de1f2c2.js b/assets/js/27af8d7b.9de1f2c2.js deleted file mode 100644 index f5c2c60962..0000000000 --- a/assets/js/27af8d7b.9de1f2c2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4868],{4119:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-14.3/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/14.3/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/esm-support.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.3/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.3/guides/jsdom-version"}}');var r=t(4848),o=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["To use ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(s.code,{children:"ts-jest"})," config option ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["There is also a ",(0,r.jsx)(s.a,{href:"/jest-preset-angular/docs/14.3/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(s.admonition,{type:"tip",children:(0,r.jsxs)(s.p,{children:["We have ",(0,r.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsx)(s.p,{children:"Besides, there is utility function to ensure that Jest can set up test environment properly."}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})}),"\n",(0,r.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(s.admonition,{type:"tip",children:[(0,r.jsxs)(s.p,{children:["Jest will attempt to load ",(0,r.jsx)(s.strong,{children:"ESM"})," files from ",(0,r.jsx)(s.code,{children:"node_modules"})," with default ",(0,r.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(s.strong,{children:"ESM"})," built files or ",(0,r.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(s.p,{children:["To fix that, one can use ",(0,r.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})]})}function p(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const r={},o=n.createContext(r);function i(e){const s=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/29d26392.11552c90.js b/assets/js/29d26392.11552c90.js new file mode 100644 index 0000000000..f2317c6d58 --- /dev/null +++ b/assets/js/29d26392.11552c90.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8626],{4736:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-11.1/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/11.1/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/getting-started/presets.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/11.1/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/11.1/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},l=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function c(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:["Or through TypeScript (if ",(0,r.jsx)(t.code,{children:"ts-node"})," is installed):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// jest.config.ts\nimport type { InitialOptionsTsJest } from 'ts-jest/dist/types';\nimport { defaults as jestNgPreset } from 'jest-preset-angular/presets';\n// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'\n\nconst config: InitialOptionsTsJest = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default config;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/29d26392.5eb3a2bf.js b/assets/js/29d26392.5eb3a2bf.js deleted file mode 100644 index 072085bbfd..0000000000 --- a/assets/js/29d26392.5eb3a2bf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8626],{5152:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-11.1/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/11.1/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/getting-started/presets.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/11.1/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/11.1/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},l=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function c(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:["Or through TypeScript (if ",(0,r.jsx)(t.code,{children:"ts-node"})," is installed):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// jest.config.ts\nimport type { InitialOptionsTsJest } from 'ts-jest/dist/types';\nimport { defaults as jestNgPreset } from 'jest-preset-angular/presets';\n// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'\n\nconst config: InitialOptionsTsJest = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default config;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/2a474b18.80846051.js b/assets/js/2a474b18.80846051.js new file mode 100644 index 0000000000..4f80b2c758 --- /dev/null +++ b/assets/js/2a474b18.80846051.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2822],{1898:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>j,frontMatter:()=>c,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"In Jest, a test environment defines the sandbox context in which your tests run.","source":"@site/versioned_docs/version-14.3/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/14.3/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/getting-started/test-environment.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/14.3/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.3/guides/angular-ivy"}}');var i=n(4848),r=n(8453),o=n(1470),l=n(9365),a=n(4252);const c={id:"test-environment",title:"Test environment"},p=void 0,d={},u=[{value:"Functions",id:"functions",level:2},{value:"<code>setupZoneTestEnv(options)</code>",id:"setupzonetestenvoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Example:",id:"example",level:4},{value:"<code>setupZonelessTestEnv(options)</code>",id:"setupzonelesstestenvoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Example:",id:"example-1",level:4}];function h(e){const t={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.p,{children:"In Jest, a test environment defines the sandbox context in which your tests run.\nFor Angular projects, setting up the correct test environment is essential to ensure compatibility with the\nframework-specific features, such as dependency injection and change detection."}),"\n",(0,i.jsxs)(t.p,{children:[(0,i.jsx)(t.code,{children:"jest-preset-angular"})," provides utility functions to simplify setting up a Jest test environment tailored for Angular projects.\nThese functions support both ",(0,i.jsx)(t.strong,{children:"zone-based"})," and ",(0,i.jsx)(t.strong,{children:"zoneless"})," environments, catering to different testing needs."]}),"\n",(0,i.jsx)(t.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,i.jsx)(a.A,{toc:u.slice(1)}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h3,{id:"setupzonetestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZoneTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that uses ",(0,i.jsx)(t.code,{children:"zone.js"}),", which is the mechanism for tracking asynchronous operations.\nIt is suitable for most Angular applications that rely on ",(0,i.jsx)(t.code,{children:"zone.js"})," for change detection and other framework features."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(t.h3,{id:"setupzonelesstestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZonelessTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that ",(0,i.jsx)(t.strong,{children:"DOESN'T"})," use ",(0,i.jsx)(t.code,{children:"zone.js"}),", as described in ",(0,i.jsx)(t.a,{href:"https://angular.dev/guide/experimental/zoneless",children:"Angular experimental zoneless guide"}),".\nIt is designed for projects that have disabled ",(0,i.jsx)(t.code,{children:"zone.js"}),", which can lead to improved performance and simplified testing."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example-1",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless/index.mjs';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}}}]); \ No newline at end of file diff --git a/assets/js/2a474b18.cfe459b8.js b/assets/js/2a474b18.cfe459b8.js deleted file mode 100644 index a687f44598..0000000000 --- a/assets/js/2a474b18.cfe459b8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2822],{2853:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>j,frontMatter:()=>c,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"In Jest, a test environment defines the sandbox context in which your tests run.","source":"@site/versioned_docs/version-14.3/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/14.3/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/getting-started/test-environment.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/14.3/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.3/guides/angular-ivy"}}');var i=n(4848),r=n(8453),o=n(9489),l=n(7227),a=n(1574);const c={id:"test-environment",title:"Test environment"},p=void 0,d={},u=[{value:"Functions",id:"functions",level:2},{value:"<code>setupZoneTestEnv(options)</code>",id:"setupzonetestenvoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Example:",id:"example",level:4},{value:"<code>setupZonelessTestEnv(options)</code>",id:"setupzonelesstestenvoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Example:",id:"example-1",level:4}];function h(e){const t={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.p,{children:"In Jest, a test environment defines the sandbox context in which your tests run.\nFor Angular projects, setting up the correct test environment is essential to ensure compatibility with the\nframework-specific features, such as dependency injection and change detection."}),"\n",(0,i.jsxs)(t.p,{children:[(0,i.jsx)(t.code,{children:"jest-preset-angular"})," provides utility functions to simplify setting up a Jest test environment tailored for Angular projects.\nThese functions support both ",(0,i.jsx)(t.strong,{children:"zone-based"})," and ",(0,i.jsx)(t.strong,{children:"zoneless"})," environments, catering to different testing needs."]}),"\n",(0,i.jsx)(t.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,i.jsx)(a.A,{toc:u.slice(1)}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h3,{id:"setupzonetestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZoneTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that uses ",(0,i.jsx)(t.code,{children:"zone.js"}),", which is the mechanism for tracking asynchronous operations.\nIt is suitable for most Angular applications that rely on ",(0,i.jsx)(t.code,{children:"zone.js"})," for change detection and other framework features."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(t.h3,{id:"setupzonelesstestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZonelessTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that ",(0,i.jsx)(t.strong,{children:"DOESN'T"})," use ",(0,i.jsx)(t.code,{children:"zone.js"}),", as described in ",(0,i.jsx)(t.a,{href:"https://angular.dev/guide/experimental/zoneless",children:"Angular experimental zoneless guide"}),".\nIt is designed for projects that have disabled ",(0,i.jsx)(t.code,{children:"zone.js"}),", which can lead to improved performance and simplified testing."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example-1",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless/index.mjs';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}}}]); \ No newline at end of file diff --git a/assets/js/2ab18ce5.1e2fe14a.js b/assets/js/2ab18ce5.1e2fe14a.js deleted file mode 100644 index b21dc6c546..0000000000 --- a/assets/js/2ab18ce5.1e2fe14a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6530],{530:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-14.2/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/14.2/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/introduction.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.2/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/2ab18ce5.89cd24ce.js b/assets/js/2ab18ce5.89cd24ce.js new file mode 100644 index 0000000000..8daeb35b0f --- /dev/null +++ b/assets/js/2ab18ce5.89cd24ce.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6530],{2704:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-14.2/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/14.2/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/introduction.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.2/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/2ae17008.b6fb38a0.js b/assets/js/2ae17008.b6fb38a0.js deleted file mode 100644 index ed595dc3f6..0000000000 --- a/assets/js/2ae17008.b6fb38a0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1635],{5144:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>p,default:()=>c,frontMatter:()=>i,metadata:()=>n,toc:()=>u});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"ESM support is only available in v9.0.0++","source":"@site/versioned_docs/version-8.x/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/8.x/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/esm-support.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/8.x/guides/angular-ivy"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/8.x/guides/jsdom-version"}}');var o=s(4848),r=s(8453);const i={id:"esm-support",title:"ESM Support"},p=void 0,a={},u=[];function d(e){const t={admonition:"admonition",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["ESM support is only available in ",(0,o.jsx)(t.strong,{children:"v9.0.0++"})]})})}function c(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>p});var n=s(6540);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 p(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)}}}]); \ No newline at end of file diff --git a/assets/js/2ae17008.ef1cd84b.js b/assets/js/2ae17008.ef1cd84b.js new file mode 100644 index 0000000000..6c3d2c368a --- /dev/null +++ b/assets/js/2ae17008.ef1cd84b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1635],{4140:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>p,default:()=>c,frontMatter:()=>i,metadata:()=>n,toc:()=>u});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"ESM support is only available in v9.0.0++","source":"@site/versioned_docs/version-8.x/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/8.x/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/esm-support.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/8.x/guides/angular-ivy"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/8.x/guides/jsdom-version"}}');var o=s(4848),r=s(8453);const i={id:"esm-support",title:"ESM Support"},p=void 0,a={},u=[];function d(e){const t={admonition:"admonition",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["ESM support is only available in ",(0,o.jsx)(t.strong,{children:"v9.0.0++"})]})})}function c(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>p});var n=s(6540);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 p(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)}}}]); \ No newline at end of file diff --git a/assets/js/2e81e74f.1eaa47fd.js b/assets/js/2e81e74f.1eaa47fd.js new file mode 100644 index 0000000000..1a0eae32a3 --- /dev/null +++ b/assets/js/2e81e74f.1eaa47fd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[647],{7303:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-13.0/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/13.0/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/angular-ivy.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/13.0/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/13.0/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"angular-ivy",title:"Angular Ivy"},u=void 0,c={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=u??f;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(u(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/2e81e74f.72bf63cc.js b/assets/js/2e81e74f.72bf63cc.js deleted file mode 100644 index 383ad016cb..0000000000 --- a/assets/js/2e81e74f.72bf63cc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[647],{9308:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-13.0/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/13.0/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/angular-ivy.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/13.0/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/13.0/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"angular-ivy",title:"Angular Ivy"},u=void 0,c={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=u??f;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(u(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/30388853.16698a7a.js b/assets/js/30388853.16698a7a.js new file mode 100644 index 0000000000..cd7cfff402 --- /dev/null +++ b/assets/js/30388853.16698a7a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9075],{2385:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-13.0/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/13.0/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/processing.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/13.0/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/13.0/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/30388853.4a389d8b.js b/assets/js/30388853.4a389d8b.js deleted file mode 100644 index d1c93dff68..0000000000 --- a/assets/js/30388853.4a389d8b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9075],{8226:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-13.0/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/13.0/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/processing.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/13.0/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/13.0/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/327b6d8e.a792b02a.js b/assets/js/327b6d8e.a792b02a.js deleted file mode 100644 index 422d04132c..0000000000 --- a/assets/js/327b6d8e.a792b02a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6968],{7055:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-14.3/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/14.3/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/introduction.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.3/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/327b6d8e.f4a93af4.js b/assets/js/327b6d8e.f4a93af4.js new file mode 100644 index 0000000000..2e34ad18de --- /dev/null +++ b/assets/js/327b6d8e.f4a93af4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6968],{3135:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-14.3/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/14.3/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/introduction.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.3/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/33a5adb4.15cf890c.js b/assets/js/33a5adb4.15cf890c.js new file mode 100644 index 0000000000..f8f29df08c --- /dev/null +++ b/assets/js/33a5adb4.15cf890c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2758],{2944:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>j,frontMatter:()=>p,metadata:()=>s,toc:()=>h});const s=JSON.parse('{"id":"guides/snapshot-testing","title":"Snapshot testing","description":"jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.","source":"@site/versioned_docs/version-14.2/guides/snapshot-testing.md","sourceDirName":"guides","slug":"/guides/snapshot-testing","permalink":"/jest-preset-angular/docs/14.2/guides/snapshot-testing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/snapshot-testing.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"snapshot-testing","title":"Snapshot testing"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.2/guides/jsdom-version"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.2/guides/using-with-babel"}}');var i=t(4848),r=t(8453),l=t(1470),a=t(9365),o=t(4252);const p={id:"snapshot-testing",title:"Snapshot testing"},c=void 0,d={},h=[{value:"Snapshot serializers",id:"snapshot-serializers",level:2},{value:"Reference",id:"reference",level:2},{value:"Remove html comments (<code>html-comment</code>)",id:"remove-html-comments-html-comment",level:3},{value:"In Jest config",id:"in-jest-config",level:4},{value:"Or in setup test environment file",id:"or-in-setup-test-environment-file",level:4},{value:"Or in individual test files",id:"or-in-individual-test-files",level:4},{value:"Display component HTML (<code>ng-snapshot</code>)",id:"display-component-html-ng-snapshot",level:3},{value:"Configuration options",id:"configuration-options",level:4},{value:"In Jest config",id:"in-jest-config-1",level:4},{value:"Or in setup test environment file",id:"or-in-setup-test-environment-file-1",level:4},{value:"Or in individual test files",id:"or-in-individual-test-files-1",level:4},{value:"With options",id:"with-options",level:4},{value:"Remove Angular attributes (<code>no-ng-attributes</code>)",id:"remove-angular-attributes-no-ng-attributes",level:3},{value:"In Jest config",id:"in-jest-config-2",level:4},{value:"Or in setup test environment file",id:"or-in-setup-test-environment-file-2",level:4},{value:"Or in individual test files",id:"or-in-individual-test-files-2",level:4}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"jest-preset-angular"})," provides several snapshot serializers to generate clearer and more human-readable snapshot."]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"BY DEFAULT"}),", the ",(0,i.jsx)(n.a,{href:"/jest-preset-angular/docs/14.2/getting-started/presets",children:"preset"})," provides all of the snapshot serializers below."]})}),"\n",(0,i.jsx)(n.h2,{id:"snapshot-serializers",children:"Snapshot serializers"}),"\n","\n",(0,i.jsx)(o.A,{toc:h.slice(2)}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsx)(n.h2,{id:"reference",children:"Reference"}),"\n",(0,i.jsxs)(n.h3,{id:"remove-html-comments-html-comment",children:["Remove html comments (",(0,i.jsx)(n.code,{children:"html-comment"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow removing all the comments in the component HTML in snapshot."}),"\n",(0,i.jsx)(n.p,{children:"Examples:"}),"\n",(0,i.jsx)(n.h4,{id:"in-jest-config",children:"In Jest config"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-setup-test-environment-file",children:"Or in setup test environment file"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsxs)(a.A,{value:"js",label:"JavaScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab={"span":2} title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.js'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="setup-jest.js"',children:"const removeHtmlCommentsSerializer = require('jest-preset-angular/build/serializers/html-comment');\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})})]}),(0,i.jsxs)(a.A,{value:"ts",label:"TypeScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab={"span":2} title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})})]})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-individual-test-files",children:"Or in individual test files"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="foo.component.spec.js"',children:"const removeHtmlCommentsSerializer = require('jest-preset-angular/build/serializers/html-comment');\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="foo.component.spec.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})})})]}),"\n",(0,i.jsxs)(n.h3,{id:"display-component-html-ng-snapshot",children:["Display component HTML (",(0,i.jsx)(n.code,{children:"ng-snapshot"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow displaying component HTML with data in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"configuration-options",children:"Configuration options"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type NgSnapshotOptions = {\n omitAllCompAttrs?: boolean;\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"Configure snapshot behavior"}),"\n",(0,i.jsx)(n.p,{children:"Examples:"}),"\n",(0,i.jsx)(n.h4,{id:"in-jest-config-1",children:"In Jest config"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-setup-test-environment-file-1",children:"Or in setup test environment file"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsxs)(a.A,{value:"js",label:"JavaScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab={"span":2} title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.js'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="setup-jest.js"',children:"const componentSnapshotSerializer = require('jest-preset-angular/build/serializers/ng-snapshot');\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})})]}),(0,i.jsxs)(a.A,{value:"ts",label:"TypeScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab={"span":2} title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})})]})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-individual-test-files-1",children:"Or in individual test files"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="foo.component.spec.js"',children:"const componentSnapshotSerializer = require('jest-preset-angular/build/serializers/ng-snapshot');\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})})})]}),"\n",(0,i.jsx)(n.h4,{id:"with-options",children:"With options"}),"\n",(0,i.jsxs)(n.admonition,{title:"Effective priority",type:"info",children:[(0,i.jsx)(n.p,{children:"The configured serializers will have affect in this order:"}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Jest config"})," -> ",(0,i.jsx)(n.code,{children:"setup files"})," -> ",(0,i.jsx)(n.code,{children:"test files"})]}),(0,i.jsx)(n.p,{children:"The later the higher priority. This means that with the same serializer, the later one will override the configuration\nof the previous one in the chain."})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In setup files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsxs)(a.A,{value:"js",label:"JavaScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab={"span":2} title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.js'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="setup-jest.js"',children:"const componentSnapshotSerializer = require('jest-preset-angular/build/serializers/ng-snapshot');\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})})]}),(0,i.jsxs)(a.A,{value:"ts",label:"TypeScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab={"span":2} title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})})]})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"or in individual test files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="foo.component.spec.js"',children:"const componentSnapshotSerializer = require('jest-preset-angular/build/serializers/ng-snapshot');\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})})})]}),"\n",(0,i.jsxs)(n.h3,{id:"remove-angular-attributes-no-ng-attributes",children:["Remove Angular attributes (",(0,i.jsx)(n.code,{children:"no-ng-attributes"}),")"]}),"\n",(0,i.jsxs)(n.p,{children:["Allow removing attributes generated by Angular fixture, like ",(0,i.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,i.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,i.jsx)(n.code,{children:"_ngcontent-c*"})," etc., from component snapshot"]}),"\n",(0,i.jsx)(n.p,{children:"Examples:"}),"\n",(0,i.jsx)(n.h4,{id:"in-jest-config-2",children:"In Jest config"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-setup-test-environment-file-2",children:"Or in setup test environment file"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsxs)(a.A,{value:"js",label:"JavaScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab={"span":2} title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.js'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="setup-jest.js"',children:"const removeNgAttributes = require('jest-preset-angular/build/serializers/no-ng-attributes');\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})})]}),(0,i.jsxs)(a.A,{value:"ts",label:"TypeScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab={"span":2} title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})})]})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-individual-test-files-2",children:"Or in individual test files"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="foo.component.spec.js"',children:"const removeNgAttributes = require('jest-preset-angular/build/serializers/no-ng-attributes');\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="foo.component.spec.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})})]})]})}function j(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}}}]); \ No newline at end of file diff --git a/assets/js/33a5adb4.da7594a1.js b/assets/js/33a5adb4.da7594a1.js deleted file mode 100644 index 89e1a38c18..0000000000 --- a/assets/js/33a5adb4.da7594a1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2758],{6682:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>j,frontMatter:()=>p,metadata:()=>s,toc:()=>h});const s=JSON.parse('{"id":"guides/snapshot-testing","title":"Snapshot testing","description":"jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.","source":"@site/versioned_docs/version-14.2/guides/snapshot-testing.md","sourceDirName":"guides","slug":"/guides/snapshot-testing","permalink":"/jest-preset-angular/docs/14.2/guides/snapshot-testing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/snapshot-testing.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"snapshot-testing","title":"Snapshot testing"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.2/guides/jsdom-version"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.2/guides/using-with-babel"}}');var i=t(4848),r=t(8453),l=t(9489),a=t(7227),o=t(1574);const p={id:"snapshot-testing",title:"Snapshot testing"},c=void 0,d={},h=[{value:"Snapshot serializers",id:"snapshot-serializers",level:2},{value:"Reference",id:"reference",level:2},{value:"Remove html comments (<code>html-comment</code>)",id:"remove-html-comments-html-comment",level:3},{value:"In Jest config",id:"in-jest-config",level:4},{value:"Or in setup test environment file",id:"or-in-setup-test-environment-file",level:4},{value:"Or in individual test files",id:"or-in-individual-test-files",level:4},{value:"Display component HTML (<code>ng-snapshot</code>)",id:"display-component-html-ng-snapshot",level:3},{value:"Configuration options",id:"configuration-options",level:4},{value:"In Jest config",id:"in-jest-config-1",level:4},{value:"Or in setup test environment file",id:"or-in-setup-test-environment-file-1",level:4},{value:"Or in individual test files",id:"or-in-individual-test-files-1",level:4},{value:"With options",id:"with-options",level:4},{value:"Remove Angular attributes (<code>no-ng-attributes</code>)",id:"remove-angular-attributes-no-ng-attributes",level:3},{value:"In Jest config",id:"in-jest-config-2",level:4},{value:"Or in setup test environment file",id:"or-in-setup-test-environment-file-2",level:4},{value:"Or in individual test files",id:"or-in-individual-test-files-2",level:4}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"jest-preset-angular"})," provides several snapshot serializers to generate clearer and more human-readable snapshot."]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"BY DEFAULT"}),", the ",(0,i.jsx)(n.a,{href:"/jest-preset-angular/docs/14.2/getting-started/presets",children:"preset"})," provides all of the snapshot serializers below."]})}),"\n",(0,i.jsx)(n.h2,{id:"snapshot-serializers",children:"Snapshot serializers"}),"\n","\n",(0,i.jsx)(o.A,{toc:h.slice(2)}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsx)(n.h2,{id:"reference",children:"Reference"}),"\n",(0,i.jsxs)(n.h3,{id:"remove-html-comments-html-comment",children:["Remove html comments (",(0,i.jsx)(n.code,{children:"html-comment"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow removing all the comments in the component HTML in snapshot."}),"\n",(0,i.jsx)(n.p,{children:"Examples:"}),"\n",(0,i.jsx)(n.h4,{id:"in-jest-config",children:"In Jest config"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-setup-test-environment-file",children:"Or in setup test environment file"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsxs)(a.A,{value:"js",label:"JavaScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab={"span":2} title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.js'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="setup-jest.js"',children:"const removeHtmlCommentsSerializer = require('jest-preset-angular/build/serializers/html-comment');\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})})]}),(0,i.jsxs)(a.A,{value:"ts",label:"TypeScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab={"span":2} title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})})]})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-individual-test-files",children:"Or in individual test files"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="foo.component.spec.js"',children:"const removeHtmlCommentsSerializer = require('jest-preset-angular/build/serializers/html-comment');\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="foo.component.spec.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})})})]}),"\n",(0,i.jsxs)(n.h3,{id:"display-component-html-ng-snapshot",children:["Display component HTML (",(0,i.jsx)(n.code,{children:"ng-snapshot"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow displaying component HTML with data in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"configuration-options",children:"Configuration options"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type NgSnapshotOptions = {\n omitAllCompAttrs?: boolean;\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"Configure snapshot behavior"}),"\n",(0,i.jsx)(n.p,{children:"Examples:"}),"\n",(0,i.jsx)(n.h4,{id:"in-jest-config-1",children:"In Jest config"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-setup-test-environment-file-1",children:"Or in setup test environment file"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsxs)(a.A,{value:"js",label:"JavaScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab={"span":2} title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.js'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="setup-jest.js"',children:"const componentSnapshotSerializer = require('jest-preset-angular/build/serializers/ng-snapshot');\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})})]}),(0,i.jsxs)(a.A,{value:"ts",label:"TypeScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab={"span":2} title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})})]})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-individual-test-files-1",children:"Or in individual test files"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="foo.component.spec.js"',children:"const componentSnapshotSerializer = require('jest-preset-angular/build/serializers/ng-snapshot');\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})})})]}),"\n",(0,i.jsx)(n.h4,{id:"with-options",children:"With options"}),"\n",(0,i.jsxs)(n.admonition,{title:"Effective priority",type:"info",children:[(0,i.jsx)(n.p,{children:"The configured serializers will have affect in this order:"}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Jest config"})," -> ",(0,i.jsx)(n.code,{children:"setup files"})," -> ",(0,i.jsx)(n.code,{children:"test files"})]}),(0,i.jsx)(n.p,{children:"The later the higher priority. This means that with the same serializer, the later one will override the configuration\nof the previous one in the chain."})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In setup files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsxs)(a.A,{value:"js",label:"JavaScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab={"span":2} title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.js'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="setup-jest.js"',children:"const componentSnapshotSerializer = require('jest-preset-angular/build/serializers/ng-snapshot');\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})})]}),(0,i.jsxs)(a.A,{value:"ts",label:"TypeScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab={"span":2} title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})})]})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"or in individual test files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="foo.component.spec.js"',children:"const componentSnapshotSerializer = require('jest-preset-angular/build/serializers/ng-snapshot');\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})})})]}),"\n",(0,i.jsxs)(n.h3,{id:"remove-angular-attributes-no-ng-attributes",children:["Remove Angular attributes (",(0,i.jsx)(n.code,{children:"no-ng-attributes"}),")"]}),"\n",(0,i.jsxs)(n.p,{children:["Allow removing attributes generated by Angular fixture, like ",(0,i.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,i.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,i.jsx)(n.code,{children:"_ngcontent-c*"})," etc., from component snapshot"]}),"\n",(0,i.jsx)(n.p,{children:"Examples:"}),"\n",(0,i.jsx)(n.h4,{id:"in-jest-config-2",children:"In Jest config"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-setup-test-environment-file-2",children:"Or in setup test environment file"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsxs)(a.A,{value:"js",label:"JavaScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab={"span":2} title="jest.config.js"',children:"/** @type {import('jest').Config} */\nmodule.exports = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.js'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="setup-jest.js"',children:"const removeNgAttributes = require('jest-preset-angular/build/serializers/no-ng-attributes');\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})})]}),(0,i.jsxs)(a.A,{value:"ts",label:"TypeScript",children:[(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab={"span":2} title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})})]})]}),"\n",(0,i.jsx)(n.h4,{id:"or-in-individual-test-files-2",children:"Or in individual test files"}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'tab title="foo.component.spec.js"',children:"const removeNgAttributes = require('jest-preset-angular/build/serializers/no-ng-attributes');\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})}),(0,i.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'tab title="foo.component.spec.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})})]})]})}function j(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}}}]); \ No newline at end of file diff --git a/assets/js/357d33d4.016ccac9.js b/assets/js/357d33d4.016ccac9.js deleted file mode 100644 index 19f66d3a5d..0000000000 --- a/assets/js/357d33d4.016ccac9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5492],{5141:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-14.4/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/esm-support.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/guides/jsdom-version"}}');var r=t(4848),o=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["To use ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(s.code,{children:"ts-jest"})," config option ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["There is also a ",(0,r.jsx)(s.a,{href:"/jest-preset-angular/docs/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(s.admonition,{type:"tip",children:(0,r.jsxs)(s.p,{children:["We have ",(0,r.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsx)(s.p,{children:"Besides, there is utility function to ensure that Jest can set up test environment properly."}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})}),"\n",(0,r.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(s.admonition,{type:"tip",children:[(0,r.jsxs)(s.p,{children:["Jest will attempt to load ",(0,r.jsx)(s.strong,{children:"ESM"})," files from ",(0,r.jsx)(s.code,{children:"node_modules"})," with default ",(0,r.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(s.strong,{children:"ESM"})," built files or ",(0,r.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(s.p,{children:["To fix that, one can use ",(0,r.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})]})}function p(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const r={},o=n.createContext(r);function i(e){const s=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/357d33d4.136d1448.js b/assets/js/357d33d4.136d1448.js new file mode 100644 index 0000000000..0becafff92 --- /dev/null +++ b/assets/js/357d33d4.136d1448.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5492],{5912:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-14.4/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/esm-support.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/guides/jsdom-version"}}');var r=t(4848),o=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["To use ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(s.code,{children:"ts-jest"})," config option ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["There is also a ",(0,r.jsx)(s.a,{href:"/jest-preset-angular/docs/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(s.admonition,{type:"tip",children:(0,r.jsxs)(s.p,{children:["We have ",(0,r.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsx)(s.p,{children:"Besides, there is utility function to ensure that Jest can set up test environment properly."}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})}),"\n",(0,r.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(s.admonition,{type:"tip",children:[(0,r.jsxs)(s.p,{children:["Jest will attempt to load ",(0,r.jsx)(s.strong,{children:"ESM"})," files from ",(0,r.jsx)(s.code,{children:"node_modules"})," with default ",(0,r.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(s.strong,{children:"ESM"})," built files or ",(0,r.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(s.p,{children:["To fix that, one can use ",(0,r.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})]})}function p(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const r={},o=n.createContext(r);function i(e){const s=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/388d3430.b1604206.js b/assets/js/388d3430.b1604206.js new file mode 100644 index 0000000000..95bfe3c67a --- /dev/null +++ b/assets/js/388d3430.b1604206.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9762],{3085:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>l,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-14.0/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/14.0/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/angular-13+.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.0/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.0/guides/esm-support"}}');var r=s(4848),a=s(8453),o=s(1470),i=s(9365);const l={id:"angular-13+",title:"Angular >=13"},u=void 0,c={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/14.0/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,r.jsxs)(n.p,{children:["Your ",(0,r.jsx)(n.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(n.p,{children:"or for ESM mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,n,s)=>{s.d(n,{A:()=>o});s(6540);var t=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:n,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,t.A)(r.tabItem,o),hidden:s,children:n})}},1470:(e,n,s)=>{s.d(n,{A:()=>A});var t=s(6540),r=s(4164),a=s(3104),o=s(6347),i=s(205),l=s(7485),u=s(1682),c=s(679);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,s])}function g(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function h(e){let{queryString:n=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,l.aZ)(a),(0,t.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:a}))),[u,d]=h({queryString:s,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,c.Dv)(s);return[r,(0,t.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),f=(()=>{const e=u??m;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,t.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:n,block:s,selectedValue:t,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const n=e.currentTarget,s=l.indexOf(n),r=i[s].value;r!==t&&(u(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;n=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;n=l[s]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},n),children:i.map((e=>{let{value:n,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,t.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function w(e){const n=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function A(e){const n=(0,j.A)();return(0,x.jsx)(w,{...e,children:d(e.children)},String(n))}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/388d3430.e737585e.js b/assets/js/388d3430.e737585e.js deleted file mode 100644 index 1c697cf42e..0000000000 --- a/assets/js/388d3430.e737585e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9762],{3787:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>l,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-14.0/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/14.0/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/angular-13+.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.0/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.0/guides/esm-support"}}');var r=s(4848),a=s(8453),o=s(9489),i=s(7227);const l={id:"angular-13+",title:"Angular >=13"},u=void 0,c={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/14.0/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,r.jsxs)(n.p,{children:["Your ",(0,r.jsx)(n.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(n.p,{children:"or for ESM mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,n,s)=>{s.d(n,{A:()=>o});s(6540);var t=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:n,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,t.A)(r.tabItem,o),hidden:s,children:n})}},9489:(e,n,s)=>{s.d(n,{A:()=>A});var t=s(6540),r=s(4164),a=s(4245),o=s(6347),i=s(6494),l=s(2814),u=s(5167),c=s(9900);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,s])}function g(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function h(e){let{queryString:n=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,l.aZ)(a),(0,t.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:a}))),[u,d]=h({queryString:s,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,c.Dv)(s);return[r,(0,t.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),f=(()=>{const e=u??m;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,t.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:n,block:s,selectedValue:t,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const n=e.currentTarget,s=l.indexOf(n),r=i[s].value;r!==t&&(u(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;n=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;n=l[s]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},n),children:i.map((e=>{let{value:n,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>l.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,t.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function w(e){const n=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function A(e){const n=(0,j.A)();return(0,x.jsx)(w,{...e,children:d(e.children)},String(n))}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/3b270bcb.8655ff4b.js b/assets/js/3b270bcb.8655ff4b.js new file mode 100644 index 0000000000..a6161b4fe2 --- /dev/null +++ b/assets/js/3b270bcb.8655ff4b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8388],{9276:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-14.4/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/angular-ivy.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"angular-ivy",title:"Angular Ivy"},c=void 0,u={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var r=n(6540),s=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:s}),[h,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,u.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(c(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function y(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function x(e){const t=h(e);return(0,j.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(y,{...t,...e})]})}function S(e){const t=(0,m.A)();return(0,j.jsx)(x,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/3b270bcb.d3a960d4.js b/assets/js/3b270bcb.d3a960d4.js deleted file mode 100644 index f991b03e44..0000000000 --- a/assets/js/3b270bcb.d3a960d4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8388],{982:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-14.4/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/angular-ivy.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"angular-ivy",title:"Angular Ivy"},c=void 0,u={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var r=n(6540),s=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:s}),[h,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,u.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(c(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function y(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function x(e){const t=h(e);return(0,j.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(y,{...t,...e})]})}function S(e){const t=(0,m.A)();return(0,j.jsx)(x,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/3c7caf67.88462c2e.js b/assets/js/3c7caf67.88462c2e.js new file mode 100644 index 0000000000..bb47b7c495 --- /dev/null +++ b/assets/js/3c7caf67.88462c2e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7375],{3448:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-14.2/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/14.2/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/getting-started/installation.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.2/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.2/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/3c7caf67.de9cda30.js b/assets/js/3c7caf67.de9cda30.js deleted file mode 100644 index 24690bfb47..0000000000 --- a/assets/js/3c7caf67.de9cda30.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7375],{9827:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-14.2/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/14.2/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/getting-started/installation.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.2/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.2/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/407f8801.0db5cbe9.js b/assets/js/407f8801.0db5cbe9.js new file mode 100644 index 0000000000..8ce3a9da86 --- /dev/null +++ b/assets/js/407f8801.0db5cbe9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6261],{9160:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-9.x/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/9.x/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/jsdom-version.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/9.x/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/9.x/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/407f8801.47c8babd.js b/assets/js/407f8801.47c8babd.js deleted file mode 100644 index 8dbd1df0f3..0000000000 --- a/assets/js/407f8801.47c8babd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6261],{9374:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-9.x/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/9.x/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/jsdom-version.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/9.x/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/9.x/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/135.634828fd.js b/assets/js/416.36a683d5.js similarity index 59% rename from assets/js/135.634828fd.js rename to assets/js/416.36a683d5.js index 2b63552418..ab8fcaaca4 100644 --- a/assets/js/135.634828fd.js +++ b/assets/js/416.36a683d5.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[135],{135:(e,s,b)=>{b.r(s)}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[416],{416:(e,s,b)=>{b.r(s)}}]); \ No newline at end of file diff --git a/assets/js/5691.f523bf42.js b/assets/js/4334.0bfa0a25.js similarity index 74% rename from assets/js/5691.f523bf42.js rename to assets/js/4334.0bfa0a25.js index d8ec1d9640..7039977629 100644 --- a/assets/js/5691.f523bf42.js +++ b/assets/js/4334.0bfa0a25.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5691],{5691:(e,t,n)=>{n.r(t),n.d(t,{renderReloadPopup:()=>s});n(6540);var d=n(5338),o=n(4848);const r="pwa-popup-container",c=()=>document.getElementById(r),u=()=>{const e=document.createElement("div");return e.id=r,document.body.appendChild(e),e};function s(e){const t=c()??u();return Promise.all([n.e(1869),n.e(9828)]).then(n.bind(n,9828)).then((n=>{let{default:r}=n;(0,d.createRoot)(t).render((0,o.jsx)(r,{...e}))}))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4334],{4334:(e,t,n)=>{n.r(t),n.d(t,{renderReloadPopup:()=>s});n(6540);var d=n(5338),o=n(4848);const r="pwa-popup-container",c=()=>document.getElementById(r),u=()=>{const e=document.createElement("div");return e.id=r,document.body.appendChild(e),e};function s(e){const t=c()??u();return Promise.all([n.e(1869),n.e(2362)]).then(n.bind(n,2362)).then((n=>{let{default:r}=n;(0,d.createRoot)(t).render((0,o.jsx)(r,{...e}))}))}}}]); \ No newline at end of file diff --git a/assets/js/433cefd8.18f9a6b3.js b/assets/js/433cefd8.18f9a6b3.js new file mode 100644 index 0000000000..9bf1b12a9b --- /dev/null +++ b/assets/js/433cefd8.18f9a6b3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[403],{6770:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>p,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-12.0/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/12.0/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/angular-ivy.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/12.0/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/12.0/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"angular-ivy",title:"Angular Ivy"},u=void 0,c={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function g(e){const t={code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function p(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(g,{...e})}):g(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function g(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function p(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=g(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!p({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),m=(()=>{const e=u??f;return p({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{m&&i(m)}),[m]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!p({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),b(e)}),[d,b,a]),tabValues:a}}var b=n(2303);const m={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(u(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",m.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",m.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/433cefd8.811b4e4b.js b/assets/js/433cefd8.811b4e4b.js deleted file mode 100644 index 29d4b4ddfa..0000000000 --- a/assets/js/433cefd8.811b4e4b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[403],{7923:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-12.0/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/12.0/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/angular-ivy.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/12.0/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/12.0/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"angular-ivy",title:"Angular Ivy"},u=void 0,c={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nmodule.exports = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,s.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),m=(()=>{const e=u??f;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{m&&i(m)}),[m]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),b(e)}),[d,b,a]),tabValues:a}}var b=n(1062);const m={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(u(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",m.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",m.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4351d34b.d303a2d1.js b/assets/js/4351d34b.e150e3f4.js similarity index 53% rename from assets/js/4351d34b.d303a2d1.js rename to assets/js/4351d34b.e150e3f4.js index e18cbc8b7e..7aeeff637c 100644 --- a/assets/js/4351d34b.d303a2d1.js +++ b/assets/js/4351d34b.e150e3f4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3095],{8499:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"JSDOM version","description":"jest-preset-angular provides a way to configure a different version of JSDOM than the one ships with Jest","source":"@site/docs/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/next/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/jsdom-version.md","tags":[],"version":"current","lastUpdatedBy":"Ahn","lastUpdatedAt":1734688329000,"frontMatter":{"id":"jsdom-version","title":"JSDOM version"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/next/guides/esm-support"},"next":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/next/guides/snapshot-testing"}}');var s=n(4848),a=n(8453),o=n(9489),l=n(7227);const i={id:"jsdom-version",title:"JSDOM version"},u=void 0,c={},d=[];function p(e){const t={code:"code",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provides a way to configure a different version of ",(0,s.jsx)(t.code,{children:"JSDOM"})," than the one ships with ",(0,s.jsx)(t.code,{children:"Jest"}),"\nvia a custom ",(0,s.jsx)(t.code,{children:"JSDOM"})," environment. One can follow the below steps to configure a different JSDOM version:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Install the desired JSDOM version"}),"\n"]}),"\n",(0,s.jsxs)(o.A,{groupId:"npm2yarn",children:[(0,s.jsx)(l.A,{value:"npm",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-bash",children:"npm install -D jsdom@<desired-version>\n"})})}),(0,s.jsx)(l.A,{value:"yarn",label:"Yarn",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jsdom@<desired-version>\n"})})}),(0,s.jsx)(l.A,{value:"pnpm",label:"pnpm",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jsdom@<desired-version>\n"})})})]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["In Jest config, set the ",(0,s.jsx)(t.code,{children:"testEnvironment"})," like following"]}),"\n"]}),"\n",(0,s.jsxs)(o.A,{groupId:"code-examples",children:[(0,s.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-preset-angular/environments/jsdom',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-preset-angular/environments/jsdom',\n};\n\nexport default jestConfig;\n"})})})]})]})}function m(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,o),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(4245),o=n(6347),l=n(6494),i=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[o,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,v]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=u??f;return m({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{b&&i(b)}),[b]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),v(e)}),[d,v,a]),tabValues:a}}var v=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var g=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=l[n].value;s!==r&&(u(t),o(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:l.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,g.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,g.jsx)(j,{...t,...e}),(0,g.jsx)(x,{...t,...e})]})}function w(e){const t=(0,v.A)();return(0,g.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>l});var r=n(6540);const s={},a=r.createContext(s);function o(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3095],{3062:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"JSDOM version","description":"jest-preset-angular provides a way to configure a different version of JSDOM than the one ships with Jest","source":"@site/docs/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/next/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/jsdom-version.md","tags":[],"version":"current","lastUpdatedBy":"Ahn","lastUpdatedAt":1734688329000,"frontMatter":{"id":"jsdom-version","title":"JSDOM version"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/next/guides/esm-support"},"next":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/next/guides/snapshot-testing"}}');var s=n(4848),a=n(8453),o=n(1470),l=n(9365);const i={id:"jsdom-version",title:"JSDOM version"},u=void 0,c={},d=[];function p(e){const t={code:"code",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provides a way to configure a different version of ",(0,s.jsx)(t.code,{children:"JSDOM"})," than the one ships with ",(0,s.jsx)(t.code,{children:"Jest"}),"\nvia a custom ",(0,s.jsx)(t.code,{children:"JSDOM"})," environment. One can follow the below steps to configure a different JSDOM version:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Install the desired JSDOM version"}),"\n"]}),"\n",(0,s.jsxs)(o.A,{groupId:"npm2yarn",children:[(0,s.jsx)(l.A,{value:"npm",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-bash",children:"npm install -D jsdom@<desired-version>\n"})})}),(0,s.jsx)(l.A,{value:"yarn",label:"Yarn",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jsdom@<desired-version>\n"})})}),(0,s.jsx)(l.A,{value:"pnpm",label:"pnpm",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jsdom@<desired-version>\n"})})})]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["In Jest config, set the ",(0,s.jsx)(t.code,{children:"testEnvironment"})," like following"]}),"\n"]}),"\n",(0,s.jsxs)(o.A,{groupId:"code-examples",children:[(0,s.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-preset-angular/environments/jsdom',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-preset-angular/environments/jsdom',\n};\n\nexport default jestConfig;\n"})})})]})]})}function m(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,o),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),a=n(3104),o=n(6347),l=n(205),i=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[o,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:s}),[f,v]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=u??f;return m({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{b&&i(b)}),[b]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),v(e)}),[d,v,a]),tabValues:a}}var v=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var g=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),s=l[n].value;s!==r&&(u(t),o(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:l.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,g.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,g.jsx)(j,{...t,...e}),(0,g.jsx)(x,{...t,...e})]})}function w(e){const t=(0,v.A)();return(0,g.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>l});var r=n(6540);const s={},a=r.createContext(s);function o(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/44821296.1e9cc76b.js b/assets/js/44821296.1e9cc76b.js new file mode 100644 index 0000000000..79e5e00b3c --- /dev/null +++ b/assets/js/44821296.1e9cc76b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[509],{596:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>g,frontMatter:()=>p,metadata:()=>s,toc:()=>h});const s=JSON.parse('{"id":"guides/snapshot-testing","title":"Snapshot testing","description":"jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.","source":"@site/versioned_docs/version-14.3/guides/snapshot-testing.md","sourceDirName":"guides","slug":"/guides/snapshot-testing","permalink":"/jest-preset-angular/docs/14.3/guides/snapshot-testing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/snapshot-testing.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"snapshot-testing","title":"Snapshot testing"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.3/guides/jsdom-version"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.3/guides/using-with-babel"}}');var i=t(4848),r=t(8453),l=t(1470),a=t(9365),o=t(4252);const p={id:"snapshot-testing",title:"Snapshot testing"},c=void 0,d={},h=[{value:"Snapshot serializers",id:"snapshot-serializers",level:2},{value:"Remove html comments (<code>html-comment</code>)",id:"remove-html-comments-html-comment",level:3},{value:"Examples:",id:"examples",level:4},{value:"Display component HTML (<code>ng-snapshot</code>)",id:"display-component-html-ng-snapshot",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Examples:",id:"examples-1",level:4},{value:"With options",id:"with-options",level:4},{value:"Remove Angular attributes (<code>no-ng-attributes</code>)",id:"remove-angular-attributes-no-ng-attributes",level:3},{value:"Examples:",id:"examples-2",level:4}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"jest-preset-angular"})," provides several snapshot serializers to generate clearer and more human-readable snapshot."]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"BY DEFAULT"}),", the ",(0,i.jsx)(n.a,{href:"/jest-preset-angular/docs/14.3/getting-started/presets",children:"preset"})," provides all of the snapshot serializers below."]})}),"\n",(0,i.jsx)(n.h2,{id:"snapshot-serializers",children:"Snapshot serializers"}),"\n","\n",(0,i.jsx)(o.A,{toc:h.slice(1)}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsxs)(n.h3,{id:"remove-html-comments-html-comment",children:["Remove html comments (",(0,i.jsx)(n.code,{children:"html-comment"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow removing all the comments in the component HTML in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"examples",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"display-component-html-ng-snapshot",children:["Display component HTML (",(0,i.jsx)(n.code,{children:"ng-snapshot"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow displaying component HTML with data in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["options(",(0,i.jsx)(n.strong,{children:"optional"}),"):","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"omitAllCompAttrs: remove all component DOM attributes"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type NgSnapshotOptions = {\n omitAllCompAttrs?: boolean;\n};\n"})}),"\n",(0,i.jsx)(n.h4,{id:"examples-1",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsx)(n.h4,{id:"with-options",children:"With options"}),"\n",(0,i.jsxs)(n.admonition,{title:"Effective priority",type:"info",children:[(0,i.jsx)(n.p,{children:"The configured serializers will have affect in this order:"}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Jest config"})," -> ",(0,i.jsx)(n.code,{children:"setup files"})," -> ",(0,i.jsx)(n.code,{children:"test files"})]}),(0,i.jsx)(n.p,{children:"The later the higher priority. This means that with the same serializer, the later one will override the configuration\nof the previous one in the chain."})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In setup files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"or in individual test files:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"remove-angular-attributes-no-ng-attributes",children:["Remove Angular attributes (",(0,i.jsx)(n.code,{children:"no-ng-attributes"}),")"]}),"\n",(0,i.jsxs)(n.p,{children:["Allow removing attributes generated by Angular fixture, like ",(0,i.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,i.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,i.jsx)(n.code,{children:"_ngcontent-c*"})," etc., from component snapshot"]}),"\n",(0,i.jsx)(n.h4,{id:"examples-2",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})]})}function g(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}}}]); \ No newline at end of file diff --git a/assets/js/44821296.31f97174.js b/assets/js/44821296.31f97174.js deleted file mode 100644 index 90d3361884..0000000000 --- a/assets/js/44821296.31f97174.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[509],{2620:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>g,frontMatter:()=>p,metadata:()=>s,toc:()=>h});const s=JSON.parse('{"id":"guides/snapshot-testing","title":"Snapshot testing","description":"jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.","source":"@site/versioned_docs/version-14.3/guides/snapshot-testing.md","sourceDirName":"guides","slug":"/guides/snapshot-testing","permalink":"/jest-preset-angular/docs/14.3/guides/snapshot-testing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/snapshot-testing.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"snapshot-testing","title":"Snapshot testing"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.3/guides/jsdom-version"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.3/guides/using-with-babel"}}');var i=t(4848),r=t(8453),l=t(9489),a=t(7227),o=t(1574);const p={id:"snapshot-testing",title:"Snapshot testing"},c=void 0,d={},h=[{value:"Snapshot serializers",id:"snapshot-serializers",level:2},{value:"Remove html comments (<code>html-comment</code>)",id:"remove-html-comments-html-comment",level:3},{value:"Examples:",id:"examples",level:4},{value:"Display component HTML (<code>ng-snapshot</code>)",id:"display-component-html-ng-snapshot",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Examples:",id:"examples-1",level:4},{value:"With options",id:"with-options",level:4},{value:"Remove Angular attributes (<code>no-ng-attributes</code>)",id:"remove-angular-attributes-no-ng-attributes",level:3},{value:"Examples:",id:"examples-2",level:4}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"jest-preset-angular"})," provides several snapshot serializers to generate clearer and more human-readable snapshot."]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"BY DEFAULT"}),", the ",(0,i.jsx)(n.a,{href:"/jest-preset-angular/docs/14.3/getting-started/presets",children:"preset"})," provides all of the snapshot serializers below."]})}),"\n",(0,i.jsx)(n.h2,{id:"snapshot-serializers",children:"Snapshot serializers"}),"\n","\n",(0,i.jsx)(o.A,{toc:h.slice(1)}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsxs)(n.h3,{id:"remove-html-comments-html-comment",children:["Remove html comments (",(0,i.jsx)(n.code,{children:"html-comment"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow removing all the comments in the component HTML in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"examples",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"display-component-html-ng-snapshot",children:["Display component HTML (",(0,i.jsx)(n.code,{children:"ng-snapshot"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow displaying component HTML with data in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["options(",(0,i.jsx)(n.strong,{children:"optional"}),"):","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"omitAllCompAttrs: remove all component DOM attributes"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type NgSnapshotOptions = {\n omitAllCompAttrs?: boolean;\n};\n"})}),"\n",(0,i.jsx)(n.h4,{id:"examples-1",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsx)(n.h4,{id:"with-options",children:"With options"}),"\n",(0,i.jsxs)(n.admonition,{title:"Effective priority",type:"info",children:[(0,i.jsx)(n.p,{children:"The configured serializers will have affect in this order:"}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Jest config"})," -> ",(0,i.jsx)(n.code,{children:"setup files"})," -> ",(0,i.jsx)(n.code,{children:"test files"})]}),(0,i.jsx)(n.p,{children:"The later the higher priority. This means that with the same serializer, the later one will override the configuration\nof the previous one in the chain."})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In setup files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"or in individual test files:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"remove-angular-attributes-no-ng-attributes",children:["Remove Angular attributes (",(0,i.jsx)(n.code,{children:"no-ng-attributes"}),")"]}),"\n",(0,i.jsxs)(n.p,{children:["Allow removing attributes generated by Angular fixture, like ",(0,i.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,i.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,i.jsx)(n.code,{children:"_ngcontent-c*"})," etc., from component snapshot"]}),"\n",(0,i.jsx)(n.h4,{id:"examples-2",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})]})}function g(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}}}]); \ No newline at end of file diff --git a/assets/js/44b4d73b.ae997243.js b/assets/js/44b4d73b.ae997243.js new file mode 100644 index 0000000000..387f2bc04a --- /dev/null +++ b/assets/js/44b4d73b.ae997243.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9829],{9004:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>l,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-13.0/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/13.0/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/angular-13+.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/13.0/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/13.0/guides/esm-support"}}');var r=s(4848),a=s(8453),o=s(1470),i=s(9365);const l={id:"angular-13+",title:"Angular >=13"},u=void 0,c={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/13.0/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://update.angular.io/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,r.jsxs)(n.p,{children:["Your ",(0,r.jsx)(n.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(n.p,{children:"or for ESM mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,n,s)=>{s.d(n,{A:()=>o});s(6540);var t=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:n,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,t.A)(r.tabItem,o),hidden:s,children:n})}},1470:(e,n,s)=>{s.d(n,{A:()=>A});var t=s(6540),r=s(4164),a=s(3104),o=s(6347),i=s(205),l=s(7485),u=s(1682),c=s(679);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,s])}function g(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function h(e){let{queryString:n=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,l.aZ)(a),(0,t.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:a}))),[u,d]=h({queryString:s,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,c.Dv)(s);return[r,(0,t.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),f=(()=>{const e=u??m;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,t.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:n,block:s,selectedValue:t,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const n=e.currentTarget,s=l.indexOf(n),r=i[s].value;r!==t&&(u(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;n=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;n=l[s]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},n),children:i.map((e=>{let{value:n,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,t.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function w(e){const n=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function A(e){const n=(0,j.A)();return(0,x.jsx)(w,{...e,children:d(e.children)},String(n))}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/44b4d73b.fce6c49e.js b/assets/js/44b4d73b.fce6c49e.js deleted file mode 100644 index 22de9ff46a..0000000000 --- a/assets/js/44b4d73b.fce6c49e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9829],{4229:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>l,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-13.0/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/13.0/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/angular-13+.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/13.0/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/13.0/guides/esm-support"}}');var r=s(4848),a=s(8453),o=s(9489),i=s(7227);const l={id:"angular-13+",title:"Angular >=13"},u=void 0,c={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/13.0/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://update.angular.io/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,r.jsxs)(n.p,{children:["Your ",(0,r.jsx)(n.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(n.p,{children:"or for ESM mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,n,s)=>{s.d(n,{A:()=>o});s(6540);var t=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:n,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,t.A)(r.tabItem,o),hidden:s,children:n})}},9489:(e,n,s)=>{s.d(n,{A:()=>A});var t=s(6540),r=s(4164),a=s(4245),o=s(6347),i=s(6494),l=s(2814),u=s(5167),c=s(9900);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,s])}function g(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function h(e){let{queryString:n=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,l.aZ)(a),(0,t.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:a}))),[u,d]=h({queryString:s,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,c.Dv)(s);return[r,(0,t.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),f=(()=>{const e=u??m;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,t.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:n,block:s,selectedValue:t,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const n=e.currentTarget,s=l.indexOf(n),r=i[s].value;r!==t&&(u(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;n=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;n=l[s]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},n),children:i.map((e=>{let{value:n,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>l.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,t.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function w(e){const n=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function A(e){const n=(0,j.A)();return(0,x.jsx)(w,{...e,children:d(e.children)},String(n))}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/47c825a2.b7d8bd79.js b/assets/js/47c825a2.b7d8bd79.js new file mode 100644 index 0000000000..77fb6a3f87 --- /dev/null +++ b/assets/js/47c825a2.b7d8bd79.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8879],{9582:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>b,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/docs/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/next/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/using-with-babel.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/next/guides/snapshot-testing"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/next/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(1470),i=n(9365);const o={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:'title="babel.config.js"',children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function b(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),i=n(205),o=n(7485),u=n(1682),c=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function b(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!b({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return b({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{g&&o(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!b({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{o.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(x,{...t,...e}),(0,j.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/47c825a2.cec4acbf.js b/assets/js/47c825a2.cec4acbf.js deleted file mode 100644 index 370855284b..0000000000 --- a/assets/js/47c825a2.cec4acbf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8879],{6532:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>b,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/docs/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/next/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/using-with-babel.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/next/guides/snapshot-testing"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/next/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(9489),i=n(7227);const o={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:'title="babel.config.js"',children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function b(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),i=n(6494),o=n(2814),u=n(5167),c=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function b(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!b({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return b({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{g&&o(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!b({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>o.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(x,{...t,...e}),(0,j.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/47cccd8d.034e13f6.js b/assets/js/47cccd8d.034e13f6.js deleted file mode 100644 index e5a4ca6c8f..0000000000 --- a/assets/js/47cccd8d.034e13f6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6323],{3630:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-12.0/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/12.0/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/absolute-imports.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/12.0/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/12.0/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/47cccd8d.aef5dc41.js b/assets/js/47cccd8d.aef5dc41.js new file mode 100644 index 0000000000..b211971f08 --- /dev/null +++ b/assets/js/47cccd8d.aef5dc41.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6323],{4423:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-12.0/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/12.0/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/absolute-imports.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/12.0/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/12.0/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/48dd39e2.23402173.js b/assets/js/48dd39e2.23402173.js deleted file mode 100644 index 7c153cb544..0000000000 --- a/assets/js/48dd39e2.23402173.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2442],{8977:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-12.0/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/12.0/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/getting-started/options.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/12.0/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/12.0/getting-started/test-environment"}}');var r=t(4848),o=t(8453),i=t(9489),a=t(7227);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function h(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(n.code,{children:"globals"})," of Jest config object\nin the ",(0,r.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(n.p,{children:["More information about ",(0,r.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsxs)(n.admonition,{type:"important",children:[(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),(0,r.jsx)(n.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(n.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(n.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(n.code,{children:"esbuild"})," in ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(n.code,{children:"esbuild"}),", one can do the following:"]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n\nexport default jestConfig;\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport snapshotSerializers from 'jest-preset-angular/build/serializers';\n\nconst jestConfig: Config = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["Jest runs with ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["We're using some ",(0,r.jsx)(n.code,{children:'"globals"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(n.code,{children:"ts"}),"), HTML (",(0,r.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(n.code,{children:"js"}),"), JSON (",(0,r.jsx)(n.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(n.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(n.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,r.jsx)(n.code,{children:"package.json"})," definitions."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,r.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,r.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,r.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(n.code,{children:".mjs"})," files which come from ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(n.code,{children:"TS"}),", ",(0,r.jsx)(n.code,{children:"JS"}),", ",(0,r.jsx)(n.code,{children:"MJS"}),", ",(0,r.jsx)(n.code,{children:"HTML"}),", or ",(0,r.jsx)(n.code,{children:"SVG"})," file through so called ",(0,r.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},7227:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var o=t(4848);function i(e){let{children:n,hidden:t,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),o=t(4245),i=t(6347),a=t(6494),l=t(2814),c=t(5167),d=t(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function j(e){let{queryString:n=!1,groupId:t}=e;const r=(0,i.W6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function g(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=h(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:o}))),[c,u]=j({queryString:t,groupId:r}),[g,m]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),f=(()=>{const e=c??g;return p({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{f&&l(f)}),[f]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),m(e)}),[u,m,o]),tabValues:o}}var m=t(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=a[t].value;r!==s&&(c(n),i(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:a.map((e=>{let{value:n,label:t,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>l.push(e),onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",f.tabItem,o?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:o}=e;const i=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function y(e){const n=g(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function w(e){const n=(0,m.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var s=t(6540);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/48dd39e2.2d081c36.js b/assets/js/48dd39e2.2d081c36.js new file mode 100644 index 0000000000..f507bcb192 --- /dev/null +++ b/assets/js/48dd39e2.2d081c36.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2442],{6990:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-12.0/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/12.0/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/getting-started/options.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/12.0/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/12.0/getting-started/test-environment"}}');var r=t(4848),o=t(8453),i=t(1470),a=t(9365);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function h(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(n.code,{children:"globals"})," of Jest config object\nin the ",(0,r.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(n.p,{children:["More information about ",(0,r.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsxs)(n.admonition,{type:"important",children:[(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),(0,r.jsx)(n.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(n.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(n.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(n.code,{children:"esbuild"})," in ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(n.code,{children:"esbuild"}),", one can do the following:"]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n\nexport default jestConfig;\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport snapshotSerializers from 'jest-preset-angular/build/serializers';\n\nconst jestConfig: Config = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["Jest runs with ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["We're using some ",(0,r.jsx)(n.code,{children:'"globals"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(n.code,{children:"ts"}),"), HTML (",(0,r.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(n.code,{children:"js"}),"), JSON (",(0,r.jsx)(n.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(n.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(n.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,r.jsx)(n.code,{children:"package.json"})," definitions."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,r.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,r.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,r.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(n.code,{children:".mjs"})," files which come from ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(n.code,{children:"TS"}),", ",(0,r.jsx)(n.code,{children:"JS"}),", ",(0,r.jsx)(n.code,{children:"MJS"}),", ",(0,r.jsx)(n.code,{children:"HTML"}),", or ",(0,r.jsx)(n.code,{children:"SVG"})," file through so called ",(0,r.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},9365:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var o=t(4848);function i(e){let{children:n,hidden:t,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),o=t(3104),i=t(6347),a=t(205),l=t(7485),c=t(1682),d=t(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function j(e){let{queryString:n=!1,groupId:t}=e;const r=(0,i.W6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function g(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=h(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:o}))),[c,u]=j({queryString:t,groupId:r}),[g,m]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),f=(()=>{const e=c??g;return p({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{f&&l(f)}),[f]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),m(e)}),[u,m,o]),tabValues:o}}var m=t(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=a[t].value;r!==s&&(c(n),i(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:a.map((e=>{let{value:n,label:t,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",f.tabItem,o?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:o}=e;const i=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function y(e){const n=g(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function w(e){const n=(0,m.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var s=t(6540);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4941928a.987af661.js b/assets/js/4941928a.6d853ed2.js similarity index 74% rename from assets/js/4941928a.987af661.js rename to assets/js/4941928a.6d853ed2.js index 55bd07896c..661bddc8b4 100644 --- a/assets/js/4941928a.987af661.js +++ b/assets/js/4941928a.6d853ed2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2703],{34:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-14.3/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/14.3/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/angular-13+.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.3/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.3/guides/esm-support"}}');var r=t(4848),a=t(8453),o=t(9489),i=t(7227);const l={id:"angular-13+",title:"Angular >=13"},c=void 0,u={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/14.3/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example-apps"})," for the tests that run using ESM mode."]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>S});var s=t(6540),r=t(4164),a=t(4245),o=t(6347),i=t(6494),l=t(2814),c=t(5167),u=t(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function g(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function h(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,d]=m({queryString:t,groupId:r}),[h,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,u.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),f(e)}),[d,f,a]),tabValues:a}}var f=t(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>l.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=h(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function S(e){const n=(0,f.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2703],{8260:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-14.3/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/14.3/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/angular-13+.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.3/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.3/guides/esm-support"}}');var r=t(4848),a=t(8453),o=t(1470),i=t(9365);const l={id:"angular-13+",title:"Angular >=13"},c=void 0,u={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/14.3/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example-apps"})," for the tests that run using ESM mode."]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>S});var s=t(6540),r=t(4164),a=t(3104),o=t(6347),i=t(205),l=t(7485),c=t(1682),u=t(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function g(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function h(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,d]=m({queryString:t,groupId:r}),[h,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,u.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),f(e)}),[d,f,a]),tabValues:a}}var f=t(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>{l.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=h(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function S(e){const n=(0,f.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/494f4f5e.5f51525d.js b/assets/js/494f4f5e.5f51525d.js deleted file mode 100644 index 747c4e2b9a..0000000000 --- a/assets/js/494f4f5e.5f51525d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8108],{5540:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});const s=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-10.x/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/10.x/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/angular-ivy.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/10.x/getting-started/test-environment"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/10.x/guides/esm-support"}}');var r=n(4848),i=n(8453);const o={id:"angular-ivy",title:"Angular Ivy"},a=void 0,c={},l=[];function u(e){const t={code:"code",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["Starting from ",(0,r.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,r.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,r.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," also provides util script to help you to run ",(0,r.jsx)(t.code,{children:"ngcc"})," with Jest but this script only works via the\nJavaScript version of Jest config"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nrequire('jest-preset-angular/ngcc-jest-processor');\n\nmodule.exports = {\n // [...]\n};\n"})})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/494f4f5e.bb0900b0.js b/assets/js/494f4f5e.bb0900b0.js new file mode 100644 index 0000000000..922d00f471 --- /dev/null +++ b/assets/js/494f4f5e.bb0900b0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8108],{2697:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});const s=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-10.x/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/10.x/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/angular-ivy.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/10.x/getting-started/test-environment"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/10.x/guides/esm-support"}}');var r=n(4848),i=n(8453);const o={id:"angular-ivy",title:"Angular Ivy"},a=void 0,c={},l=[];function u(e){const t={code:"code",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["Starting from ",(0,r.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,r.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,r.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," also provides util script to help you to run ",(0,r.jsx)(t.code,{children:"ngcc"})," with Jest but this script only works via the\nJavaScript version of Jest config"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nrequire('jest-preset-angular/ngcc-jest-processor');\n\nmodule.exports = {\n // [...]\n};\n"})})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4b3f866b.0d5003f7.js b/assets/js/4b3f866b.0d5003f7.js deleted file mode 100644 index 7583a79597..0000000000 --- a/assets/js/4b3f866b.0d5003f7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7400],{4151:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-14.2/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/14.2/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/esm-support.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.2/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.2/guides/jsdom-version"}}');var r=s(4848),a=s(8453),o=s(9489),i=s(7227);const l={id:"esm-support",title:"ESM Support"},u=void 0,c={},d=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/14.2/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsxs)(t.p,{children:["Besides, there is ",(0,r.jsx)(t.code,{children:"setup-jest.mjs"})," to add to Jest setup file to ensure that Jest can set up test environment properly."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html)$',\n useESM: true,\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},9489:(e,t,s)=>{s.d(t,{A:()=>S});var n=s(6540),r=s(4164),a=s(4245),o=s(6347),i=s(6494),l=s(2814),u=s(5167),c=s(9900);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,l.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[u,d]=m({queryString:s,groupId:r}),[f,g]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),j=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=s(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,s=l.indexOf(t),r=i[s].value;r!==n&&(u(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;t=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;t=l[s]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:i.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>i});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4b3f866b.a99cf192.js b/assets/js/4b3f866b.a99cf192.js new file mode 100644 index 0000000000..aa48daae5a --- /dev/null +++ b/assets/js/4b3f866b.a99cf192.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7400],{9197:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-14.2/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/14.2/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/esm-support.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.2/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.2/guides/jsdom-version"}}');var r=s(4848),a=s(8453),o=s(1470),i=s(9365);const l={id:"esm-support",title:"ESM Support"},u=void 0,c={},d=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/14.2/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsxs)(t.p,{children:["Besides, there is ",(0,r.jsx)(t.code,{children:"setup-jest.mjs"})," to add to Jest setup file to ensure that Jest can set up test environment properly."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html)$',\n useESM: true,\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},1470:(e,t,s)=>{s.d(t,{A:()=>S});var n=s(6540),r=s(4164),a=s(3104),o=s(6347),i=s(205),l=s(7485),u=s(1682),c=s(679);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,l.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[u,d]=m({queryString:s,groupId:r}),[f,g]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),j=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=s(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,s=l.indexOf(t),r=i[s].value;r!==n&&(u(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;t=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;t=l[s]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:i.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>i});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4e0c07c5.4c5cce2f.js b/assets/js/4e0c07c5.4c5cce2f.js new file mode 100644 index 0000000000..2d139e8a83 --- /dev/null +++ b/assets/js/4e0c07c5.4c5cce2f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5250],{7872:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/docs/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/next/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/getting-started/options.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/next/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/next/getting-started/test-environment"}}');var r=n(4848),o=n(8453),i=n(1470),a=n(9365);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function p(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(t.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(t.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(t.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(t.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(t.p,{children:["More information about ",(0,r.jsx)(t.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(t.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]})}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),"\n",(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(t.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(t.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(t.code,{children:"esbuild"})," in ",(0,r.jsx)(t.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(t.code,{children:"esbuild"}),", one can do the following:"]}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n snapshotSerializers: [\n 'jest-preset-angular/build/serializers/html-comment',\n 'jest-preset-angular/build/serializers/ng-snapshot',\n 'jest-preset-angular/build/serializers/no-ng-attributes',\n ],\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Jest runs with ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(t.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(t.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["We're using ",(0,r.jsx)(t.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(t.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(t.code,{children:"ts"}),"), HTML (",(0,r.jsx)(t.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(t.code,{children:"js"}),"), JSON (",(0,r.jsx)(t.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(t.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(t.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. See more in ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/next/guides/snapshot-testing",children:"Snapshot testing"})]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(t.code,{children:".mjs"})," files which come from ",(0,r.jsx)(t.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(t.code,{children:"TS"}),", ",(0,r.jsx)(t.code,{children:"JS"}),", ",(0,r.jsx)(t.code,{children:"MJS"}),", ",(0,r.jsx)(t.code,{children:"HTML"}),", or ",(0,r.jsx)(t.code,{children:"SVG"})," file through so called ",(0,r.jsx)(t.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var o=n(4848);function i(e){let{children:t,hidden:n,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),o=n(3104),i=n(6347),a=n(205),l=n(7485),c=n(1682),d=n(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return u(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,i.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(r.location.search);t.set(o,e),r.replace({...r.location,search:t.toString()})}),[o,r])]}function m(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,o=p(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:o}))),[c,u]=f({queryString:n,groupId:r}),[m,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,o]=(0,d.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:r}),j=(()=>{const e=c??m;return h({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{j&&l(j)}),[j]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),g(e)}),[u,g,o]),tabValues:o}}var g=n(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=n(4848);function b(e){let{className:t,block:n,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const t=e.currentTarget,n=l.indexOf(t),r=a[n].value;r!==s&&(c(t),i(r))},u=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:a.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",j.tabItem,o?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:o}=e;const i=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const r={},o=s.createContext(r);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4e0c07c5.eac8a70f.js b/assets/js/4e0c07c5.eac8a70f.js deleted file mode 100644 index 50d208e6a7..0000000000 --- a/assets/js/4e0c07c5.eac8a70f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5250],{4422:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/docs/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/next/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/getting-started/options.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/next/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/next/getting-started/test-environment"}}');var r=n(4848),o=n(8453),i=n(9489),a=n(7227);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function p(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(t.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(t.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(t.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(t.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(t.p,{children:["More information about ",(0,r.jsx)(t.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(t.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]})}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),"\n",(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(t.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(t.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(t.code,{children:"esbuild"})," in ",(0,r.jsx)(t.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(t.code,{children:"esbuild"}),", one can do the following:"]}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n snapshotSerializers: [\n 'jest-preset-angular/build/serializers/html-comment',\n 'jest-preset-angular/build/serializers/ng-snapshot',\n 'jest-preset-angular/build/serializers/no-ng-attributes',\n ],\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Jest runs with ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(t.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(t.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["We're using ",(0,r.jsx)(t.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(t.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(t.code,{children:"ts"}),"), HTML (",(0,r.jsx)(t.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(t.code,{children:"js"}),"), JSON (",(0,r.jsx)(t.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(t.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(t.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. See more in ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/next/guides/snapshot-testing",children:"Snapshot testing"})]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(t.code,{children:".mjs"})," files which come from ",(0,r.jsx)(t.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(t.code,{children:"TS"}),", ",(0,r.jsx)(t.code,{children:"JS"}),", ",(0,r.jsx)(t.code,{children:"MJS"}),", ",(0,r.jsx)(t.code,{children:"HTML"}),", or ",(0,r.jsx)(t.code,{children:"SVG"})," file through so called ",(0,r.jsx)(t.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var o=n(4848);function i(e){let{children:t,hidden:n,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),o=n(4245),i=n(6347),a=n(6494),l=n(2814),c=n(5167),d=n(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return u(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,i.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(r.location.search);t.set(o,e),r.replace({...r.location,search:t.toString()})}),[o,r])]}function m(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,o=p(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:o}))),[c,u]=f({queryString:n,groupId:r}),[m,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,o]=(0,d.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:r}),j=(()=>{const e=c??m;return h({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{j&&l(j)}),[j]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),g(e)}),[u,g,o]),tabValues:o}}var g=n(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=n(4848);function b(e){let{className:t,block:n,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const t=e.currentTarget,n=l.indexOf(t),r=a[n].value;r!==s&&(c(t),i(r))},u=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:a.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>l.push(e),onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",j.tabItem,o?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:o}=e;const i=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const r={},o=s.createContext(r);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/51d67042.09e30cff.js b/assets/js/51d67042.09e30cff.js new file mode 100644 index 0000000000..d89ec03c8d --- /dev/null +++ b/assets/js/51d67042.09e30cff.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6060],{9697:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-11.0/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/11.0/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/using-with-babel.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/11.0/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/11.0/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const r={id:"using-with-babel",title:"Using with Babel"},l=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>r,x:()=>l});var t=n(6540);const i={},o=t.createContext(i);function r(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function l(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/51d67042.940d81a8.js b/assets/js/51d67042.940d81a8.js deleted file mode 100644 index 28af9f31c3..0000000000 --- a/assets/js/51d67042.940d81a8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6060],{7121:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-11.0/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/11.0/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/using-with-babel.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/11.0/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/11.0/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const l={id:"using-with-babel",title:"Using with Babel"},r=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>l,x:()=>r});var t=n(6540);const i={},o=t.createContext(i);function l(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function r(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5253afba.6e93956b.js b/assets/js/5253afba.6e93956b.js new file mode 100644 index 0000000000..608172847f --- /dev/null +++ b/assets/js/5253afba.6e93956b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7832],{9011:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-14.3/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/14.3/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/angular-ivy.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.3/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.3/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"angular-ivy",title:"Angular Ivy"},c=void 0,u={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var r=n(6540),s=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:s}),[h,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,u.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(c(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function y(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function x(e){const t=h(e);return(0,j.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(y,{...t,...e})]})}function S(e){const t=(0,m.A)();return(0,j.jsx)(x,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5253afba.caa0464d.js b/assets/js/5253afba.caa0464d.js deleted file mode 100644 index a7282f1924..0000000000 --- a/assets/js/5253afba.caa0464d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7832],{9649:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"This step is OPTIONAL","source":"@site/versioned_docs/version-14.3/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/14.3/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/angular-ivy.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.3/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/14.3/guides/angular-13+"}}');var s=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"angular-ivy",title:"Angular Ivy"},c=void 0,u={},d=[{value:"Control ngcc processing",id:"control-ngcc-processing",level:2}];function p(e){const t={admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.admonition,{type:"important",children:(0,s.jsxs)(t.p,{children:["This step is ",(0,s.jsx)(t.strong,{children:"OPTIONAL"})]})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,s.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,s.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest global setup file to help you to run ",(0,s.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsx)(t.h2,{id:"control-ngcc-processing",children:"Control ngcc processing"}),"\n",(0,s.jsxs)(t.p,{children:["Since ",(0,s.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,s.jsx)(t.code,{children:"jest-preset-angular"})," provide a possibility to skip ",(0,s.jsx)(t.code,{children:"ngcc"})," via ",(0,s.jsx)(t.code,{children:"globalThis"})," by doing the following"]}),"\n",(0,s.jsxs)(l.A,{groupId:"code-examples",children:[(0,s.jsx)(o.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})}),(0,s.jsx)(o.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nglobalThis.ngJest = {\n skipNgcc: true,\n tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig\n};\n\nconst jestConfig: Config = {\n //...\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var r=n(6540),s=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const s=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,r.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(s.location.search);t.set(a,e),s.replace({...s.location,search:t.toString()})}),[a,s])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,a=p(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:s}),[h,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,a]=(0,u.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:s}),b=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),s=o[n].value;s!==r&&(c(t),l(s))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,s.A)("tabs__item",b.tabItem,a?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function y(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function x(e){const t=h(e);return(0,j.jsxs)("div",{className:(0,s.A)("tabs-container",b.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(y,{...t,...e})]})}function S(e){const t=(0,m.A)();return(0,j.jsx)(x,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const s={},a=r.createContext(s);function l(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/54071611.0c97ca50.js b/assets/js/54071611.05faf7f7.js similarity index 62% rename from assets/js/54071611.0c97ca50.js rename to assets/js/54071611.05faf7f7.js index 632b327589..78cfd755e9 100644 --- a/assets/js/54071611.0c97ca50.js +++ b/assets/js/54071611.05faf7f7.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6448],{80:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-10.x/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/10.x/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/getting-started/installation.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/10.x/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/10.x/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6448],{4730:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-10.x/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/10.x/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/getting-started/installation.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/10.x/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/10.x/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5465ebbc.0cf559d5.js b/assets/js/5465ebbc.0cf559d5.js deleted file mode 100644 index 6bf734b95b..0000000000 --- a/assets/js/5465ebbc.0cf559d5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6883],{3989:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-14.3/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/14.3/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/absolute-imports.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.3/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/14.3/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5465ebbc.e27bdab3.js b/assets/js/5465ebbc.e27bdab3.js new file mode 100644 index 0000000000..b6b3afa454 --- /dev/null +++ b/assets/js/5465ebbc.e27bdab3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6883],{2601:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-14.3/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/14.3/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/guides/absolute-imports.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.3/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/14.3/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/54f44165.93cf3ebf.js b/assets/js/54f44165.5995fb4f.js similarity index 72% rename from assets/js/54f44165.93cf3ebf.js rename to assets/js/54f44165.5995fb4f.js index 7459a85bbd..c7a1444ab1 100644 --- a/assets/js/54f44165.93cf3ebf.js +++ b/assets/js/54f44165.5995fb4f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7924],{1226:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/docs/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/next/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/getting-started/installation.md","tags":[],"version":"current","lastUpdatedBy":"ahnpnl","lastUpdatedAt":1734689944000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/next/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/next/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),i=n(7227);const o={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(i.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsx)(t.p,{children:"In your project root, create a setup file with following contents:"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(t.p,{children:"Add the following section to your root Jest config"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label":"TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label":"TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"tsconfig-cjs",label:"Tsconfig CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json5",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig CJS"}',children:"{\n //...\n extends: './tsconfig.json',\n compilerOptions: {\n //...\n module: 'CommonJS',\n types: ['jest'],\n },\n include: ['src/**/*.spec.ts', 'src/**/*.d.ts'],\n //...\n}\n"})})}),(0,r.jsx)(i.A,{value:"tsconfig-esm",label:"Tsconfig ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig ESM"}',children:'{\n //...\n "extends": "./tsconfig.json",\n "compilerOptions": {\n //...\n "module": "ES2022",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n //...\n}\n'})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="package.json"',children:'{\n //...\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n //...\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),i=n(6494),o=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[g,j]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&o(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>o.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function S(e){const t=(0,j.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7924],{7668:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/docs/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/next/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/getting-started/installation.md","tags":[],"version":"current","lastUpdatedBy":"ahnpnl","lastUpdatedAt":1734689944000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/next/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/next/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),i=n(9365);const o={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(i.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsx)(t.p,{children:"In your project root, create a setup file with following contents:"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(t.p,{children:"Add the following section to your root Jest config"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label":"TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label":"TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"tsconfig-cjs",label:"Tsconfig CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json5",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig CJS"}',children:"{\n //...\n extends: './tsconfig.json',\n compilerOptions: {\n //...\n module: 'CommonJS',\n types: ['jest'],\n },\n include: ['src/**/*.spec.ts', 'src/**/*.d.ts'],\n //...\n}\n"})})}),(0,r.jsx)(i.A,{value:"tsconfig-esm",label:"Tsconfig ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig ESM"}',children:'{\n //...\n "extends": "./tsconfig.json",\n "compilerOptions": {\n //...\n "module": "ES2022",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n //...\n}\n'})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="package.json"',children:'{\n //...\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n //...\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),i=n(205),o=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[g,j]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&o(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{o.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function S(e){const t=(0,j.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5635425a.7e3fe4b7.js b/assets/js/5635425a.7e3fe4b7.js new file mode 100644 index 0000000000..5783a3e526 --- /dev/null +++ b/assets/js/5635425a.7e3fe4b7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9806],{2699:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-9.x/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/9.x/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/esm-support.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/9.x/guides/angular-ivy"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/9.x/guides/jsdom-version"}}');var o=t(4848),r=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:["To use ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,o.jsx)(s.code,{children:"ts-jest"})," config option ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/next/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/next/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:["There is also a ",(0,o.jsx)(s.a,{href:"/jest-preset-angular/docs/9.x/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,o.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,o.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})}),"\n",(0,o.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,o.jsxs)(s.admonition,{type:"tip",children:[(0,o.jsxs)(s.p,{children:["Jest will attempt to load ",(0,o.jsx)(s.strong,{children:"ESM"})," files from ",(0,o.jsx)(s.code,{children:"node_modules"})," with default ",(0,o.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,o.jsx)(s.strong,{children:"ESM"})," built files or ",(0,o.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,o.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,o.jsxs)(s.p,{children:["To fix that, one can use ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,o.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const o={},r=n.createContext(o);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5635425a.bba12edf.js b/assets/js/5635425a.bba12edf.js deleted file mode 100644 index 02f1b21fbe..0000000000 --- a/assets/js/5635425a.bba12edf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9806],{1844:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-9.x/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/9.x/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/esm-support.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/9.x/guides/angular-ivy"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/9.x/guides/jsdom-version"}}');var o=t(4848),r=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:["To use ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,o.jsx)(s.code,{children:"ts-jest"})," config option ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/next/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/next/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:["There is also a ",(0,o.jsx)(s.a,{href:"/jest-preset-angular/docs/9.x/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,o.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,o.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})}),"\n",(0,o.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,o.jsxs)(s.admonition,{type:"tip",children:[(0,o.jsxs)(s.p,{children:["Jest will attempt to load ",(0,o.jsx)(s.strong,{children:"ESM"})," files from ",(0,o.jsx)(s.code,{children:"node_modules"})," with default ",(0,o.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,o.jsx)(s.strong,{children:"ESM"})," built files or ",(0,o.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,o.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,o.jsxs)(s.p,{children:["To fix that, one can use ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,o.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const o={},r=n.createContext(o);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/56acf0ae.5b78e041.js b/assets/js/56acf0ae.5b78e041.js new file mode 100644 index 0000000000..ae4c53d168 --- /dev/null +++ b/assets/js/56acf0ae.5b78e041.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1694],{687:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-13.0/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/13.0/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/jsdom-version.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/13.0/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/13.0/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/56acf0ae.afcb0a82.js b/assets/js/56acf0ae.afcb0a82.js deleted file mode 100644 index 0f5aa9101e..0000000000 --- a/assets/js/56acf0ae.afcb0a82.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1694],{168:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-13.0/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/13.0/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/jsdom-version.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/13.0/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/13.0/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5ae6b2db.2ada3389.js b/assets/js/5ae6b2db.2ada3389.js deleted file mode 100644 index 01ad0be9f1..0000000000 --- a/assets/js/5ae6b2db.2ada3389.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6358],{9091:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-11.1/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/11.1/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/introduction.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/11.1/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5ae6b2db.a5d48355.js b/assets/js/5ae6b2db.a5d48355.js new file mode 100644 index 0000000000..91adda1d40 --- /dev/null +++ b/assets/js/5ae6b2db.a5d48355.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6358],{8111:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-11.1/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/11.1/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/introduction.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/11.1/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5b125e0e.697a5467.js b/assets/js/5b125e0e.697a5467.js new file mode 100644 index 0000000000..2a79f231c8 --- /dev/null +++ b/assets/js/5b125e0e.697a5467.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8904],{8422:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/docs/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/next/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/angular-13+.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/next/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/next/guides/esm-support"}}');var r=n(4848),a=n(8453),o=n(1470),i=n(9365);const l={id:"angular-13+",title:"Angular >=13"},c=void 0,u={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(t.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(t.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(t.strong,{children:"Angular 13"})," using ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/next/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["With Jest 28 and ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(t.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(t.p,{children:["Starting from ",(0,r.jsx)(t.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(t.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(t.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(t.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"transform"})," is updated to include ",(0,r.jsx)(t.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(t.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Upgrade the project to ",(0,r.jsx)(t.strong,{children:"Angular 13"})," following ",(0,r.jsx)(t.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsx)(t.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(t.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(t.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example-apps"})," for the tests that run using ESM mode."]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(t.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(t.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(t.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(t.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(t.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(t.code,{children:"mjs"})," to ",(0,r.jsx)(t.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(t.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(t.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(t.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(t.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(t.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(t.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(t.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(t.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),a=n(3104),o=n(6347),i=n(205),l=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[h,f]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),f(e)}),[d,f,a]),tabValues:a}}var f=n(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=n(4848);function b(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=l.indexOf(t),r=i[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=h(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,f.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5b125e0e.b9d894f0.js b/assets/js/5b125e0e.b9d894f0.js deleted file mode 100644 index 86749ba064..0000000000 --- a/assets/js/5b125e0e.b9d894f0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8904],{3466:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/docs/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/next/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/angular-13+.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/next/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/next/guides/esm-support"}}');var r=n(4848),a=n(8453),o=n(9489),i=n(7227);const l={id:"angular-13+",title:"Angular >=13"},c=void 0,u={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(t.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(t.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(t.strong,{children:"Angular 13"})," using ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/next/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["With Jest 28 and ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(t.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(t.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(t.p,{children:["Starting from ",(0,r.jsx)(t.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(t.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(t.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(t.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"transform"})," is updated to include ",(0,r.jsx)(t.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(t.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Upgrade the project to ",(0,r.jsx)(t.strong,{children:"Angular 13"})," following ",(0,r.jsx)(t.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsx)(t.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(t.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(t.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example-apps"})," for the tests that run using ESM mode."]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(t.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(t.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(t.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(t.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(t.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(t.code,{children:"mjs"})," to ",(0,r.jsx)(t.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(t.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(t.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(t.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(t.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(t.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(t.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(t.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(t.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),a=n(4245),o=n(6347),i=n(6494),l=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[h,f]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),f(e)}),[d,f,a]),tabValues:a}}var f=n(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=n(4848);function b(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=l.indexOf(t),r=i[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>l.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=h(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,f.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5b1cb890.1130ccab.js b/assets/js/5b1cb890.1130ccab.js new file mode 100644 index 0000000000..5454c37720 --- /dev/null +++ b/assets/js/5b1cb890.1130ccab.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4827],{499:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-13.0/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/13.0/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/getting-started/presets.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/13.0/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/13.0/getting-started/options"}}');var r=n(4848),a=n(8453),o=n(1470),l=n(9365);const i={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"transform"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"transform"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { defaultTransformerOptions } = require('jest-preset-angular/presets');\n// const { defaultTransformerOptions } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),o=n(6347),l=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:r}),[g,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{j&&i(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=l[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:l.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>l});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5b1cb890.dd9ccb6e.js b/assets/js/5b1cb890.dd9ccb6e.js deleted file mode 100644 index 14f5479c5a..0000000000 --- a/assets/js/5b1cb890.dd9ccb6e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4827],{7534:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-13.0/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/13.0/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/getting-started/presets.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/13.0/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/13.0/getting-started/options"}}');var r=n(4848),a=n(8453),o=n(9489),l=n(7227);const i={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"transform"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"transform"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { defaultTransformerOptions } = require('jest-preset-angular/presets');\n// const { defaultTransformerOptions } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),o=n(6347),l=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:r}),[g,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{j&&i(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=l[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:l.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>l});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5e95c892.5227adc5.js b/assets/js/5e95c892.3981f719.js similarity index 62% rename from assets/js/5e95c892.5227adc5.js rename to assets/js/5e95c892.3981f719.js index 3bc9598ba6..ab48c070ff 100644 --- a/assets/js/5e95c892.5227adc5.js +++ b/assets/js/5e95c892.3981f719.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9647],{3124:(e,s,r)=>{r.r(s),r.d(s,{default:()=>l});r(6540);var t=r(4164),u=r(4239),a=r(8630),c=r(2831),n=r(7784),i=r(4848);function l(e){return(0,i.jsx)(u.e3,{className:(0,t.A)(a.G.wrapper.docsPages),children:(0,i.jsx)(n.A,{children:(0,c.v)(e.route.routes)})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9647],{7121:(e,s,r)=>{r.r(s),r.d(s,{default:()=>l});r(6540);var t=r(4164),u=r(9024),a=r(7559),c=r(2831),n=r(1957),i=r(4848);function l(e){return(0,i.jsx)(u.e3,{className:(0,t.A)(a.G.wrapper.docsPages),children:(0,i.jsx)(n.A,{children:(0,c.v)(e.route.routes)})})}}}]); \ No newline at end of file diff --git a/assets/js/5ee9d842.78f8f27b.js b/assets/js/5ee9d842.78f8f27b.js deleted file mode 100644 index db00120c9b..0000000000 --- a/assets/js/5ee9d842.78f8f27b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6917],{4971:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-11.1/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/11.1/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/getting-started/test-environment.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/11.1/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/11.1/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,d={},c=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5ee9d842.b7446e8f.js b/assets/js/5ee9d842.b7446e8f.js new file mode 100644 index 0000000000..d3cac00d23 --- /dev/null +++ b/assets/js/5ee9d842.b7446e8f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6917],{781:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-11.1/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/11.1/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/getting-started/test-environment.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/11.1/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/11.1/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,c={},d=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5f85402d.42415850.js b/assets/js/5f85402d.42415850.js new file mode 100644 index 0000000000..e48b3f4a1b --- /dev/null +++ b/assets/js/5f85402d.42415850.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3489],{6570:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-12.0/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/12.0/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/getting-started/installation.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/12.0/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/12.0/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5f85402d.53f0bb2a.js b/assets/js/5f85402d.53f0bb2a.js deleted file mode 100644 index 9512b839d4..0000000000 --- a/assets/js/5f85402d.53f0bb2a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3489],{9096:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-12.0/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/12.0/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/getting-started/installation.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/12.0/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/12.0/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6059e070.024aac93.js b/assets/js/6059e070.024aac93.js deleted file mode 100644 index f6d49db859..0000000000 --- a/assets/js/6059e070.024aac93.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8649],{6279:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-13.0/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/13.0/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/getting-started/installation.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/13.0/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/13.0/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6059e070.a1ff5026.js b/assets/js/6059e070.a1ff5026.js new file mode 100644 index 0000000000..48cef76a1d --- /dev/null +++ b/assets/js/6059e070.a1ff5026.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8649],{3118:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-13.0/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/13.0/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/getting-started/installation.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/13.0/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/13.0/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6266f1ba.08903fa7.js b/assets/js/6266f1ba.08903fa7.js new file mode 100644 index 0000000000..db5d9aaf0f --- /dev/null +++ b/assets/js/6266f1ba.08903fa7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5883],{5911:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-8.x/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/8.x/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/getting-started/options.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/8.x/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/8.x/getting-started/test-environment"}}');var o=n(4848),r=n(8453);const i={id:"options",title:"Options"},a=void 0,l={},d=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function c(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(t.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(t.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(t.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(t.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(t.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(t.p,{children:["More information about ",(0,o.jsx)(t.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsx)(t.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-js",children:"module.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n astTransformers: {\n before: [\n 'jest-preset-angular/build/InlineFilesTransformer',\n 'jest-preset-angular/build/StripStylesTransformer',\n ],\n },\n },\n },\n transform: {\n '^.+\\\\.(ts|js|html)$': 'ts-jest',\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json'],\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n transformIgnorePatterns: ['node_modules/(?!@ngrx)'],\n snapshotSerializers: [\n 'jest-preset-angular/build/serializers/html-comment',\n 'jest-preset-angular/build/serializers/ng-snapshot',\n 'jest-preset-angular/build/serializers/no-ng-attributes',\n ],\n};\n"})}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Jest doesn't run in browser nor through dev server. It uses ",(0,o.jsx)(t.code,{children:"JSDOM"})," to abstract browser environment. So we have to cheat\na little and inline our templates and get rid of styles (",(0,o.jsx)(t.strong,{children:"we're not testing CSS"}),") because otherwise Angular will try\nto make ",(0,o.jsx)(t.code,{children:"XHR"})," call for our templates and fail miserably."]})}),"\n",(0,o.jsx)(t.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["we're using some ",(0,o.jsx)(t.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(t.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"transform"'})," \u2013 run every TS, JS, or HTML file through so called ",(0,o.jsx)(t.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(t.code,{children:"ts"}),"), HTML (",(0,o.jsx)(t.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(t.code,{children:"js"}),") and JSON (",(0,o.jsx)(t.code,{children:"json"}),") files."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses regex."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"transformIgnorePatterns"'})," \u2013 unfortunately some modules (like @ngrx) are released as TypeScript files, not pure JavaScript;\nin such cases we cannot ignore them (all node_modules are ignored by default), so they can be transformed through TS compiler\nlike any other module in our project."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(t.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(t.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(t.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(t.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(t.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6266f1ba.fd3bdaf0.js b/assets/js/6266f1ba.fd3bdaf0.js deleted file mode 100644 index 61f040e0a5..0000000000 --- a/assets/js/6266f1ba.fd3bdaf0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5883],{3298:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-8.x/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/8.x/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/getting-started/options.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/8.x/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/8.x/getting-started/test-environment"}}');var o=n(4848),r=n(8453);const i={id:"options",title:"Options"},a=void 0,l={},d=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function c(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(t.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(t.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(t.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(t.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(t.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(t.p,{children:["More information about ",(0,o.jsx)(t.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsx)(t.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-js",children:"module.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n astTransformers: {\n before: [\n 'jest-preset-angular/build/InlineFilesTransformer',\n 'jest-preset-angular/build/StripStylesTransformer',\n ],\n },\n },\n },\n transform: {\n '^.+\\\\.(ts|js|html)$': 'ts-jest',\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json'],\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n transformIgnorePatterns: ['node_modules/(?!@ngrx)'],\n snapshotSerializers: [\n 'jest-preset-angular/build/serializers/html-comment',\n 'jest-preset-angular/build/serializers/ng-snapshot',\n 'jest-preset-angular/build/serializers/no-ng-attributes',\n ],\n};\n"})}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Jest doesn't run in browser nor through dev server. It uses ",(0,o.jsx)(t.code,{children:"JSDOM"})," to abstract browser environment. So we have to cheat\na little and inline our templates and get rid of styles (",(0,o.jsx)(t.strong,{children:"we're not testing CSS"}),") because otherwise Angular will try\nto make ",(0,o.jsx)(t.code,{children:"XHR"})," call for our templates and fail miserably."]})}),"\n",(0,o.jsx)(t.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["we're using some ",(0,o.jsx)(t.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(t.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"transform"'})," \u2013 run every TS, JS, or HTML file through so called ",(0,o.jsx)(t.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(t.code,{children:"ts"}),"), HTML (",(0,o.jsx)(t.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(t.code,{children:"js"}),") and JSON (",(0,o.jsx)(t.code,{children:"json"}),") files."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses regex."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"transformIgnorePatterns"'})," \u2013 unfortunately some modules (like @ngrx) are released as TypeScript files, not pure JavaScript;\nin such cases we cannot ignore them (all node_modules are ignored by default), so they can be transformed through TS compiler\nlike any other module in our project."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(t.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(t.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(t.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(t.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(t.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/252e2b80.6bca9d9a.js b/assets/js/63150b11.42797a50.js similarity index 56% rename from assets/js/252e2b80.6bca9d9a.js rename to assets/js/63150b11.42797a50.js index b90b2e3cbc..3df6cfe02c 100644 --- a/assets/js/252e2b80.6bca9d9a.js +++ b/assets/js/63150b11.42797a50.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8955],{4014:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>d,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>a});const t=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-10.x/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/10.x/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/getting-started/options.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/10.x/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/10.x/getting-started/test-environment"}}');var o=s(4848),r=s(8453);const i={id:"options",title:"Options"},d=void 0,c={},a=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function l(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(n.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(n.p,{children:["More information about ",(0,o.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsxs)(n.admonition,{type:"important",children:[(0,o.jsxs)(n.p,{children:["Since ",(0,o.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,o.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,o.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,o.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config"]}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})]}),"\n",(0,o.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"const snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n testEnvironment: 'jsdom',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': 'jest-preset-angular',\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json'],\n snapshotSerializers,\n};\n"})}),"\n",(0,o.jsx)(n.admonition,{type:"important",children:(0,o.jsxs)(n.p,{children:["Jest runs with ",(0,o.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,o.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,o.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,o.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["we're using some ",(0,o.jsx)(n.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,o.jsx)(n.code,{children:"TS"}),", ",(0,o.jsx)(n.code,{children:"JS"}),", ",(0,o.jsx)(n.code,{children:"MJS"}),", ",(0,o.jsx)(n.code,{children:"HTML"}),", or ",(0,o.jsx)(n.code,{children:"SVG"})," file through so called ",(0,o.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(n.code,{children:"ts"}),"), HTML (",(0,o.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(n.code,{children:"js"}),") and JSON (",(0,o.jsx)(n.code,{children:"json"}),") files."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses regex."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>d});var t=s(6540);const o={},r=t.createContext(o);function i(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3596],{4383:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>a});const t=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-9.x/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/9.x/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/getting-started/options.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/9.x/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/9.x/getting-started/test-environment"}}');var o=s(4848),r=s(8453);const i={id:"options",title:"Options"},c=void 0,d={},a=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function l(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(n.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(n.p,{children:["More information about ",(0,o.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsxs)(n.admonition,{type:"important",children:[(0,o.jsxs)(n.p,{children:["Since ",(0,o.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,o.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,o.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,o.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config"]}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n}\n"})})]}),"\n",(0,o.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"const snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n testEnvironment: 'jsdom',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': 'jest-preset-angular',\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json'],\n snapshotSerializers,\n};\n"})}),"\n",(0,o.jsx)(n.admonition,{type:"important",children:(0,o.jsxs)(n.p,{children:["Jest runs with ",(0,o.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,o.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,o.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,o.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["we're using some ",(0,o.jsx)(n.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,o.jsx)(n.code,{children:"TS"}),", ",(0,o.jsx)(n.code,{children:"JS"}),", ",(0,o.jsx)(n.code,{children:"MJS"}),", ",(0,o.jsx)(n.code,{children:"HTML"}),", or ",(0,o.jsx)(n.code,{children:"SVG"})," file through so called ",(0,o.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(n.code,{children:"ts"}),"), HTML (",(0,o.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(n.code,{children:"js"}),") and JSON (",(0,o.jsx)(n.code,{children:"json"}),") files."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses regex."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>c});var t=s(6540);const o={},r=t.createContext(o);function i(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/63150b11.f5130b32.js b/assets/js/63150b11.f5130b32.js deleted file mode 100644 index 1df690a8ca..0000000000 --- a/assets/js/63150b11.f5130b32.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3596],{1408:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>d,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>a});const t=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-9.x/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/9.x/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/getting-started/options.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/9.x/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/9.x/getting-started/test-environment"}}');var o=s(4848),r=s(8453);const i={id:"options",title:"Options"},d=void 0,c={},a=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function l(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(n.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(n.p,{children:["More information about ",(0,o.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsxs)(n.admonition,{type:"important",children:[(0,o.jsxs)(n.p,{children:["Since ",(0,o.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,o.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,o.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,o.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config"]}),(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n}\n"})})]}),"\n",(0,o.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-js",children:"const snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n testEnvironment: 'jsdom',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': 'jest-preset-angular',\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json'],\n snapshotSerializers,\n};\n"})}),"\n",(0,o.jsx)(n.admonition,{type:"important",children:(0,o.jsxs)(n.p,{children:["Jest runs with ",(0,o.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,o.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,o.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,o.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["we're using some ",(0,o.jsx)(n.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,o.jsx)(n.code,{children:"TS"}),", ",(0,o.jsx)(n.code,{children:"JS"}),", ",(0,o.jsx)(n.code,{children:"MJS"}),", ",(0,o.jsx)(n.code,{children:"HTML"}),", or ",(0,o.jsx)(n.code,{children:"SVG"})," file through so called ",(0,o.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(n.code,{children:"ts"}),"), HTML (",(0,o.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(n.code,{children:"js"}),") and JSON (",(0,o.jsx)(n.code,{children:"json"}),") files."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses regex."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>d});var t=s(6540);const o={},r=t.createContext(o);function i(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/651850eb.3203f10b.js b/assets/js/651850eb.3203f10b.js deleted file mode 100644 index b285eac5e2..0000000000 --- a/assets/js/651850eb.3203f10b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9461],{7440:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-8.x/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/8.x/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/introduction.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/8.x/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},u=[];function d(t){const e={a:"a",code:"code",p:"p",...(0,r.R)(),...t.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e.p,{children:[(0,o.jsx)(e.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(e.p,{children:["This is a part of the article: ",(0,o.jsx)(e.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]})]})}function p(t={}){const{wrapper:e}={...(0,r.R)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(d,{...t})}):d(t)}},8453:(t,e,n)=>{n.d(e,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(t){const e=s.useContext(r);return s.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function c(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(o):t.components||o:i(t.components),s.createElement(r.Provider,{value:e},t.children)}}}]); \ No newline at end of file diff --git a/assets/js/651850eb.42c01b62.js b/assets/js/651850eb.42c01b62.js new file mode 100644 index 0000000000..a45d5a84ce --- /dev/null +++ b/assets/js/651850eb.42c01b62.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9461],{4866:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-8.x/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/8.x/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/introduction.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/8.x/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},u=[];function d(t){const e={a:"a",code:"code",p:"p",...(0,r.R)(),...t.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e.p,{children:[(0,o.jsx)(e.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(e.p,{children:["This is a part of the article: ",(0,o.jsx)(e.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]})]})}function p(t={}){const{wrapper:e}={...(0,r.R)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(d,{...t})}):d(t)}},8453:(t,e,n)=>{n.d(e,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(t){const e=s.useContext(r);return s.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function c(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(o):t.components||o:i(t.components),s.createElement(r.Provider,{value:e},t.children)}}}]); \ No newline at end of file diff --git a/assets/js/6608151e.663dee4c.js b/assets/js/6608151e.663dee4c.js new file mode 100644 index 0000000000..75dccbf7b5 --- /dev/null +++ b/assets/js/6608151e.663dee4c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2891],{185:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-10.x/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/10.x/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/introduction.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/10.x/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6608151e.d6012343.js b/assets/js/6608151e.d6012343.js deleted file mode 100644 index 9c1cc55e59..0000000000 --- a/assets/js/6608151e.d6012343.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2891],{3593:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-10.x/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/10.x/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/introduction.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/10.x/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/68240572.0e0b55b5.js b/assets/js/68240572.0e0b55b5.js new file mode 100644 index 0000000000..d2bd7593a3 --- /dev/null +++ b/assets/js/68240572.0e0b55b5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[689],{4564:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>g,frontMatter:()=>p,metadata:()=>s,toc:()=>h});const s=JSON.parse('{"id":"guides/snapshot-testing","title":"Snapshot testing","description":"jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.","source":"@site/docs/guides/snapshot-testing.md","sourceDirName":"guides","slug":"/guides/snapshot-testing","permalink":"/jest-preset-angular/docs/next/guides/snapshot-testing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/snapshot-testing.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"snapshot-testing","title":"Snapshot testing"},"sidebar":"docs","previous":{"title":"JSDOM version","permalink":"/jest-preset-angular/docs/next/guides/jsdom-version"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/next/guides/using-with-babel"}}');var i=t(4848),r=t(8453),l=t(1470),a=t(9365),o=t(4252);const p={id:"snapshot-testing",title:"Snapshot testing"},c=void 0,d={},h=[{value:"Snapshot serializers",id:"snapshot-serializers",level:2},{value:"Remove html comments (<code>html-comment</code>)",id:"remove-html-comments-html-comment",level:3},{value:"Examples:",id:"examples",level:4},{value:"Display component HTML (<code>ng-snapshot</code>)",id:"display-component-html-ng-snapshot",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Examples:",id:"examples-1",level:4},{value:"With options",id:"with-options",level:4},{value:"Remove Angular attributes (<code>no-ng-attributes</code>)",id:"remove-angular-attributes-no-ng-attributes",level:3},{value:"Examples:",id:"examples-2",level:4}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"jest-preset-angular"})," provides several snapshot serializers to generate clearer and more human-readable snapshot."]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"BY DEFAULT"}),", the ",(0,i.jsx)(n.a,{href:"/jest-preset-angular/docs/next/getting-started/presets",children:"preset"})," provides all of the snapshot serializers below."]})}),"\n",(0,i.jsx)(n.h2,{id:"snapshot-serializers",children:"Snapshot serializers"}),"\n","\n",(0,i.jsx)(o.A,{toc:h.slice(1)}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsxs)(n.h3,{id:"remove-html-comments-html-comment",children:["Remove html comments (",(0,i.jsx)(n.code,{children:"html-comment"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow removing all the comments in the component HTML in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"examples",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"display-component-html-ng-snapshot",children:["Display component HTML (",(0,i.jsx)(n.code,{children:"ng-snapshot"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow displaying component HTML with data in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["options(",(0,i.jsx)(n.strong,{children:"optional"}),"):","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"omitAllCompAttrs: remove all component DOM attributes"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type NgSnapshotOptions = {\n omitAllCompAttrs?: boolean;\n};\n"})}),"\n",(0,i.jsx)(n.h4,{id:"examples-1",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsx)(n.h4,{id:"with-options",children:"With options"}),"\n",(0,i.jsxs)(n.admonition,{title:"Effective priority",type:"info",children:[(0,i.jsx)(n.p,{children:"The configured serializers will have affect in this order:"}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Jest config"})," -> ",(0,i.jsx)(n.code,{children:"setup files"})," -> ",(0,i.jsx)(n.code,{children:"test files"})]}),(0,i.jsx)(n.p,{children:"The later the higher priority. This means that with the same serializer, the later one will override the configuration\nof the previous one in the chain."})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In setup files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"or in individual test files:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"remove-angular-attributes-no-ng-attributes",children:["Remove Angular attributes (",(0,i.jsx)(n.code,{children:"no-ng-attributes"}),")"]}),"\n",(0,i.jsxs)(n.p,{children:["Allow removing attributes generated by Angular fixture, like ",(0,i.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,i.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,i.jsx)(n.code,{children:"_ngcontent-c*"})," etc., from component snapshot"]}),"\n",(0,i.jsx)(n.h4,{id:"examples-2",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})]})}function g(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}}}]); \ No newline at end of file diff --git a/assets/js/68240572.4abb7551.js b/assets/js/68240572.4abb7551.js deleted file mode 100644 index e931d436d8..0000000000 --- a/assets/js/68240572.4abb7551.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[689],{8255:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>g,frontMatter:()=>p,metadata:()=>s,toc:()=>h});const s=JSON.parse('{"id":"guides/snapshot-testing","title":"Snapshot testing","description":"jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.","source":"@site/docs/guides/snapshot-testing.md","sourceDirName":"guides","slug":"/guides/snapshot-testing","permalink":"/jest-preset-angular/docs/next/guides/snapshot-testing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/snapshot-testing.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"snapshot-testing","title":"Snapshot testing"},"sidebar":"docs","previous":{"title":"JSDOM version","permalink":"/jest-preset-angular/docs/next/guides/jsdom-version"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/next/guides/using-with-babel"}}');var i=t(4848),r=t(8453),l=t(9489),a=t(7227),o=t(1574);const p={id:"snapshot-testing",title:"Snapshot testing"},c=void 0,d={},h=[{value:"Snapshot serializers",id:"snapshot-serializers",level:2},{value:"Remove html comments (<code>html-comment</code>)",id:"remove-html-comments-html-comment",level:3},{value:"Examples:",id:"examples",level:4},{value:"Display component HTML (<code>ng-snapshot</code>)",id:"display-component-html-ng-snapshot",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Examples:",id:"examples-1",level:4},{value:"With options",id:"with-options",level:4},{value:"Remove Angular attributes (<code>no-ng-attributes</code>)",id:"remove-angular-attributes-no-ng-attributes",level:3},{value:"Examples:",id:"examples-2",level:4}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"jest-preset-angular"})," provides several snapshot serializers to generate clearer and more human-readable snapshot."]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"BY DEFAULT"}),", the ",(0,i.jsx)(n.a,{href:"/jest-preset-angular/docs/next/getting-started/presets",children:"preset"})," provides all of the snapshot serializers below."]})}),"\n",(0,i.jsx)(n.h2,{id:"snapshot-serializers",children:"Snapshot serializers"}),"\n","\n",(0,i.jsx)(o.A,{toc:h.slice(1)}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsxs)(n.h3,{id:"remove-html-comments-html-comment",children:["Remove html comments (",(0,i.jsx)(n.code,{children:"html-comment"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow removing all the comments in the component HTML in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"examples",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"display-component-html-ng-snapshot",children:["Display component HTML (",(0,i.jsx)(n.code,{children:"ng-snapshot"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow displaying component HTML with data in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["options(",(0,i.jsx)(n.strong,{children:"optional"}),"):","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"omitAllCompAttrs: remove all component DOM attributes"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type NgSnapshotOptions = {\n omitAllCompAttrs?: boolean;\n};\n"})}),"\n",(0,i.jsx)(n.h4,{id:"examples-1",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsx)(n.h4,{id:"with-options",children:"With options"}),"\n",(0,i.jsxs)(n.admonition,{title:"Effective priority",type:"info",children:[(0,i.jsx)(n.p,{children:"The configured serializers will have affect in this order:"}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Jest config"})," -> ",(0,i.jsx)(n.code,{children:"setup files"})," -> ",(0,i.jsx)(n.code,{children:"test files"})]}),(0,i.jsx)(n.p,{children:"The later the higher priority. This means that with the same serializer, the later one will override the configuration\nof the previous one in the chain."})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In setup files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"or in individual test files:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"remove-angular-attributes-no-ng-attributes",children:["Remove Angular attributes (",(0,i.jsx)(n.code,{children:"no-ng-attributes"}),")"]}),"\n",(0,i.jsxs)(n.p,{children:["Allow removing attributes generated by Angular fixture, like ",(0,i.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,i.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,i.jsx)(n.code,{children:"_ngcontent-c*"})," etc., from component snapshot"]}),"\n",(0,i.jsx)(n.h4,{id:"examples-2",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})]})}function g(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}}}]); \ No newline at end of file diff --git a/assets/js/68e3f1d5.e94951ee.js b/assets/js/68e3f1d5.55912d98.js similarity index 70% rename from assets/js/68e3f1d5.e94951ee.js rename to assets/js/68e3f1d5.55912d98.js index 0c1d4e70dd..0fec930afb 100644 --- a/assets/js/68e3f1d5.e94951ee.js +++ b/assets/js/68e3f1d5.55912d98.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7367],{38:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>i,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-12.0/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/12.0/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/angular-13+.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/12.0/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/12.0/guides/esm-support"}}');var r=s(4848),a=s(8453),o=s(9489),l=s(7227);const i={id:"angular-13+",title:"Angular >=13"},u=void 0,c={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/12.0/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://update.angular.io/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,r.jsx)(n.p,{children:"Your Jest config should be changed to something like:"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n globals: {\n 'ts-jest': {\n useESM: true,\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n },\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n globals: {\n 'ts-jest': {\n useESM: true,\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n },\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(n.p,{children:"or for ESM mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,n,s)=>{s.d(n,{A:()=>o});s(6540);var t=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:n,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,t.A)(r.tabItem,o),hidden:s,children:n})}},9489:(e,n,s)=>{s.d(n,{A:()=>A});var t=s(6540),r=s(4164),a=s(4245),o=s(6347),l=s(6494),i=s(2814),u=s(5167),c=s(9900);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,s])}function g(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function h(e){let{queryString:n=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i.aZ)(a),(0,t.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,a=p(e),[o,i]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:a}))),[u,d]=h({queryString:s,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,c.Dv)(s);return[r,(0,t.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),f=(()=>{const e=u??m;return g({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{f&&i(f)}),[f]);return{selectedValue:o,selectValue:(0,t.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:n,block:s,selectedValue:t,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const n=e.currentTarget,s=i.indexOf(n),r=l[s].value;r!==t&&(u(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},n),children:l.map((e=>{let{value:n,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,t.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function w(e){const n=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function A(e){const n=(0,j.A)();return(0,x.jsx)(w,{...e,children:d(e.children)},String(n))}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>l});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7367],{4713:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>i,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-12.0/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/12.0/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/angular-13+.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/12.0/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/12.0/guides/esm-support"}}');var r=s(4848),a=s(8453),o=s(1470),l=s(9365);const i={id:"angular-13+",title:"Angular >=13"},u=void 0,c={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/12.0/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://update.angular.io/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,r.jsx)(n.p,{children:"Your Jest config should be changed to something like:"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n globals: {\n 'ts-jest': {\n useESM: true,\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n },\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n globals: {\n 'ts-jest': {\n useESM: true,\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n },\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(n.p,{children:"or for ESM mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,n,s)=>{s.d(n,{A:()=>o});s(6540);var t=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:n,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,t.A)(r.tabItem,o),hidden:s,children:n})}},1470:(e,n,s)=>{s.d(n,{A:()=>A});var t=s(6540),r=s(4164),a=s(3104),o=s(6347),l=s(205),i=s(7485),u=s(1682),c=s(679);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,s])}function g(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function h(e){let{queryString:n=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i.aZ)(a),(0,t.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,a=p(e),[o,i]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:a}))),[u,d]=h({queryString:s,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,c.Dv)(s);return[r,(0,t.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),f=(()=>{const e=u??m;return g({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{f&&i(f)}),[f]);return{selectedValue:o,selectValue:(0,t.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:n,block:s,selectedValue:t,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const n=e.currentTarget,s=i.indexOf(n),r=l[s].value;r!==t&&(u(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},n),children:l.map((e=>{let{value:n,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,t.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function w(e){const n=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function A(e){const n=(0,j.A)();return(0,x.jsx)(w,{...e,children:d(e.children)},String(n))}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>l});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6916680a.bd1707c0.js b/assets/js/6916680a.bd1707c0.js deleted file mode 100644 index 4f57e29fd1..0000000000 --- a/assets/js/6916680a.bd1707c0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3818],{9163:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-11.0/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/11.0/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/getting-started/installation.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/11.0/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/11.0/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6916680a.d798bef1.js b/assets/js/6916680a.d798bef1.js new file mode 100644 index 0000000000..c405fcb420 --- /dev/null +++ b/assets/js/6916680a.d798bef1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3818],{6696:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-11.0/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/11.0/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/getting-started/installation.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/11.0/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/11.0/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6a6dcee7.ab46b1af.js b/assets/js/6a6dcee7.ab46b1af.js new file mode 100644 index 0000000000..35441b62a1 --- /dev/null +++ b/assets/js/6a6dcee7.ab46b1af.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7466],{3577:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.js,","source":"@site/versioned_docs/version-14.2/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/14.2/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/getting-started/test-environment.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/14.2/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.2/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,l={},d=[{value:"Configure test environment",id:"configure-test-environment",level:3}];function c(e){const t={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.js",children:(0,r.jsx)(t.code,{children:"setup-jest.js"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/angular/angular/tree/main/packages/zone.js",children:"Angular zone patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]}),"\n",(0,r.jsxs)(t.p,{children:["While ",(0,r.jsx)(t.code,{children:"setup-jest.js"})," above is for running Jest with ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode, we also provide ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.mjs",children:(0,r.jsx)(t.code,{children:"setup-jest.mjs"})}),"\nto run with ",(0,r.jsx)(t.strong,{children:"ESM"})," mode."]}),"\n",(0,r.jsx)(t.h3,{id:"configure-test-environment",children:"Configure test environment"}),"\n",(0,r.jsxs)(t.p,{children:["When creating Angular test environment with ",(0,r.jsx)(t.code,{children:"TestBed"}),", it is possible to specify the ",(0,r.jsx)(t.code,{children:"testEnvironmentOptions"})," via ",(0,r.jsx)(t.code,{children:"globalThis"})," in the Jest setup file.\nFor example:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-test.ts\nglobalThis.ngJest = {\n testEnvironmentOptions: {\n teardown: {\n destroyAfterEach: false,\n rethrowErrors: true,\n },\n errorOnUnknownElements: true,\n errorOnUnknownProperties: true,\n },\n};\n\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," will look at ",(0,r.jsx)(t.code,{children:"globalThis.ngJest"})," and pass the correct ",(0,r.jsx)(t.a,{href:"https://angular.dev/api/core/testing/TestEnvironmentOptions",children:(0,r.jsx)(t.code,{children:"TestEnvironmentOptions"})})," object to ",(0,r.jsx)(t.code,{children:"TestBed"}),"."]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6a6dcee7.f491b0e8.js b/assets/js/6a6dcee7.f491b0e8.js deleted file mode 100644 index fdba24033e..0000000000 --- a/assets/js/6a6dcee7.f491b0e8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7466],{2249:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.js,","source":"@site/versioned_docs/version-14.2/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/14.2/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/getting-started/test-environment.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/14.2/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.2/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,l={},d=[{value:"Configure test environment",id:"configure-test-environment",level:3}];function c(e){const t={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.js",children:(0,r.jsx)(t.code,{children:"setup-jest.js"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/angular/angular/tree/main/packages/zone.js",children:"Angular zone patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]}),"\n",(0,r.jsxs)(t.p,{children:["While ",(0,r.jsx)(t.code,{children:"setup-jest.js"})," above is for running Jest with ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode, we also provide ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.mjs",children:(0,r.jsx)(t.code,{children:"setup-jest.mjs"})}),"\nto run with ",(0,r.jsx)(t.strong,{children:"ESM"})," mode."]}),"\n",(0,r.jsx)(t.h3,{id:"configure-test-environment",children:"Configure test environment"}),"\n",(0,r.jsxs)(t.p,{children:["When creating Angular test environment with ",(0,r.jsx)(t.code,{children:"TestBed"}),", it is possible to specify the ",(0,r.jsx)(t.code,{children:"testEnvironmentOptions"})," via ",(0,r.jsx)(t.code,{children:"globalThis"})," in the Jest setup file.\nFor example:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-test.ts\nglobalThis.ngJest = {\n testEnvironmentOptions: {\n teardown: {\n destroyAfterEach: false,\n rethrowErrors: true,\n },\n errorOnUnknownElements: true,\n errorOnUnknownProperties: true,\n },\n};\n\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," will look at ",(0,r.jsx)(t.code,{children:"globalThis.ngJest"})," and pass the correct ",(0,r.jsx)(t.a,{href:"https://angular.dev/api/core/testing/TestEnvironmentOptions",children:(0,r.jsx)(t.code,{children:"TestEnvironmentOptions"})})," object to ",(0,r.jsx)(t.code,{children:"TestBed"}),"."]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6d1ddfa7.d95a92fa.js b/assets/js/6d1ddfa7.d95a92fa.js new file mode 100644 index 0000000000..646c1b4183 --- /dev/null +++ b/assets/js/6d1ddfa7.d95a92fa.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4240],{6021:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-13.0/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/13.0/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/absolute-imports.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/13.0/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/13.0/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6d1ddfa7.eec75fa6.js b/assets/js/6d1ddfa7.eec75fa6.js deleted file mode 100644 index 60bdcfa8a8..0000000000 --- a/assets/js/6d1ddfa7.eec75fa6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4240],{7067:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-13.0/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/13.0/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/absolute-imports.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/13.0/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/13.0/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6f809103.be235bda.js b/assets/js/6f809103.be235bda.js deleted file mode 100644 index 0a67940f95..0000000000 --- a/assets/js/6f809103.be235bda.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[646],{7277:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-14.0/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/14.0/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/using-with-babel.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.0/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.0/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),u=n(5167),c=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function b(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=b({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{g&&i(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6f809103.c4f140f6.js b/assets/js/6f809103.c4f140f6.js new file mode 100644 index 0000000000..e59c691210 --- /dev/null +++ b/assets/js/6f809103.c4f140f6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[646],{9258:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-14.0/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/14.0/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/using-with-babel.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/14.0/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.0/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),u=n(1682),c=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function b(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=b({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{g&&i(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/710ad8a9.3d148adf.js b/assets/js/710ad8a9.3d148adf.js deleted file mode 100644 index 5c28e57362..0000000000 --- a/assets/js/710ad8a9.3d148adf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8828],{2377:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-11.0/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/11.0/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/jsdom-version.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/11.0/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/11.0/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/710ad8a9.6a8f363e.js b/assets/js/710ad8a9.6a8f363e.js new file mode 100644 index 0000000000..9774850cdc --- /dev/null +++ b/assets/js/710ad8a9.6a8f363e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8828],{2067:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-11.0/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/11.0/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/jsdom-version.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/11.0/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/11.0/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/72f058d3.18f8fac5.js b/assets/js/72f058d3.18f8fac5.js new file mode 100644 index 0000000000..d02918e4b9 --- /dev/null +++ b/assets/js/72f058d3.18f8fac5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7330],{6489:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-8.x/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/8.x/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/troubleshooting.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/8.x/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/72f058d3.64fb9f56.js b/assets/js/72f058d3.64fb9f56.js deleted file mode 100644 index 5c755a3e3d..0000000000 --- a/assets/js/72f058d3.64fb9f56.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7330],{1335:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-8.x/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/8.x/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/troubleshooting.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/8.x/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/732c3ce9.9d6521cf.js b/assets/js/732c3ce9.9d6521cf.js deleted file mode 100644 index 93742ed6cb..0000000000 --- a/assets/js/732c3ce9.9d6521cf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4340],{7791:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.js,","source":"@site/versioned_docs/version-13.0/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/13.0/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/getting-started/test-environment.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/13.0/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/13.0/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,l={},d=[{value:"Configure test environment",id:"configure-test-environment",level:3}];function c(e){const t={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.js",children:(0,r.jsx)(t.code,{children:"setup-jest.js"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/angular/angular/tree/main/packages/zone.js",children:"Angular zone patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]}),"\n",(0,r.jsxs)(t.p,{children:["While ",(0,r.jsx)(t.code,{children:"setup-jest.js"})," above is for running Jest with ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode, we also provide ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.mjs",children:(0,r.jsx)(t.code,{children:"setup-jest.mjs"})}),"\nto run with ",(0,r.jsx)(t.strong,{children:"ESM"})," mode."]}),"\n",(0,r.jsx)(t.h3,{id:"configure-test-environment",children:"Configure test environment"}),"\n",(0,r.jsxs)(t.p,{children:["When creating Angular test environment with ",(0,r.jsx)(t.code,{children:"TestBed"}),", it is possible to specify the ",(0,r.jsx)(t.code,{children:"testEnvironmentOptions"})," via ",(0,r.jsx)(t.code,{children:"globalThis"})," in the Jest setup file.\nFor example:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-test.ts\nglobalThis.ngJest = {\n testEnvironmentOptions: {\n teardown: {\n destroyAfterEach: false,\n rethrowErrors: true,\n },\n errorOnUnknownElements: true,\n errorOnUnknownProperties: true,\n },\n};\n\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," will look at ",(0,r.jsx)(t.code,{children:"globalThis.ngJest"})," and pass the correct ",(0,r.jsx)(t.a,{href:"https://angular.io/api/core/testing/TestEnvironmentOptions",children:(0,r.jsx)(t.code,{children:"TestEnvironmentOptions"})})," object to ",(0,r.jsx)(t.code,{children:"TestBed"}),"."]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/732c3ce9.fc9a795c.js b/assets/js/732c3ce9.fc9a795c.js new file mode 100644 index 0000000000..b41aa2cc47 --- /dev/null +++ b/assets/js/732c3ce9.fc9a795c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4340],{3381:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.js,","source":"@site/versioned_docs/version-13.0/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/13.0/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/getting-started/test-environment.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/13.0/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/13.0/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,l={},d=[{value:"Configure test environment",id:"configure-test-environment",level:3}];function c(e){const t={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.js",children:(0,r.jsx)(t.code,{children:"setup-jest.js"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/angular/angular/tree/main/packages/zone.js",children:"Angular zone patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]}),"\n",(0,r.jsxs)(t.p,{children:["While ",(0,r.jsx)(t.code,{children:"setup-jest.js"})," above is for running Jest with ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode, we also provide ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.mjs",children:(0,r.jsx)(t.code,{children:"setup-jest.mjs"})}),"\nto run with ",(0,r.jsx)(t.strong,{children:"ESM"})," mode."]}),"\n",(0,r.jsx)(t.h3,{id:"configure-test-environment",children:"Configure test environment"}),"\n",(0,r.jsxs)(t.p,{children:["When creating Angular test environment with ",(0,r.jsx)(t.code,{children:"TestBed"}),", it is possible to specify the ",(0,r.jsx)(t.code,{children:"testEnvironmentOptions"})," via ",(0,r.jsx)(t.code,{children:"globalThis"})," in the Jest setup file.\nFor example:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-test.ts\nglobalThis.ngJest = {\n testEnvironmentOptions: {\n teardown: {\n destroyAfterEach: false,\n rethrowErrors: true,\n },\n errorOnUnknownElements: true,\n errorOnUnknownProperties: true,\n },\n};\n\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," will look at ",(0,r.jsx)(t.code,{children:"globalThis.ngJest"})," and pass the correct ",(0,r.jsx)(t.a,{href:"https://angular.io/api/core/testing/TestEnvironmentOptions",children:(0,r.jsx)(t.code,{children:"TestEnvironmentOptions"})})," object to ",(0,r.jsx)(t.code,{children:"TestBed"}),"."]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/79ea3e73.75325dd6.js b/assets/js/79ea3e73.75325dd6.js deleted file mode 100644 index 92a3c634cc..0000000000 --- a/assets/js/79ea3e73.75325dd6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[795],{8029:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-9.x/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/9.x/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/getting-started/presets.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/9.x/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/9.x/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},l=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function c(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:["Or through TypeScript (if ",(0,r.jsx)(t.code,{children:"ts-node"})," is installed):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// jest.config.ts\nimport type { InitialOptionsTsJest } from 'ts-jest/dist/types';\nimport { defaults as jestNgPreset } from 'jest-preset-angular/presets';\n// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'\n\nconst config: InitialOptionsTsJest = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default config;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/79ea3e73.bbf47963.js b/assets/js/79ea3e73.bbf47963.js new file mode 100644 index 0000000000..a7c1f3896e --- /dev/null +++ b/assets/js/79ea3e73.bbf47963.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[795],{9892:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-9.x/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/9.x/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/getting-started/presets.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/9.x/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/9.x/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},l=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function c(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:["Or through TypeScript (if ",(0,r.jsx)(t.code,{children:"ts-node"})," is installed):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// jest.config.ts\nimport type { InitialOptionsTsJest } from 'ts-jest/dist/types';\nimport { defaults as jestNgPreset } from 'jest-preset-angular/presets';\n// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'\n\nconst config: InitialOptionsTsJest = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default config;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/7aeeadd4.b225a810.js b/assets/js/7aeeadd4.b225a810.js deleted file mode 100644 index 38d247e101..0000000000 --- a/assets/js/7aeeadd4.b225a810.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8654],{9941:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-8.x/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/8.x/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/getting-started/test-environment.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/8.x/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/8.x/guides/angular-ivy"}}');var r=n(4848),o=n(8453);const i={id:"test-environment",title:"Test environment"},a=void 0,d={},c=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,o.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/v8.3.2/src/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/v8.3.2/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const r={},o=s.createContext(r);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/7aeeadd4.bb4e52e9.js b/assets/js/7aeeadd4.bb4e52e9.js new file mode 100644 index 0000000000..ee3017b9e7 --- /dev/null +++ b/assets/js/7aeeadd4.bb4e52e9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8654],{3004:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-8.x/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/8.x/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/getting-started/test-environment.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/8.x/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/8.x/guides/angular-ivy"}}');var r=n(4848),o=n(8453);const i={id:"test-environment",title:"Test environment"},a=void 0,d={},c=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,o.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/v8.3.2/src/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/v8.3.2/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const r={},o=s.createContext(r);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/80b4c599.261e4d2d.js b/assets/js/80b4c599.261e4d2d.js deleted file mode 100644 index 7b9a57f436..0000000000 --- a/assets/js/80b4c599.261e4d2d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[131],{7825:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.js,","source":"@site/versioned_docs/version-12.0/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/12.0/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/getting-started/test-environment.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/12.0/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/12.0/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,l={},d=[{value:"Configure test environment",id:"configure-test-environment",level:3}];function c(e){const t={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.js",children:(0,r.jsx)(t.code,{children:"setup-jest.js"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/angular/angular/tree/main/packages/zone.js",children:"Angular zone patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]}),"\n",(0,r.jsxs)(t.p,{children:["While ",(0,r.jsx)(t.code,{children:"setup-jest.js"})," above is for running Jest with ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode, we also provide ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.mjs",children:(0,r.jsx)(t.code,{children:"setup-jest.mjs"})}),"\nto run with ",(0,r.jsx)(t.strong,{children:"ESM"})," mode."]}),"\n",(0,r.jsx)(t.h3,{id:"configure-test-environment",children:"Configure test environment"}),"\n",(0,r.jsxs)(t.p,{children:["When creating Angular test environment with ",(0,r.jsx)(t.code,{children:"TestBed"}),", it is possible to specify the ",(0,r.jsx)(t.code,{children:"testEnvironmentOptions"})," via ",(0,r.jsx)(t.code,{children:"globalThis"})," in the Jest setup file.\nFor example:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-test.ts\nglobalThis.ngJest = {\n testEnvironmentOptions: {\n teardown: {\n destroyAfterEach: false,\n rethrowErrors: true,\n },\n errorOnUnknownElements: true,\n errorOnUnknownProperties: true,\n },\n};\n\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," will look at ",(0,r.jsx)(t.code,{children:"globalThis.ngJest"})," and pass the correct ",(0,r.jsx)(t.a,{href:"https://angular.io/api/core/testing/TestEnvironmentOptions",children:(0,r.jsx)(t.code,{children:"TestEnvironmentOptions"})})," object to ",(0,r.jsx)(t.code,{children:"TestBed"}),"."]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/80b4c599.9b906aa6.js b/assets/js/80b4c599.9b906aa6.js new file mode 100644 index 0000000000..f2051e0c5c --- /dev/null +++ b/assets/js/80b4c599.9b906aa6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[131],{7087:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.js,","source":"@site/versioned_docs/version-12.0/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/12.0/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/getting-started/test-environment.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/12.0/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/12.0/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,l={},d=[{value:"Configure test environment",id:"configure-test-environment",level:3}];function c(e){const t={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.js",children:(0,r.jsx)(t.code,{children:"setup-jest.js"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/angular/angular/tree/main/packages/zone.js",children:"Angular zone patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]}),"\n",(0,r.jsxs)(t.p,{children:["While ",(0,r.jsx)(t.code,{children:"setup-jest.js"})," above is for running Jest with ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode, we also provide ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.mjs",children:(0,r.jsx)(t.code,{children:"setup-jest.mjs"})}),"\nto run with ",(0,r.jsx)(t.strong,{children:"ESM"})," mode."]}),"\n",(0,r.jsx)(t.h3,{id:"configure-test-environment",children:"Configure test environment"}),"\n",(0,r.jsxs)(t.p,{children:["When creating Angular test environment with ",(0,r.jsx)(t.code,{children:"TestBed"}),", it is possible to specify the ",(0,r.jsx)(t.code,{children:"testEnvironmentOptions"})," via ",(0,r.jsx)(t.code,{children:"globalThis"})," in the Jest setup file.\nFor example:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-test.ts\nglobalThis.ngJest = {\n testEnvironmentOptions: {\n teardown: {\n destroyAfterEach: false,\n rethrowErrors: true,\n },\n errorOnUnknownElements: true,\n errorOnUnknownProperties: true,\n },\n};\n\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," will look at ",(0,r.jsx)(t.code,{children:"globalThis.ngJest"})," and pass the correct ",(0,r.jsx)(t.a,{href:"https://angular.io/api/core/testing/TestEnvironmentOptions",children:(0,r.jsx)(t.code,{children:"TestEnvironmentOptions"})})," object to ",(0,r.jsx)(t.code,{children:"TestBed"}),"."]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8158.900dc11d.js b/assets/js/8158.900dc11d.js new file mode 100644 index 0000000000..afc8d7aa12 --- /dev/null +++ b/assets/js/8158.900dc11d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8158],{8158:(e,s,a)=>{a.r(s),a.d(s,{DocSearchModal:()=>c.a1});var c=a(3219)}}]); \ No newline at end of file diff --git a/assets/js/85e14910.87c74441.js b/assets/js/85e14910.87c74441.js deleted file mode 100644 index 3e374d6fd3..0000000000 --- a/assets/js/85e14910.87c74441.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3170],{7744:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-14.0/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/14.0/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/getting-started/installation.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.0/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.0/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/85e14910.b3004c42.js b/assets/js/85e14910.b3004c42.js new file mode 100644 index 0000000000..8e74951ab6 --- /dev/null +++ b/assets/js/85e14910.b3004c42.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3170],{8779:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-14.0/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/14.0/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/getting-started/installation.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.0/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.0/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8665e647.4422a4a5.js b/assets/js/8665e647.4422a4a5.js new file mode 100644 index 0000000000..0d1d2dfab8 --- /dev/null +++ b/assets/js/8665e647.4422a4a5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5700],{3852:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-11.1/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/11.1/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/getting-started/installation.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/11.1/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/11.1/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8665e647.d63ea67b.js b/assets/js/8665e647.d63ea67b.js deleted file mode 100644 index ccdf34e9af..0000000000 --- a/assets/js/8665e647.d63ea67b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5700],{303:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-11.1/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/11.1/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/getting-started/installation.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/11.1/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/11.1/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(o.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(o.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsxs)(t.p,{children:["In your project root, create ",(0,r.jsx)(t.code,{children:"setup-jest.ts"})," file with following contents:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(t.p,{children:"Add the following section:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "extends": "./tsconfig.json",\n "compilerOptions": {\n "outDir": "./out-tsc/spec",\n "module": "CommonJs",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n}\n'})}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",children:'{\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// Assuming that your global setup file is setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function j(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[j,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??j;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{f&&i(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=j(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,g.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6368.21689f03.js b/assets/js/8737.2a18c482.js similarity index 52% rename from assets/js/6368.21689f03.js rename to assets/js/8737.2a18c482.js index 3f35a56993..30ab18efe3 100644 --- a/assets/js/6368.21689f03.js +++ b/assets/js/8737.2a18c482.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6368],{1574:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var r=t(1507);const a={tableOfContentsInline:"tableOfContentsInline_prmo"};var l=t(4848);function o(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:o}=e;return(0,l.jsx)("div",{className:a.tableOfContentsInline,children:(0,l.jsx)(r.A,{toc:n,minHeadingLevel:t,maxHeadingLevel:o,className:"table-of-contents",linkClassName:null})})}},1507:(e,n,t)=>{t.d(n,{A:()=>h});var r=t(6540),a=t(6957);function l(e){const n=e.map((e=>({...e,parentIndex:-1,children:[]}))),t=Array(7).fill(-1);n.forEach(((e,n)=>{const r=t.slice(2,e.level);e.parentIndex=Math.max(...r),t[e.level]=n}));const r=[];return n.forEach((e=>{const{parentIndex:t,...a}=e;t>=0?n[t].children.push(a):r.push(a)})),r}function o(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:r}=e;return n.flatMap((e=>{const n=o({toc:e.children,minHeadingLevel:t,maxHeadingLevel:r});return function(e){return e.level>=t&&e.level<=r}(e)?[{...e,children:n}]:n}))}function s(e){const n=e.getBoundingClientRect();return n.top===n.bottom?s(e.parentNode):n}function i(e,n){let{anchorTopOffset:t}=n;const r=e.find((e=>s(e).top>=t));if(r){return function(e){return e.top>0&&e.bottom<window.innerHeight/2}(s(r))?r:e[e.indexOf(r)-1]??null}return e[e.length-1]??null}function u(){const e=(0,r.useRef)(0),{navbar:{hideOnScroll:n}}=(0,a.p)();return(0,r.useEffect)((()=>{e.current=n?0:document.querySelector(".navbar").clientHeight}),[n]),e}function c(e){const n=(0,r.useRef)(void 0),t=u();(0,r.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:r,linkActiveClassName:a,minHeadingLevel:l,maxHeadingLevel:o}=e;function s(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(r),s=function(e){let{minHeadingLevel:n,maxHeadingLevel:t}=e;const r=[];for(let a=n;a<=t;a+=1)r.push(`h${a}.anchor`);return Array.from(document.querySelectorAll(r.join()))}({minHeadingLevel:l,maxHeadingLevel:o}),u=i(s,{anchorTopOffset:t.current}),c=e.find((e=>u&&u.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,t){t?(n.current&&n.current!==e&&n.current.classList.remove(a),e.classList.add(a),n.current=e):e.classList.remove(a)}(e,e===c)}))}return document.addEventListener("scroll",s),document.addEventListener("resize",s),s(),()=>{document.removeEventListener("scroll",s),document.removeEventListener("resize",s)}}),[e,t])}var d=t(4783),m=t(4848);function f(e){let{toc:n,className:t,linkClassName:r,isChild:a}=e;return n.length?(0,m.jsx)("ul",{className:a?void 0:t,children:n.map((e=>(0,m.jsxs)("li",{children:[(0,m.jsx)(d.A,{to:`#${e.id}`,className:r??void 0,dangerouslySetInnerHTML:{__html:e.value}}),(0,m.jsx)(f,{isChild:!0,toc:e.children,className:t,linkClassName:r})]},e.id)))}):null}const v=r.memo(f);function h(e){let{toc:n,className:t="table-of-contents table-of-contents__left-border",linkClassName:s="table-of-contents__link",linkActiveClassName:i,minHeadingLevel:u,maxHeadingLevel:d,...f}=e;const h=(0,a.p)(),b=u??h.tableOfContents.minHeadingLevel,p=d??h.tableOfContents.maxHeadingLevel,g=function(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:a}=e;return(0,r.useMemo)((()=>o({toc:l(n),minHeadingLevel:t,maxHeadingLevel:a})),[n,t,a])}({toc:n,minHeadingLevel:b,maxHeadingLevel:p});return c((0,r.useMemo)((()=>{if(s&&i)return{linkClassName:s,linkActiveClassName:i,minHeadingLevel:b,maxHeadingLevel:p}}),[s,i,b,p])),(0,m.jsx)(v,{toc:g,className:t,linkClassName:s,...f})}},7227:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var r=t(4164);const a={tabItem:"tabItem_Ymn6"};var l=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,r.A)(a.tabItem,o),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>C});var r=t(6540),a=t(4164),l=t(4245),o=t(6347),s=t(6494),i=t(2814),u=t(5167),c=t(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function m(e){const{values:n,children:t}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}(t);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function f(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function v(e){let{queryString:n=!1,groupId:t}=e;const a=(0,o.W6)(),l=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i.aZ)(l),(0,r.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(a.location.search);n.set(l,e),a.replace({...a.location,search:n.toString()})}),[l,a])]}function h(e){const{defaultValue:n,queryString:t=!1,groupId:a}=e,l=m(e),[o,i]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!f({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:l}))),[u,d]=v({queryString:t,groupId:a}),[h,b]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[a,l]=(0,c.Dv)(t);return[a,(0,r.useCallback)((e=>{t&&l.set(e)}),[t,l])]}({groupId:a}),p=(()=>{const e=u??h;return f({value:e,tabValues:l})?e:null})();(0,s.A)((()=>{p&&i(p)}),[p]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!f({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),b(e)}),[d,b,l]),tabValues:l}}var b=t(1062);const p={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var g=t(4848);function x(e){let{className:n,block:t,selectedValue:r,selectValue:o,tabValues:s}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,l.a_)(),c=e=>{const n=e.currentTarget,t=i.indexOf(n),a=s[t].value;a!==r&&(u(n),o(a))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=i.indexOf(e.currentTarget)+1;n=i[t]??i[0];break}case"ArrowLeft":{const t=i.indexOf(e.currentTarget)-1;n=i[t]??i[i.length-1];break}}n?.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,a.A)("tabs",{"tabs--block":t},n),children:s.map((e=>{let{value:n,label:t,attributes:l}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>i.push(e),onKeyDown:d,onClick:c,...l,className:(0,a.A)("tabs__item",p.tabItem,l?.className,{"tabs__item--active":r===n}),children:t??n},n)}))})}function L(e){let{lazy:n,children:t,selectedValue:l}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===l));return e?(0,r.cloneElement)(e,{className:(0,a.A)("margin-top--md",e.props.className)}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==l})))})}function y(e){const n=h(e);return(0,g.jsxs)("div",{className:(0,a.A)("tabs-container",p.tabList),children:[(0,g.jsx)(x,{...n,...e}),(0,g.jsx)(L,{...n,...e})]})}function C(e){const n=(0,b.A)();return(0,g.jsx)(y,{...e,children:d(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>s});var r=t(6540);const a={},l=r.createContext(a);function o(e){const n=r.useContext(l);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),r.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8737],{4252:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var r=t(5195);const a={tableOfContentsInline:"tableOfContentsInline_prmo"};var l=t(4848);function o(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:o}=e;return(0,l.jsx)("div",{className:a.tableOfContentsInline,children:(0,l.jsx)(r.A,{toc:n,minHeadingLevel:t,maxHeadingLevel:o,className:"table-of-contents",linkClassName:null})})}},5195:(e,n,t)=>{t.d(n,{A:()=>h});var r=t(6540),a=t(6342);function l(e){const n=e.map((e=>({...e,parentIndex:-1,children:[]}))),t=Array(7).fill(-1);n.forEach(((e,n)=>{const r=t.slice(2,e.level);e.parentIndex=Math.max(...r),t[e.level]=n}));const r=[];return n.forEach((e=>{const{parentIndex:t,...a}=e;t>=0?n[t].children.push(a):r.push(a)})),r}function o(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:r}=e;return n.flatMap((e=>{const n=o({toc:e.children,minHeadingLevel:t,maxHeadingLevel:r});return function(e){return e.level>=t&&e.level<=r}(e)?[{...e,children:n}]:n}))}function s(e){const n=e.getBoundingClientRect();return n.top===n.bottom?s(e.parentNode):n}function i(e,n){let{anchorTopOffset:t}=n;const r=e.find((e=>s(e).top>=t));if(r){return function(e){return e.top>0&&e.bottom<window.innerHeight/2}(s(r))?r:e[e.indexOf(r)-1]??null}return e[e.length-1]??null}function u(){const e=(0,r.useRef)(0),{navbar:{hideOnScroll:n}}=(0,a.p)();return(0,r.useEffect)((()=>{e.current=n?0:document.querySelector(".navbar").clientHeight}),[n]),e}function c(e){const n=(0,r.useRef)(void 0),t=u();(0,r.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:r,linkActiveClassName:a,minHeadingLevel:l,maxHeadingLevel:o}=e;function s(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(r),s=function(e){let{minHeadingLevel:n,maxHeadingLevel:t}=e;const r=[];for(let a=n;a<=t;a+=1)r.push(`h${a}.anchor`);return Array.from(document.querySelectorAll(r.join()))}({minHeadingLevel:l,maxHeadingLevel:o}),u=i(s,{anchorTopOffset:t.current}),c=e.find((e=>u&&u.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,t){t?(n.current&&n.current!==e&&n.current.classList.remove(a),e.classList.add(a),n.current=e):e.classList.remove(a)}(e,e===c)}))}return document.addEventListener("scroll",s),document.addEventListener("resize",s),s(),()=>{document.removeEventListener("scroll",s),document.removeEventListener("resize",s)}}),[e,t])}var d=t(8774),m=t(4848);function f(e){let{toc:n,className:t,linkClassName:r,isChild:a}=e;return n.length?(0,m.jsx)("ul",{className:a?void 0:t,children:n.map((e=>(0,m.jsxs)("li",{children:[(0,m.jsx)(d.A,{to:`#${e.id}`,className:r??void 0,dangerouslySetInnerHTML:{__html:e.value}}),(0,m.jsx)(f,{isChild:!0,toc:e.children,className:t,linkClassName:r})]},e.id)))}):null}const v=r.memo(f);function h(e){let{toc:n,className:t="table-of-contents table-of-contents__left-border",linkClassName:s="table-of-contents__link",linkActiveClassName:i,minHeadingLevel:u,maxHeadingLevel:d,...f}=e;const h=(0,a.p)(),b=u??h.tableOfContents.minHeadingLevel,p=d??h.tableOfContents.maxHeadingLevel,g=function(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:a}=e;return(0,r.useMemo)((()=>o({toc:l(n),minHeadingLevel:t,maxHeadingLevel:a})),[n,t,a])}({toc:n,minHeadingLevel:b,maxHeadingLevel:p});return c((0,r.useMemo)((()=>{if(s&&i)return{linkClassName:s,linkActiveClassName:i,minHeadingLevel:b,maxHeadingLevel:p}}),[s,i,b,p])),(0,m.jsx)(v,{toc:g,className:t,linkClassName:s,...f})}},9365:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var r=t(4164);const a={tabItem:"tabItem_Ymn6"};var l=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,r.A)(a.tabItem,o),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>C});var r=t(6540),a=t(4164),l=t(3104),o=t(6347),s=t(205),i=t(7485),u=t(1682),c=t(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function m(e){const{values:n,children:t}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}(t);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function f(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function v(e){let{queryString:n=!1,groupId:t}=e;const a=(0,o.W6)(),l=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i.aZ)(l),(0,r.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(a.location.search);n.set(l,e),a.replace({...a.location,search:n.toString()})}),[l,a])]}function h(e){const{defaultValue:n,queryString:t=!1,groupId:a}=e,l=m(e),[o,i]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!f({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:l}))),[u,d]=v({queryString:t,groupId:a}),[h,b]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[a,l]=(0,c.Dv)(t);return[a,(0,r.useCallback)((e=>{t&&l.set(e)}),[t,l])]}({groupId:a}),p=(()=>{const e=u??h;return f({value:e,tabValues:l})?e:null})();(0,s.A)((()=>{p&&i(p)}),[p]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!f({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),b(e)}),[d,b,l]),tabValues:l}}var b=t(2303);const p={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var g=t(4848);function x(e){let{className:n,block:t,selectedValue:r,selectValue:o,tabValues:s}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,l.a_)(),c=e=>{const n=e.currentTarget,t=i.indexOf(n),a=s[t].value;a!==r&&(u(n),o(a))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const t=i.indexOf(e.currentTarget)+1;n=i[t]??i[0];break}case"ArrowLeft":{const t=i.indexOf(e.currentTarget)-1;n=i[t]??i[i.length-1];break}}n?.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,a.A)("tabs",{"tabs--block":t},n),children:s.map((e=>{let{value:n,label:t,attributes:l}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...l,className:(0,a.A)("tabs__item",p.tabItem,l?.className,{"tabs__item--active":r===n}),children:t??n},n)}))})}function L(e){let{lazy:n,children:t,selectedValue:l}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===l));return e?(0,r.cloneElement)(e,{className:(0,a.A)("margin-top--md",e.props.className)}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==l})))})}function y(e){const n=h(e);return(0,g.jsxs)("div",{className:(0,a.A)("tabs-container",p.tabList),children:[(0,g.jsx)(x,{...n,...e}),(0,g.jsx)(L,{...n,...e})]})}function C(e){const n=(0,b.A)();return(0,g.jsx)(y,{...e,children:d(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>s});var r=t(6540);const a={},l=r.createContext(a);function o(e){const n=r.useContext(l);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),r.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8afa1348.21501e6a.js b/assets/js/8afa1348.21501e6a.js new file mode 100644 index 0000000000..51079da69b --- /dev/null +++ b/assets/js/8afa1348.21501e6a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2341],{747:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-10.x/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/10.x/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/processing.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/10.x/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/10.x/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8afa1348.be179ee9.js b/assets/js/8afa1348.be179ee9.js deleted file mode 100644 index 37363268c8..0000000000 --- a/assets/js/8afa1348.be179ee9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2341],{3027:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-10.x/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/10.x/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/processing.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/10.x/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/10.x/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8b263414.5e9b72ee.js b/assets/js/8b263414.5e9b72ee.js deleted file mode 100644 index e00a04494f..0000000000 --- a/assets/js/8b263414.5e9b72ee.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[347],{4142:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-11.0/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/11.0/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/angular-ivy.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/11.0/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/11.0/guides/angular-13+"}}');var r=n(4848),i=n(8453);const a={id:"angular-ivy",title:"Angular Ivy"},o=void 0,l={},c=[];function u(e){const t={code:"code",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["Starting from ",(0,r.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,r.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,r.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," also provides util script to help you to run ",(0,r.jsx)(t.code,{children:"ngcc"})," with Jest but this script only works via the\nJavaScript version of Jest config"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nrequire('jest-preset-angular/ngcc-jest-processor');\n\nmodule.exports = {\n // [...]\n};\n"})})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>o});var s=n(6540);const r={},i=s.createContext(r);function a(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8b263414.fd8c1ed5.js b/assets/js/8b263414.fd8c1ed5.js new file mode 100644 index 0000000000..732c6ce3c4 --- /dev/null +++ b/assets/js/8b263414.fd8c1ed5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[347],{6102:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-11.0/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/11.0/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/angular-ivy.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/11.0/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/11.0/guides/angular-13+"}}');var r=n(4848),i=n(8453);const a={id:"angular-ivy",title:"Angular Ivy"},o=void 0,l={},c=[];function u(e){const t={code:"code",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["Starting from ",(0,r.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,r.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,r.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," also provides util script to help you to run ",(0,r.jsx)(t.code,{children:"ngcc"})," with Jest but this script only works via the\nJavaScript version of Jest config"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nrequire('jest-preset-angular/ngcc-jest-processor');\n\nmodule.exports = {\n // [...]\n};\n"})})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>o});var s=n(6540);const r={},i=s.createContext(r);function a(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8f3baa16.1830da85.js b/assets/js/8f3baa16.1830da85.js new file mode 100644 index 0000000000..8d1368cf52 --- /dev/null +++ b/assets/js/8f3baa16.1830da85.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[217],{182:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-14.3/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/14.3/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/getting-started/options.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.3/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.3/getting-started/test-environment"}}');var r=n(4848),o=n(8453),i=n(1470),a=n(9365);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function p(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(t.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(t.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(t.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(t.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(t.p,{children:["More information about ",(0,r.jsx)(t.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(t.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]})}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),"\n",(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(t.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(t.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(t.code,{children:"esbuild"})," in ",(0,r.jsx)(t.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(t.code,{children:"esbuild"}),", one can do the following:"]}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n snapshotSerializers: [\n 'jest-preset-angular/build/serializers/html-comment',\n 'jest-preset-angular/build/serializers/ng-snapshot',\n 'jest-preset-angular/build/serializers/no-ng-attributes',\n ],\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Jest runs with ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(t.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(t.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["We're using ",(0,r.jsx)(t.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(t.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(t.code,{children:"ts"}),"), HTML (",(0,r.jsx)(t.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(t.code,{children:"js"}),"), JSON (",(0,r.jsx)(t.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(t.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(t.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. See more in ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/14.3/guides/snapshot-testing",children:"Snapshot testing"})]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(t.code,{children:".mjs"})," files which come from ",(0,r.jsx)(t.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(t.code,{children:"TS"}),", ",(0,r.jsx)(t.code,{children:"JS"}),", ",(0,r.jsx)(t.code,{children:"MJS"}),", ",(0,r.jsx)(t.code,{children:"HTML"}),", or ",(0,r.jsx)(t.code,{children:"SVG"})," file through so called ",(0,r.jsx)(t.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var o=n(4848);function i(e){let{children:t,hidden:n,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),o=n(3104),i=n(6347),a=n(205),l=n(7485),c=n(1682),d=n(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return u(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,i.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(r.location.search);t.set(o,e),r.replace({...r.location,search:t.toString()})}),[o,r])]}function m(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,o=p(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:o}))),[c,u]=f({queryString:n,groupId:r}),[m,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,o]=(0,d.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:r}),j=(()=>{const e=c??m;return h({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{j&&l(j)}),[j]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),g(e)}),[u,g,o]),tabValues:o}}var g=n(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=n(4848);function b(e){let{className:t,block:n,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const t=e.currentTarget,n=l.indexOf(t),r=a[n].value;r!==s&&(c(t),i(r))},u=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:a.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",j.tabItem,o?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:o}=e;const i=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const r={},o=s.createContext(r);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8f3baa16.eedf606f.js b/assets/js/8f3baa16.eedf606f.js deleted file mode 100644 index 7870f40d5c..0000000000 --- a/assets/js/8f3baa16.eedf606f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[217],{3108:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-14.3/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/14.3/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/getting-started/options.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.3/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.3/getting-started/test-environment"}}');var r=n(4848),o=n(8453),i=n(9489),a=n(7227);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function p(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(t.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(t.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(t.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(t.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(t.p,{children:["More information about ",(0,r.jsx)(t.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(t.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]})}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),"\n",(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(t.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(t.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(t.code,{children:"esbuild"})," in ",(0,r.jsx)(t.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(t.code,{children:"esbuild"}),", one can do the following:"]}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n snapshotSerializers: [\n 'jest-preset-angular/build/serializers/html-comment',\n 'jest-preset-angular/build/serializers/ng-snapshot',\n 'jest-preset-angular/build/serializers/no-ng-attributes',\n ],\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Jest runs with ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(t.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(t.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["We're using ",(0,r.jsx)(t.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(t.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(t.code,{children:"ts"}),"), HTML (",(0,r.jsx)(t.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(t.code,{children:"js"}),"), JSON (",(0,r.jsx)(t.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(t.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(t.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. See more in ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/14.3/guides/snapshot-testing",children:"Snapshot testing"})]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(t.code,{children:".mjs"})," files which come from ",(0,r.jsx)(t.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(t.code,{children:"TS"}),", ",(0,r.jsx)(t.code,{children:"JS"}),", ",(0,r.jsx)(t.code,{children:"MJS"}),", ",(0,r.jsx)(t.code,{children:"HTML"}),", or ",(0,r.jsx)(t.code,{children:"SVG"})," file through so called ",(0,r.jsx)(t.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var o=n(4848);function i(e){let{children:t,hidden:n,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),o=n(4245),i=n(6347),a=n(6494),l=n(2814),c=n(5167),d=n(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return u(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,i.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(r.location.search);t.set(o,e),r.replace({...r.location,search:t.toString()})}),[o,r])]}function m(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,o=p(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:o}))),[c,u]=f({queryString:n,groupId:r}),[m,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,o]=(0,d.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:r}),j=(()=>{const e=c??m;return h({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{j&&l(j)}),[j]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),g(e)}),[u,g,o]),tabValues:o}}var g=n(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=n(4848);function b(e){let{className:t,block:n,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const t=e.currentTarget,n=l.indexOf(t),r=a[n].value;r!==s&&(c(t),i(r))},u=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:a.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>l.push(e),onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",j.tabItem,o?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:o}=e;const i=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const r={},o=s.createContext(r);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/915eea02.36cf32b2.js b/assets/js/915eea02.36cf32b2.js new file mode 100644 index 0000000000..c263de9333 --- /dev/null +++ b/assets/js/915eea02.36cf32b2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1263],{3367:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-14.4/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/introduction.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/915eea02.bb6bc5ce.js b/assets/js/915eea02.bb6bc5ce.js deleted file mode 100644 index 05279ffeb3..0000000000 --- a/assets/js/915eea02.bb6bc5ce.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1263],{2958:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-14.4/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/introduction.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9251a350.0b393dc5.js b/assets/js/9251a350.0b393dc5.js new file mode 100644 index 0000000000..51e9f05691 --- /dev/null +++ b/assets/js/9251a350.0b393dc5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5075],{798:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-11.0/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/11.0/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/esm-support.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/11.0/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/11.0/guides/jsdom-version"}}');var o=t(4848),r=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:["To use ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,o.jsx)(s.code,{children:"ts-jest"})," config option ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:["There is also a ",(0,o.jsx)(s.a,{href:"/jest-preset-angular/docs/11.0/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,o.jsx)(s.admonition,{type:"tip",children:(0,o.jsxs)(s.p,{children:["We have ",(0,o.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,o.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,o.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})}),"\n",(0,o.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,o.jsxs)(s.admonition,{type:"tip",children:[(0,o.jsxs)(s.p,{children:["Jest will attempt to load ",(0,o.jsx)(s.strong,{children:"ESM"})," files from ",(0,o.jsx)(s.code,{children:"node_modules"})," with default ",(0,o.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,o.jsx)(s.strong,{children:"ESM"})," built files or ",(0,o.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,o.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,o.jsxs)(s.p,{children:["To fix that, one can use ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,o.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const o={},r=n.createContext(o);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9251a350.db2cbcb1.js b/assets/js/9251a350.db2cbcb1.js deleted file mode 100644 index 5c618146ff..0000000000 --- a/assets/js/9251a350.db2cbcb1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5075],{3566:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-11.0/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/11.0/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/esm-support.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/11.0/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/11.0/guides/jsdom-version"}}');var o=t(4848),r=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:["To use ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,o.jsx)(s.code,{children:"ts-jest"})," config option ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:["There is also a ",(0,o.jsx)(s.a,{href:"/jest-preset-angular/docs/11.0/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,o.jsx)(s.admonition,{type:"tip",children:(0,o.jsxs)(s.p,{children:["We have ",(0,o.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,o.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,o.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})}),"\n",(0,o.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,o.jsxs)(s.admonition,{type:"tip",children:[(0,o.jsxs)(s.p,{children:["Jest will attempt to load ",(0,o.jsx)(s.strong,{children:"ESM"})," files from ",(0,o.jsx)(s.code,{children:"node_modules"})," with default ",(0,o.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,o.jsx)(s.strong,{children:"ESM"})," built files or ",(0,o.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,o.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,o.jsxs)(s.p,{children:["To fix that, one can use ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,o.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const o={},r=n.createContext(o);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/93f0793d.11aaa541.js b/assets/js/93f0793d.11aaa541.js deleted file mode 100644 index a999be554d..0000000000 --- a/assets/js/93f0793d.11aaa541.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1352],{9518:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-9.x/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/9.x/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/using-with-babel.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/9.x/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/9.x/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const l={id:"using-with-babel",title:"Using with Babel"},r=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>l,x:()=>r});var t=n(6540);const i={},o=t.createContext(i);function l(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function r(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/93f0793d.e7cdef71.js b/assets/js/93f0793d.e7cdef71.js new file mode 100644 index 0000000000..1d3988937d --- /dev/null +++ b/assets/js/93f0793d.e7cdef71.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1352],{9928:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-9.x/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/9.x/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/using-with-babel.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/9.x/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/9.x/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const r={id:"using-with-babel",title:"Using with Babel"},l=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>r,x:()=>l});var t=n(6540);const i={},o=t.createContext(i);function r(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function l(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9462.284a2c7b.js b/assets/js/9462.284a2c7b.js deleted file mode 100644 index 4c2986d63e..0000000000 --- a/assets/js/9462.284a2c7b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9462],{9462:(e,t,r)=>{function n(e,t){var r=void 0;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];r&&clearTimeout(r),r=setTimeout((function(){return e.apply(void 0,o)}),t)}}function o(e){return e!==Object(e)}function i(e,t){if(e===t)return!0;if(o(e)||o(t)||"function"==typeof e||"function"==typeof t)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r=0,n=Object.keys(e);r<n.length;r++){var a=n[r];if(!(a in t))return!1;if(!i(e[a],t[a]))return!1}return!0}r.r(t),r.d(t,{DocSearchModal:()=>pn});var a=function(){};function c(e){var t=e.item,r=e.items;return{index:t.__autocomplete_indexName,items:[t],positions:[1+r.findIndex((function(e){return e.objectID===t.objectID}))],queryID:t.__autocomplete_queryID,algoliaSource:["autocomplete"]}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);l=!0);}catch(s){u=!0,o=s}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var s=["items"],f=["items"];function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function p(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return v(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){b(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function b(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==m(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==m(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===m(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){return e.map((function(e){var t=e.items,r=d(e,s);return h(h({},r),{},{objectIDs:(null==t?void 0:t.map((function(e){return e.objectID})))||r.objectIDs})}))}function O(e){var t,r,n,o=(t=l((e.version||"").split(".").map(Number),2),r=t[0],n=t[1],r>=3||2===r&&n>=4||1===r&&n>=10);function i(t,r,n){if(o&&void 0!==n){var i=n[0].__autocomplete_algoliaCredentials,a={"X-Algolia-Application-Id":i.appId,"X-Algolia-API-Key":i.apiKey};e.apply(void 0,[t].concat(p(r),[{headers:a}]))}else e.apply(void 0,[t].concat(p(r)))}return{init:function(t,r){e("init",{appId:t,apiKey:r})},setUserToken:function(t){e("setUserToken",t)},clickedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&i("clickedObjectIDsAfterSearch",g(t),t[0].items)},clickedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&i("clickedObjectIDs",g(t),t[0].items)},clickedFilters:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.length>0&&e.apply(void 0,["clickedFilters"].concat(r))},convertedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&i("convertedObjectIDsAfterSearch",g(t),t[0].items)},convertedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&i("convertedObjectIDs",g(t),t[0].items)},convertedFilters:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.length>0&&e.apply(void 0,["convertedFilters"].concat(r))},viewedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&t.reduce((function(e,t){var r=t.items,n=d(t,f);return[].concat(p(e),p(function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,r=[],n=0;n<e.objectIDs.length;n+=t)r.push(h(h({},e),{},{objectIDs:e.objectIDs.slice(n,n+t)}));return r}(h(h({},n),{},{objectIDs:(null==r?void 0:r.map((function(e){return e.objectID})))||n.objectIDs})).map((function(e){return{items:r,payload:e}}))))}),[]).forEach((function(e){var t=e.items;return i("viewedObjectIDs",[e.payload],t)}))},viewedFilters:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.length>0&&e.apply(void 0,["viewedFilters"].concat(r))}}}function S(e){var t=e.items.reduce((function(e,t){var r;return e[t.__autocomplete_indexName]=(null!==(r=e[t.__autocomplete_indexName])&&void 0!==r?r:[]).concat(t),e}),{});return Object.keys(t).map((function(e){return{index:e,items:t[e],algoliaSource:["autocomplete"]}}))}function j(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function E(e){return function(e){if(Array.isArray(e))return P(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function I(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?I(Object(r),!0).forEach((function(t){A(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function A(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==w(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==w(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===w(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var k="2.6.0",x="https://cdn.jsdelivr.net/npm/search-insights@".concat(k,"/dist/search-insights.min.js"),C=n((function(e){var t=e.onItemsChange,r=e.items,n=e.insights,o=e.state;t({insights:n,insightsEvents:S({items:r}).map((function(e){return D({eventName:"Items Viewed"},e)})),state:o})}),400);function N(e){var t=function(e){return D({onItemsChange:function(e){var t=e.insights,r=e.insightsEvents;t.viewedObjectIDs.apply(t,E(r.map((function(e){return D(D({},e),{},{algoliaSource:[].concat(E(e.algoliaSource||[]),["autocomplete-internal"])})}))))},onSelect:function(e){var t=e.insights,r=e.insightsEvents;t.clickedObjectIDsAfterSearch.apply(t,E(r.map((function(e){return D(D({},e),{},{algoliaSource:[].concat(E(e.algoliaSource||[]),["autocomplete-internal"])})}))))},onActive:a},e)}(e),r=t.insightsClient,o=t.onItemsChange,l=t.onSelect,u=t.onActive,s=r;r||function(e){if("undefined"!=typeof window)e({window:window})}((function(e){var t=e.window,r=t.AlgoliaAnalyticsObject||"aa";"string"==typeof r&&(s=t[r]),s||(t.AlgoliaAnalyticsObject=r,t[r]||(t[r]=function(){t[r].queue||(t[r].queue=[]);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];t[r].queue.push(n)}),t[r].version=k,s=t[r],function(e){var t="[Autocomplete]: Could not load search-insights.js. Please load it manually following https://alg.li/insights-autocomplete";try{var r=e.document.createElement("script");r.async=!0,r.src=x,r.onerror=function(){console.error(t)},document.body.appendChild(r)}catch(n){console.error(t)}}(t))}));var f=O(s),m={current:[]},p=n((function(e){var t=e.state;if(t.isOpen){var r=t.collections.reduce((function(e,t){return[].concat(E(e),E(t.items))}),[]).filter(j);i(m.current.map((function(e){return e.objectID})),r.map((function(e){return e.objectID})))||(m.current=r,r.length>0&&C({onItemsChange:o,items:r,insights:f,state:t}))}}),0);return{name:"aa.algoliaInsightsPlugin",subscribe:function(e){var t=e.setContext,r=e.onSelect,n=e.onActive;s("addAlgoliaAgent","insights-plugin"),t({algoliaInsightsPlugin:{__algoliaSearchParameters:{clickAnalytics:!0},insights:f}}),r((function(e){var t=e.item,r=e.state,n=e.event;j(t)&&l({state:r,event:n,insights:f,item:t,insightsEvents:[D({eventName:"Item Selected"},c({item:t,items:m.current}))]})})),n((function(e){var t=e.item,r=e.state,n=e.event;j(t)&&u({state:r,event:n,insights:f,item:t,insightsEvents:[D({eventName:"Item Active"},c({item:t,items:m.current}))]})}))},onStateChange:function(e){var t=e.state;p({state:t})},__autocomplete_pluginOptions:e}}function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function q(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==_(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===_(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R(e,t,r){var n,o=t.initialState;return{getState:function(){return o},dispatch:function(n,i){var a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){q(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},o);o=e(o,{type:n,props:t,payload:i}),r({state:o,prevState:a})},pendingRequests:(n=[],{add:function(e){return n.push(e),e.finally((function(){n=n.filter((function(t){return t!==e}))}))},cancelAll:function(){n.forEach((function(e){return e.cancel()}))},isEmpty:function(){return 0===n.length}})}}function L(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function H(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach((function(t){U(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function U(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==M(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===M(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B(e){return 0===e.collections.length?0:e.collections.reduce((function(e,t){return e+t.items.length}),0)}var V=0;function K(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?K(Object(r),!0).forEach((function(t){J(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function J(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==z(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===z(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z(e){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(e)}function W(e){return W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W(e)}function Q(e){return function(e){if(Array.isArray(e))return Z(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Z(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function X(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(Object(r),!0).forEach((function(t){Y(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Y(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==W(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==W(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===W(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ee(e,t){var r,n="undefined"!=typeof window?window:{},o=e.plugins||[];return X(X({debug:!1,openOnFocus:!1,placeholder:"",autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,insights:!1,environment:n,shouldPanelOpen:function(e){return B(e.state)>0},reshape:function(e){return e.sources}},e),{},{id:null!==(r=e.id)&&void 0!==r?r:"autocomplete-".concat(V++),plugins:o,initialState:X({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var r;null===(r=e.onStateChange)||void 0===r||r.call(e,t),o.forEach((function(e){var r;return null===(r=e.onStateChange)||void 0===r?void 0:r.call(e,t)}))},onSubmit:function(t){var r;null===(r=e.onSubmit)||void 0===r||r.call(e,t),o.forEach((function(e){var r;return null===(r=e.onSubmit)||void 0===r?void 0:r.call(e,t)}))},onReset:function(t){var r;null===(r=e.onReset)||void 0===r||r.call(e,t),o.forEach((function(e){var r;return null===(r=e.onReset)||void 0===r?void 0:r.call(e,t)}))},getSources:function(r){return Promise.all([].concat(Q(o.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,t){var r=[];return Promise.resolve(e(t)).then((function(e){return Array.isArray(e),Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,r.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));r.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:a,onResolve:a};Object.keys(t).forEach((function(e){t[e].__default=!0}));var n=$($({},t),e);return Promise.resolve(n)})))}))}(e,r)}))).then((function(e){return L(e)})).then((function(e){return e.map((function(e){return X(X({},e),{},{onSelect:function(r){e.onSelect(r),t.forEach((function(e){var t;return null===(t=e.onSelect)||void 0===t?void 0:t.call(e,r)}))},onActive:function(r){e.onActive(r),t.forEach((function(e){var t;return null===(t=e.onActive)||void 0===t?void 0:t.call(e,r)}))},onResolve:function(r){e.onResolve(r),t.forEach((function(e){var t;return null===(t=e.onResolve)||void 0===t?void 0:t.call(e,r)}))}})}))}))},navigator:X({navigate:function(e){var t=e.itemUrl;n.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,r=n.open(t,"_blank","noopener");null==r||r.focus()},navigateNewWindow:function(e){var t=e.itemUrl;n.open(t,"_blank","noopener")}},e.navigator)})}function te(e){return te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},te(e)}function re(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?re(Object(r),!0).forEach((function(t){oe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):re(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function oe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==te(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==te(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===te(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ie(e){return ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ie(e)}function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(r),!0).forEach((function(t){le(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function le(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==ie(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ie(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ue(e){return function(e){if(Array.isArray(e))return se(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return se(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return se(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function fe(e){return Boolean(e.execute)}function me(e,t,r){if(o=e,Boolean(null==o?void 0:o.execute)){var n="algolia"===e.requesterId?Object.assign.apply(Object,[{}].concat(ue(Object.keys(r.context).map((function(e){var t;return null===(t=r.context[e])||void 0===t?void 0:t.__algoliaSearchParameters}))))):{};return ce(ce({},e),{},{requests:e.queries.map((function(r){return{query:"algolia"===e.requesterId?ce(ce({},r),{},{params:ce(ce({},n),r.params)}):r,sourceId:t,transformResponse:e.transformResponse}}))})}var o;return{items:e,sourceId:t}}function pe(e){var t=e.reduce((function(e,t){if(!fe(t))return e.push(t),e;var r=t.searchClient,n=t.execute,o=t.requesterId,i=t.requests,a=e.find((function(e){return fe(t)&&fe(e)&&e.searchClient===r&&Boolean(o)&&e.requesterId===o}));if(a){var c;(c=a.items).push.apply(c,ue(i))}else{var l={execute:n,requesterId:o,items:i,searchClient:r};e.push(l)}return e}),[]).map((function(e){if(!fe(e))return Promise.resolve(e);var t=e,r=t.execute,n=t.items;return r({searchClient:t.searchClient,requests:n})}));return Promise.all(t).then((function(e){return L(e)}))}function ve(e,t,r){return t.map((function(t){var n,o=e.filter((function(e){return e.sourceId===t.sourceId})),i=o.map((function(e){return e.items})),a=o[0].transformResponse,c=a?a({results:n=i,hits:n.map((function(e){return e.hits})).filter(Boolean),facetHits:n.map((function(e){var t;return null===(t=e.facetHits)||void 0===t?void 0:t.map((function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}}))})).filter(Boolean)}):i;return t.onResolve({source:t,results:i,items:c,state:r.getState()}),Array.isArray(c),c.every(Boolean),'The `getItems` function from source "'.concat(t.sourceId,'" must return an array of items but returned ').concat(JSON.stringify(void 0),".\n\nDid you forget to return items?\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems"),{source:t,items:c}}))}function de(e,t){var r=t;return{then:function(t,n){return de(e.then(be(t,r,e),be(n,r,e)),r)},catch:function(t){return de(e.catch(be(t,r,e)),r)},finally:function(t){return t&&r.onCancelList.push(t),de(e.finally(be(t&&function(){return r.onCancelList=[],t()},r,e)),r)},cancel:function(){r.isCanceled=!0;var e=r.onCancelList;r.onCancelList=[],e.forEach((function(e){e()}))},isCanceled:function(){return!0===r.isCanceled}}}function ye(e){return de(new Promise((function(t,r){return e(t,r)})),{isCanceled:!1,onCancelList:[]})}function he(e){return de(e,{isCanceled:!1,onCancelList:[]})}function be(e,t,r){return e?function(r){return t.isCanceled?r:e(r)}:r}function ge(e){var t=function(e){var t=e.collections.map((function(e){return e.items.length})).reduce((function(e,t,r){var n=(e[r-1]||0)+t;return e.push(n),e}),[]).reduce((function(t,r){return r<=e.activeItemId?t+1:t}),0);return e.collections[t]}(e);if(!t)return null;var r=t.items[function(e){for(var t=e.state,r=e.collection,n=!1,o=0,i=0;!1===n;){var a=t.collections[o];if(a===r){n=!0;break}i+=a.items.length,o++}return t.activeItemId-i}({state:e,collection:t})],n=t.source;return{item:r,itemInputValue:n.getItemInputValue({item:r,state:e}),itemUrl:n.getItemUrl({item:r,state:e}),source:n}}function Oe(e){return Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oe(e)}ye.resolve=function(e){return he(Promise.resolve(e))},ye.reject=function(e){return he(Promise.reject(e))};var Se=["event","nextState","props","query","refresh","store"];function je(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function we(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?je(Object(r),!0).forEach((function(t){Ee(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ee(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Oe(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Oe(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pe(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var Ie,De,Ae,ke=null,xe=(Ie=-1,De=-1,Ae=void 0,function(e){var t=++Ie;return Promise.resolve(e).then((function(e){return Ae&&t<De?Ae:(De=t,Ae=e,e)}))});function Ce(e){var t=e.event,r=e.nextState,n=void 0===r?{}:r,o=e.props,i=e.query,a=e.refresh,c=e.store,l=Pe(e,Se);ke&&o.environment.clearTimeout(ke);var u=l.setCollections,s=l.setIsOpen,f=l.setQuery,m=l.setActiveItemId,p=l.setStatus;if(f(i),m(o.defaultActiveItemId),!i&&!1===o.openOnFocus){var v,d=c.getState().collections.map((function(e){return we(we({},e),{},{items:[]})}));p("idle"),u(d),s(null!==(v=n.isOpen)&&void 0!==v?v:o.shouldPanelOpen({state:c.getState()}));var y=he(xe(d).then((function(){return Promise.resolve()})));return c.pendingRequests.add(y)}p("loading"),ke=o.environment.setTimeout((function(){p("stalled")}),o.stallThreshold);var h=he(xe(o.getSources(we({query:i,refresh:a,state:c.getState()},l)).then((function(e){return Promise.all(e.map((function(e){return Promise.resolve(e.getItems(we({query:i,refresh:a,state:c.getState()},l))).then((function(t){return me(t,e.sourceId,c.getState())}))}))).then(pe).then((function(t){return ve(t,e,c)})).then((function(e){return function(e){var t=e.collections,r=e.props,n=e.state,o=t.reduce((function(e,t){return ne(ne({},e),{},oe({},t.source.sourceId,ne(ne({},t.source),{},{getItems:function(){return L(t.items)}})))}),{}),i=r.plugins.reduce((function(e,t){return t.reshape?t.reshape(e):e}),{sourcesBySourceId:o,state:n}).sourcesBySourceId;return L(r.reshape({sourcesBySourceId:i,sources:Object.values(i),state:n})).filter(Boolean).map((function(e){return{source:e,items:e.getItems()}}))}({collections:e,props:o,state:c.getState()})}))})))).then((function(e){var r;p("idle"),u(e);var f=o.shouldPanelOpen({state:c.getState()});s(null!==(r=n.isOpen)&&void 0!==r?r:o.openOnFocus&&!i&&f||f);var m=ge(c.getState());if(null!==c.getState().activeItemId&&m){var v=m.item,d=m.itemInputValue,y=m.itemUrl,h=m.source;h.onActive(we({event:t,item:v,itemInputValue:d,itemUrl:y,refresh:a,source:h,state:c.getState()},l))}})).finally((function(){p("idle"),ke&&o.environment.clearTimeout(ke)}));return c.pendingRequests.add(h)}function Ne(e){return Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ne(e)}var _e=["event","props","refresh","store"];function Te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(r),!0).forEach((function(t){Re(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Re(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Ne(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ne(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Le(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var Me=/((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i;function He(e){return He="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},He(e)}var Fe=["props","refresh","store"],Ue=["inputElement","formElement","panelElement"],Be=["inputElement"],Ve=["inputElement","maxLength"],Ke=["sourceIndex"],$e=["sourceIndex"],Je=["item","source","sourceIndex"];function ze(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function We(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(r),!0).forEach((function(t){Qe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ze(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Qe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==He(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==He(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===He(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ze(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Ge(e){var t=e.props,r=e.refresh,n=e.store,o=Ze(e,Fe),i=function(e,t){return void 0!==t?"".concat(e,"-").concat(t):e};return{getEnvironmentProps:function(e){var r=e.inputElement,o=e.formElement,i=e.panelElement;function a(e){!n.getState().isOpen&&n.pendingRequests.isEmpty()||e.target===r||!1===[o,i].some((function(t){return r=t,n=e.target,r===n||r.contains(n);var r,n}))&&(n.dispatch("blur",null),t.debug||n.pendingRequests.cancelAll())}return We({onTouchStart:a,onMouseDown:a,onTouchMove:function(e){!1!==n.getState().isOpen&&r===t.environment.document.activeElement&&e.target!==r&&r.blur()}},Ze(e,Ue))},getRootProps:function(e){return We({role:"combobox","aria-expanded":n.getState().isOpen,"aria-haspopup":"listbox","aria-owns":n.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label")},e)},getFormProps:function(e){e.inputElement;return We({action:"",noValidate:!0,role:"search",onSubmit:function(i){var a;i.preventDefault(),t.onSubmit(We({event:i,refresh:r,state:n.getState()},o)),n.dispatch("submit",null),null===(a=e.inputElement)||void 0===a||a.blur()},onReset:function(i){var a;i.preventDefault(),t.onReset(We({event:i,refresh:r,state:n.getState()},o)),n.dispatch("reset",null),null===(a=e.inputElement)||void 0===a||a.focus()}},Ze(e,Be))},getLabelProps:function(e){var r=e||{},n=r.sourceIndex,o=Ze(r,Ke);return We({htmlFor:"".concat(i(t.id,n),"-input"),id:"".concat(i(t.id,n),"-label")},o)},getInputProps:function(e){var i;function c(e){(t.openOnFocus||Boolean(n.getState().query))&&Ce(We({event:e,props:t,query:n.getState().completion||n.getState().query,refresh:r,store:n},o)),n.dispatch("focus",null)}var l=e||{},u=(l.inputElement,l.maxLength),s=void 0===u?512:u,f=Ze(l,Ve),m=ge(n.getState()),p=function(e){return Boolean(e&&e.match(Me))}((null===(i=t.environment.navigator)||void 0===i?void 0:i.userAgent)||""),v=null!=m&&m.itemUrl&&!p?"go":"search";return We({"aria-autocomplete":"both","aria-activedescendant":n.getState().isOpen&&null!==n.getState().activeItemId?"".concat(t.id,"-item-").concat(n.getState().activeItemId):void 0,"aria-controls":n.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label"),value:n.getState().completion||n.getState().query,id:"".concat(t.id,"-input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:v,spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:s,type:"search",onChange:function(e){Ce(We({event:e,props:t,query:e.currentTarget.value.slice(0,s),refresh:r,store:n},o))},onKeyDown:function(e){!function(e){var t=e.event,r=e.props,n=e.refresh,o=e.store,i=Le(e,_e);if("ArrowUp"===t.key||"ArrowDown"===t.key){var a=function(){var e=r.environment.document.getElementById("".concat(r.id,"-item-").concat(o.getState().activeItemId));e&&(e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView(!1))},c=function(){var e=ge(o.getState());if(null!==o.getState().activeItemId&&e){var r=e.item,a=e.itemInputValue,c=e.itemUrl,l=e.source;l.onActive(qe({event:t,item:r,itemInputValue:a,itemUrl:c,refresh:n,source:l,state:o.getState()},i))}};t.preventDefault(),!1===o.getState().isOpen&&(r.openOnFocus||Boolean(o.getState().query))?Ce(qe({event:t,props:r,query:o.getState().query,refresh:n,store:o},i)).then((function(){o.dispatch(t.key,{nextActiveItemId:r.defaultActiveItemId}),c(),setTimeout(a,0)})):(o.dispatch(t.key,{}),c(),a())}else if("Escape"===t.key)t.preventDefault(),o.dispatch(t.key,null),o.pendingRequests.cancelAll();else if("Tab"===t.key)o.dispatch("blur",null),o.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===o.getState().activeItemId||o.getState().collections.every((function(e){return 0===e.items.length})))return void(r.debug||o.pendingRequests.cancelAll());t.preventDefault();var l=ge(o.getState()),u=l.item,s=l.itemInputValue,f=l.itemUrl,m=l.source;if(t.metaKey||t.ctrlKey)void 0!==f&&(m.onSelect(qe({event:t,item:u,itemInputValue:s,itemUrl:f,refresh:n,source:m,state:o.getState()},i)),r.navigator.navigateNewTab({itemUrl:f,item:u,state:o.getState()}));else if(t.shiftKey)void 0!==f&&(m.onSelect(qe({event:t,item:u,itemInputValue:s,itemUrl:f,refresh:n,source:m,state:o.getState()},i)),r.navigator.navigateNewWindow({itemUrl:f,item:u,state:o.getState()}));else if(t.altKey);else{if(void 0!==f)return m.onSelect(qe({event:t,item:u,itemInputValue:s,itemUrl:f,refresh:n,source:m,state:o.getState()},i)),void r.navigator.navigate({itemUrl:f,item:u,state:o.getState()});Ce(qe({event:t,nextState:{isOpen:!1},props:r,query:s,refresh:n,store:o},i)).then((function(){m.onSelect(qe({event:t,item:u,itemInputValue:s,itemUrl:f,refresh:n,source:m,state:o.getState()},i))}))}}}(We({event:e,props:t,refresh:r,store:n},o))},onFocus:c,onBlur:a,onClick:function(r){e.inputElement!==t.environment.document.activeElement||n.getState().isOpen||c(r)}},f)},getPanelProps:function(e){return We({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){n.dispatch("mouseleave",null)}},e)},getListProps:function(e){var r=e||{},n=r.sourceIndex,o=Ze(r,$e);return We({role:"listbox","aria-labelledby":"".concat(i(t.id,n),"-label"),id:"".concat(i(t.id,n),"-list")},o)},getItemProps:function(e){var a=e.item,c=e.source,l=e.sourceIndex,u=Ze(e,Je);return We({id:"".concat(i(t.id,l),"-item-").concat(a.__autocomplete_id),role:"option","aria-selected":n.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==n.getState().activeItemId){n.dispatch("mousemove",a.__autocomplete_id);var t=ge(n.getState());if(null!==n.getState().activeItemId&&t){var i=t.item,c=t.itemInputValue,l=t.itemUrl,u=t.source;u.onActive(We({event:e,item:i,itemInputValue:c,itemUrl:l,refresh:r,source:u,state:n.getState()},o))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var i=c.getItemInputValue({item:a,state:n.getState()}),l=c.getItemUrl({item:a,state:n.getState()});(l?Promise.resolve():Ce(We({event:e,nextState:{isOpen:!1},props:t,query:i,refresh:r,store:n},o))).then((function(){c.onSelect(We({event:e,item:a,itemInputValue:i,itemUrl:l,refresh:r,source:c,state:n.getState()},o))}))}},u)}}}var Xe=[{segment:"autocomplete-core",version:"1.9.3"}];function Ye(e){return Ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(e)}function et(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function tt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?et(Object(r),!0).forEach((function(t){rt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):et(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function rt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Ye(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ye(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ye(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nt(e){var t,r,n,o,i=e.plugins,a=e.options,c=null===(t=((null===(r=a.__autocomplete_metadata)||void 0===r?void 0:r.userAgents)||[])[0])||void 0===t?void 0:t.segment,l=c?rt({},c,Object.keys((null===(n=a.__autocomplete_metadata)||void 0===n?void 0:n.options)||{})):{};return{plugins:i.map((function(e){return{name:e.name,options:Object.keys(e.__autocomplete_pluginOptions||[])}})),options:tt({"autocomplete-core":Object.keys(a)},l),ua:Xe.concat((null===(o=a.__autocomplete_metadata)||void 0===o?void 0:o.userAgents)||[])}}function ot(e){var t,r=e.state;return!1===r.isOpen||null===r.activeItemId?null:(null===(t=ge(r))||void 0===t?void 0:t.itemInputValue)||null}function it(e,t,r,n){if(!r)return null;if(e<0&&(null===t||null!==n&&0===t))return r+e;var o=(null===t?-1:t)+e;return o<=-1||o>=r?null===n?null:0:o}function at(e){return at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},at(e)}function ct(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(r),!0).forEach((function(t){ut(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ct(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ut(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==at(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==at(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===at(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var st=function(e,t){switch(t.type){case"setActiveItemId":case"mousemove":return lt(lt({},e),{},{activeItemId:t.payload});case"setQuery":return lt(lt({},e),{},{query:t.payload,completion:null});case"setCollections":return lt(lt({},e),{},{collections:t.payload});case"setIsOpen":return lt(lt({},e),{},{isOpen:t.payload});case"setStatus":return lt(lt({},e),{},{status:t.payload});case"setContext":return lt(lt({},e),{},{context:lt(lt({},e.context),t.payload)});case"ArrowDown":var r=lt(lt({},e),{},{activeItemId:t.payload.hasOwnProperty("nextActiveItemId")?t.payload.nextActiveItemId:it(1,e.activeItemId,B(e),t.props.defaultActiveItemId)});return lt(lt({},r),{},{completion:ot({state:r})});case"ArrowUp":var n=lt(lt({},e),{},{activeItemId:it(-1,e.activeItemId,B(e),t.props.defaultActiveItemId)});return lt(lt({},n),{},{completion:ot({state:n})});case"Escape":return e.isOpen?lt(lt({},e),{},{activeItemId:null,isOpen:!1,completion:null}):lt(lt({},e),{},{activeItemId:null,query:"",status:"idle",collections:[]});case"submit":return lt(lt({},e),{},{activeItemId:null,isOpen:!1,status:"idle"});case"reset":return lt(lt({},e),{},{activeItemId:!0===t.props.openOnFocus?t.props.defaultActiveItemId:null,status:"idle",query:""});case"focus":return lt(lt({},e),{},{activeItemId:t.props.defaultActiveItemId,isOpen:(t.props.openOnFocus||Boolean(e.query))&&t.props.shouldPanelOpen({state:e})});case"blur":return t.props.debug?e:lt(lt({},e),{},{isOpen:!1,activeItemId:null});case"mouseleave":return lt(lt({},e),{},{activeItemId:t.props.defaultActiveItemId});default:return"The reducer action ".concat(JSON.stringify(t.type)," is not supported."),e}};function ft(e){return ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ft(e)}function mt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function pt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mt(Object(r),!0).forEach((function(t){vt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function vt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==ft(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ft(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dt(e){var t=[],r=ee(e,t),n=R(st,r,(function(e){var t=e.prevState,n=e.state;r.onStateChange(pt({prevState:t,state:n,refresh:a,navigator:r.navigator},o))})),o=function(e){var t=e.store;return{setActiveItemId:function(e){t.dispatch("setActiveItemId",e)},setQuery:function(e){t.dispatch("setQuery",e)},setCollections:function(e){var r=0,n=e.map((function(e){return F(F({},e),{},{items:L(e.items).map((function(e){return F(F({},e),{},{__autocomplete_id:r++})}))})}));t.dispatch("setCollections",n)},setIsOpen:function(e){t.dispatch("setIsOpen",e)},setStatus:function(e){t.dispatch("setStatus",e)},setContext:function(e){t.dispatch("setContext",e)}}}({store:n}),i=Ge(pt({props:r,refresh:a,store:n,navigator:r.navigator},o));function a(){return Ce(pt({event:new Event("input"),nextState:{isOpen:n.getState().isOpen},props:r,navigator:r.navigator,query:n.getState().query,refresh:a,store:n},o))}if(e.insights&&!r.plugins.some((function(e){return"aa.algoliaInsightsPlugin"===e.name}))){var c="boolean"==typeof e.insights?{}:e.insights;r.plugins.push(N(c))}return r.plugins.forEach((function(e){var n;return null===(n=e.subscribe)||void 0===n?void 0:n.call(e,pt(pt({},o),{},{navigator:r.navigator,refresh:a,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})},onResolve:function(e){t.push({onResolve:e})}}))})),function(e){var t,r,n=e.metadata,o=e.environment;if(null===(t=o.navigator)||void 0===t||null===(r=t.userAgent)||void 0===r?void 0:r.includes("Algolia Crawler")){var i=o.document.createElement("meta"),a=o.document.querySelector("head");i.name="algolia:metadata",setTimeout((function(){i.content=JSON.stringify(n),a.appendChild(i)}),0)}}({metadata:nt({plugins:r.plugins,options:e}),environment:r.environment}),pt(pt({refresh:a,navigator:r.navigator},i),o)}var yt=r(6540),ht=64;function bt(e){var t=e.translations,r=(void 0===t?{}:t).searchByText,n=void 0===r?"Search by":r;return yt.createElement("a",{href:"https://www.algolia.com/ref/docsearch/?utm_source=".concat(window.location.hostname,"&utm_medium=referral&utm_content=powered_by&utm_campaign=docsearch"),target:"_blank",rel:"noopener noreferrer"},yt.createElement("span",{className:"DocSearch-Label"},n),yt.createElement("svg",{width:"77",height:"19","aria-label":"Algolia",role:"img",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 2196.2 500"},yt.createElement("defs",null,yt.createElement("style",null,".cls-1,.cls-2{fill:#003dff;}.cls-2{fill-rule:evenodd;}")),yt.createElement("path",{className:"cls-2",d:"M1070.38,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"}),yt.createElement("rect",{className:"cls-1",x:"1845.88",y:"104.73",width:"62.58",height:"277.9",rx:"5.9",ry:"5.9"}),yt.createElement("path",{className:"cls-2",d:"M1851.78,71.38h50.77c3.26,0,5.9-2.64,5.9-5.9V5.9c0-3.62-3.24-6.39-6.82-5.83l-50.77,7.95c-2.87,.45-4.99,2.92-4.99,5.83v51.62c0,3.26,2.64,5.9,5.9,5.9Z"}),yt.createElement("path",{className:"cls-2",d:"M1764.03,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"}),yt.createElement("path",{className:"cls-2",d:"M1631.95,142.72c-11.14-12.25-24.83-21.65-40.78-28.31-15.92-6.53-33.26-9.85-52.07-9.85-18.78,0-36.15,3.17-51.92,9.85-15.59,6.66-29.29,16.05-40.76,28.31-11.47,12.23-20.38,26.87-26.76,44.03-6.38,17.17-9.24,37.37-9.24,58.36,0,20.99,3.19,36.87,9.55,54.21,6.38,17.32,15.14,32.11,26.45,44.36,11.29,12.23,24.83,21.62,40.6,28.46,15.77,6.83,40.12,10.33,52.4,10.48,12.25,0,36.78-3.82,52.7-10.48,15.92-6.68,29.46-16.23,40.78-28.46,11.29-12.25,20.05-27.04,26.25-44.36,6.22-17.34,9.24-33.22,9.24-54.21,0-20.99-3.34-41.19-10.03-58.36-6.38-17.17-15.14-31.8-26.43-44.03Zm-44.43,163.75c-11.47,15.75-27.56,23.7-48.09,23.7-20.55,0-36.63-7.8-48.1-23.7-11.47-15.75-17.21-34.01-17.21-61.2,0-26.89,5.59-49.14,17.06-64.87,11.45-15.75,27.54-23.52,48.07-23.52,20.55,0,36.63,7.78,48.09,23.52,11.47,15.57,17.36,37.98,17.36,64.87,0,27.19-5.72,45.3-17.19,61.2Z"}),yt.createElement("path",{className:"cls-2",d:"M894.42,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"}),yt.createElement("path",{className:"cls-2",d:"M2133.97,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"}),yt.createElement("path",{className:"cls-2",d:"M1314.05,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-11.79,18.34-19.6,39.64-22.11,62.59-.58,5.3-.88,10.68-.88,16.14s.31,11.15,.93,16.59c4.28,38.09,23.14,71.61,50.66,94.52,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47h0c17.99,0,34.61-5.93,48.16-15.97,16.29-11.58,28.88-28.54,34.48-47.75v50.26h-.11v11.08c0,21.84-5.71,38.27-17.34,49.36-11.61,11.08-31.04,16.63-58.25,16.63-11.12,0-28.79-.59-46.6-2.41-2.83-.29-5.46,1.5-6.27,4.22l-12.78,43.11c-1.02,3.46,1.27,7.02,4.83,7.53,21.52,3.08,42.52,4.68,54.65,4.68,48.91,0,85.16-10.75,108.89-32.21,21.48-19.41,33.15-48.89,35.2-88.52V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,64.1s.65,139.13,0,143.36c-12.08,9.77-27.11,13.59-43.49,14.7-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-1.32,0-2.63-.03-3.94-.1-40.41-2.11-74.52-37.26-74.52-79.38,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33Z"}),yt.createElement("path",{className:"cls-1",d:"M249.83,0C113.3,0,2,110.09,.03,246.16c-2,138.19,110.12,252.7,248.33,253.5,42.68,.25,83.79-10.19,120.3-30.03,3.56-1.93,4.11-6.83,1.08-9.51l-23.38-20.72c-4.75-4.21-11.51-5.4-17.36-2.92-25.48,10.84-53.17,16.38-81.71,16.03-111.68-1.37-201.91-94.29-200.13-205.96,1.76-110.26,92-199.41,202.67-199.41h202.69V407.41l-115-102.18c-3.72-3.31-9.42-2.66-12.42,1.31-18.46,24.44-48.53,39.64-81.93,37.34-46.33-3.2-83.87-40.5-87.34-86.81-4.15-55.24,39.63-101.52,94-101.52,49.18,0,89.68,37.85,93.91,85.95,.38,4.28,2.31,8.27,5.52,11.12l29.95,26.55c3.4,3.01,8.79,1.17,9.63-3.3,2.16-11.55,2.92-23.58,2.07-35.92-4.82-70.34-61.8-126.93-132.17-131.26-80.68-4.97-148.13,58.14-150.27,137.25-2.09,77.1,61.08,143.56,138.19,145.26,32.19,.71,62.03-9.41,86.14-26.95l150.26,133.2c6.44,5.71,16.61,1.14,16.61-7.47V9.48C499.66,4.25,495.42,0,490.18,0H249.83Z"})))}function gt(e){return yt.createElement("svg",{width:"15",height:"15","aria-label":e.ariaLabel,role:"img"},yt.createElement("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"},e.children))}function Ot(e){var t=e.translations,r=void 0===t?{}:t,n=r.selectText,o=void 0===n?"to select":n,i=r.selectKeyAriaLabel,a=void 0===i?"Enter key":i,c=r.navigateText,l=void 0===c?"to navigate":c,u=r.navigateUpKeyAriaLabel,s=void 0===u?"Arrow up":u,f=r.navigateDownKeyAriaLabel,m=void 0===f?"Arrow down":f,p=r.closeText,v=void 0===p?"to close":p,d=r.closeKeyAriaLabel,y=void 0===d?"Escape key":d,h=r.searchByText,b=void 0===h?"Search by":h;return yt.createElement(yt.Fragment,null,yt.createElement("div",{className:"DocSearch-Logo"},yt.createElement(bt,{translations:{searchByText:b}})),yt.createElement("ul",{className:"DocSearch-Commands"},yt.createElement("li",null,yt.createElement("kbd",{className:"DocSearch-Commands-Key"},yt.createElement(gt,{ariaLabel:a},yt.createElement("path",{d:"M12 3.53088v3c0 1-1 2-2 2H4M7 11.53088l-3-3 3-3"}))),yt.createElement("span",{className:"DocSearch-Label"},o)),yt.createElement("li",null,yt.createElement("kbd",{className:"DocSearch-Commands-Key"},yt.createElement(gt,{ariaLabel:m},yt.createElement("path",{d:"M7.5 3.5v8M10.5 8.5l-3 3-3-3"}))),yt.createElement("kbd",{className:"DocSearch-Commands-Key"},yt.createElement(gt,{ariaLabel:s},yt.createElement("path",{d:"M7.5 11.5v-8M10.5 6.5l-3-3-3 3"}))),yt.createElement("span",{className:"DocSearch-Label"},l)),yt.createElement("li",null,yt.createElement("kbd",{className:"DocSearch-Commands-Key"},yt.createElement(gt,{ariaLabel:y},yt.createElement("path",{d:"M13.6167 8.936c-.1065.3583-.6883.962-1.4875.962-.7993 0-1.653-.9165-1.653-2.1258v-.5678c0-1.2548.7896-2.1016 1.653-2.1016.8634 0 1.3601.4778 1.4875 1.0724M9 6c-.1352-.4735-.7506-.9219-1.46-.8972-.7092.0246-1.344.57-1.344 1.2166s.4198.8812 1.3445.9805C8.465 7.3992 8.968 7.9337 9 8.5c.032.5663-.454 1.398-1.4595 1.398C6.6593 9.898 6 9 5.963 8.4851m-1.4748.5368c-.2635.5941-.8099.876-1.5443.876s-1.7073-.6248-1.7073-2.204v-.4603c0-1.0416.721-2.131 1.7073-2.131.9864 0 1.6425 1.031 1.5443 2.2492h-2.956"}))),yt.createElement("span",{className:"DocSearch-Label"},v))))}function St(e){var t=e.hit,r=e.children;return yt.createElement("a",{href:t.url},r)}function jt(){return yt.createElement("svg",{width:"40",height:"40",viewBox:"0 0 20 20",fill:"none",fillRule:"evenodd",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M19 4.8a16 16 0 00-2-1.2m-3.3-1.2A16 16 0 001.1 4.7M16.7 8a12 12 0 00-2.8-1.4M10 6a12 12 0 00-6.7 2M12.3 14.7a4 4 0 00-4.5 0M14.5 11.4A8 8 0 0010 10M3 16L18 2M10 18h0"}))}function wt(e){var t=e.translations,r=void 0===t?{}:t,n=r.titleText,o=void 0===n?"Unable to fetch results":n,i=r.helpText,a=void 0===i?"You might want to check your network connection.":i;return yt.createElement("div",{className:"DocSearch-ErrorScreen"},yt.createElement("div",{className:"DocSearch-Screen-Icon"},yt.createElement(jt,null)),yt.createElement("p",{className:"DocSearch-Title"},o),yt.createElement("p",{className:"DocSearch-Help"},a))}function Et(){return yt.createElement("svg",{width:"40",height:"40",viewBox:"0 0 20 20",fill:"none",fillRule:"evenodd",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M15.5 4.8c2 3 1.7 7-1 9.7h0l4.3 4.3-4.3-4.3a7.8 7.8 0 01-9.8 1m-2.2-2.2A7.8 7.8 0 0113.2 2.4M2 18L18 2"}))}var Pt=["translations"];function It(e){return function(e){if(Array.isArray(e))return Dt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Dt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dt(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function At(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function kt(e){var t=e.translations,r=void 0===t?{}:t,n=At(e,Pt),o=r.noResultsText,i=void 0===o?"No results for":o,a=r.suggestedQueryText,c=void 0===a?"Try searching for":a,l=r.reportMissingResultsText,u=void 0===l?"Believe this query should return results?":l,s=r.reportMissingResultsLinkText,f=void 0===s?"Let us know.":s,m=n.state.context.searchSuggestions;return yt.createElement("div",{className:"DocSearch-NoResults"},yt.createElement("div",{className:"DocSearch-Screen-Icon"},yt.createElement(Et,null)),yt.createElement("p",{className:"DocSearch-Title"},i,' "',yt.createElement("strong",null,n.state.query),'"'),m&&m.length>0&&yt.createElement("div",{className:"DocSearch-NoResults-Prefill-List"},yt.createElement("p",{className:"DocSearch-Help"},c,":"),yt.createElement("ul",null,m.slice(0,3).reduce((function(e,t){return[].concat(It(e),[yt.createElement("li",{key:t},yt.createElement("button",{className:"DocSearch-Prefill",key:t,type:"button",onClick:function(){n.setQuery(t.toLowerCase()+" "),n.refresh(),n.inputRef.current.focus()}},t))])}),[]))),n.getMissingResultsUrl&&yt.createElement("p",{className:"DocSearch-Help"},"".concat(u," "),yt.createElement("a",{href:n.getMissingResultsUrl({query:n.state.query}),target:"_blank",rel:"noopener noreferrer"},f)))}var xt=function(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M17 6v12c0 .52-.2 1-1 1H4c-.7 0-1-.33-1-1V2c0-.55.42-1 1-1h8l5 5zM14 8h-3.13c-.51 0-.87-.34-.87-.87V4",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinejoin:"round"}))};function Ct(e){switch(e.type){case"lvl1":return yt.createElement(xt,null);case"content":return yt.createElement(_t,null);default:return yt.createElement(Nt,null)}}function Nt(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M13 13h4-4V8H7v5h6v4-4H7V8H3h4V3v5h6V3v5h4-4v5zm-6 0v4-4H3h4z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}function _t(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M17 5H3h14zm0 5H3h14zm0 5H3h14z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinejoin:"round"}))}function Tt(){return yt.createElement("svg",{className:"DocSearch-Hit-Select-Icon",width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M18 3v4c0 2-2 4-4 4H2"}),yt.createElement("path",{d:"M8 17l-6-6 6-6"})))}var qt=["hit","attribute","tagName"];function Rt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Lt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rt(Object(r),!0).forEach((function(t){Mt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ht(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Ft(e,t){return t.split(".").reduce((function(e,t){return null!=e&&e[t]?e[t]:null}),e)}function Ut(e){var t=e.hit,r=e.attribute,n=e.tagName,o=void 0===n?"span":n,i=Ht(e,qt);return(0,yt.createElement)(o,Lt(Lt({},i),{},{dangerouslySetInnerHTML:{__html:Ft(t,"_snippetResult.".concat(r,".value"))||Ft(t,r)}}))}function Bt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){c=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Vt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kt(){return Kt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kt.apply(this,arguments)}function $t(e){return e.collection&&0!==e.collection.items.length?yt.createElement("section",{className:"DocSearch-Hits"},yt.createElement("div",{className:"DocSearch-Hit-source"},e.title),yt.createElement("ul",e.getListProps(),e.collection.items.map((function(t,r){return yt.createElement(Jt,Kt({key:[e.title,t.objectID].join(":"),item:t,index:r},e))})))):null}function Jt(e){var t=e.item,r=e.index,n=e.renderIcon,o=e.renderAction,i=e.getItemProps,a=e.onItemClick,c=e.collection,l=e.hitComponent,u=Bt(yt.useState(!1),2),s=u[0],f=u[1],m=Bt(yt.useState(!1),2),p=m[0],v=m[1],d=yt.useRef(null),y=l;return yt.createElement("li",Kt({className:["DocSearch-Hit",t.__docsearch_parent&&"DocSearch-Hit--Child",s&&"DocSearch-Hit--deleting",p&&"DocSearch-Hit--favoriting"].filter(Boolean).join(" "),onTransitionEnd:function(){d.current&&d.current()}},i({item:t,source:c.source,onClick:function(e){a(t,e)}})),yt.createElement(y,{hit:t},yt.createElement("div",{className:"DocSearch-Hit-Container"},n({item:t,index:r}),t.hierarchy[t.type]&&"lvl1"===t.type&&yt.createElement("div",{className:"DocSearch-Hit-content-wrapper"},yt.createElement(Ut,{className:"DocSearch-Hit-title",hit:t,attribute:"hierarchy.lvl1"}),t.content&&yt.createElement(Ut,{className:"DocSearch-Hit-path",hit:t,attribute:"content"})),t.hierarchy[t.type]&&("lvl2"===t.type||"lvl3"===t.type||"lvl4"===t.type||"lvl5"===t.type||"lvl6"===t.type)&&yt.createElement("div",{className:"DocSearch-Hit-content-wrapper"},yt.createElement(Ut,{className:"DocSearch-Hit-title",hit:t,attribute:"hierarchy.".concat(t.type)}),yt.createElement(Ut,{className:"DocSearch-Hit-path",hit:t,attribute:"hierarchy.lvl1"})),"content"===t.type&&yt.createElement("div",{className:"DocSearch-Hit-content-wrapper"},yt.createElement(Ut,{className:"DocSearch-Hit-title",hit:t,attribute:"content"}),yt.createElement(Ut,{className:"DocSearch-Hit-path",hit:t,attribute:"hierarchy.lvl1"})),o({item:t,runDeleteTransition:function(e){f(!0),d.current=e},runFavoriteTransition:function(e){v(!0),d.current=e}}))))}var zt=/(<mark>|<\/mark>)/g,Wt=RegExp(zt.source);function Qt(e){var t,r,n=e;if(!n.__docsearch_parent&&!e._highlightResult)return e.hierarchy.lvl0;var o=((n.__docsearch_parent?null===(t=n.__docsearch_parent)||void 0===t||null===(t=t._highlightResult)||void 0===t||null===(t=t.hierarchy)||void 0===t?void 0:t.lvl0:null===(r=e._highlightResult)||void 0===r||null===(r=r.hierarchy)||void 0===r?void 0:r.lvl0)||{}).value;return o&&Wt.test(o)?o.replace(zt,""):o}function Zt(){return Zt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zt.apply(this,arguments)}function Gt(e){return yt.createElement("div",{className:"DocSearch-Dropdown-Container"},e.state.collections.map((function(t){if(0===t.items.length)return null;var r=Qt(t.items[0]);return yt.createElement($t,Zt({},e,{key:t.source.sourceId,title:r,collection:t,renderIcon:function(e){var r,n=e.item,o=e.index;return yt.createElement(yt.Fragment,null,n.__docsearch_parent&&yt.createElement("svg",{className:"DocSearch-Hit-Tree",viewBox:"0 0 24 54"},yt.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},n.__docsearch_parent!==(null===(r=t.items[o+1])||void 0===r?void 0:r.__docsearch_parent)?yt.createElement("path",{d:"M8 6v21M20 27H8.3"}):yt.createElement("path",{d:"M8 6v42M20 27H8.3"}))),yt.createElement("div",{className:"DocSearch-Hit-icon"},yt.createElement(Ct,{type:n.type})))},renderAction:function(){return yt.createElement("div",{className:"DocSearch-Hit-action"},yt.createElement(Tt,null))}}))})),e.resultsFooterComponent&&yt.createElement("section",{className:"DocSearch-HitsFooter"},yt.createElement(e.resultsFooterComponent,{state:e.state})))}function Xt(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M3.18 6.6a8.23 8.23 0 1112.93 9.94h0a8.23 8.23 0 01-11.63 0"}),yt.createElement("path",{d:"M6.44 7.25H2.55V3.36M10.45 6v5.6M10.45 11.6L13 13"})))}function Yt(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M10 14.2L5 17l1-5.6-4-4 5.5-.7 2.5-5 2.5 5 5.6.8-4 4 .9 5.5z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinejoin:"round"}))}function er(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M10 10l5.09-5.09L10 10l5.09 5.09L10 10zm0 0L4.91 4.91 10 10l-5.09 5.09L10 10z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}var tr=["translations"];function rr(){return rr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rr.apply(this,arguments)}function nr(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function or(e){var t=e.translations,r=void 0===t?{}:t,n=nr(e,tr),o=r.recentSearchesTitle,i=void 0===o?"Recent":o,a=r.noRecentSearchesText,c=void 0===a?"No recent searches":a,l=r.saveRecentSearchButtonTitle,u=void 0===l?"Save this search":l,s=r.removeRecentSearchButtonTitle,f=void 0===s?"Remove this search from history":s,m=r.favoriteSearchesTitle,p=void 0===m?"Favorite":m,v=r.removeFavoriteSearchButtonTitle,d=void 0===v?"Remove this search from favorites":v;return"idle"===n.state.status&&!1===n.hasCollections?n.disableUserPersonalization?null:yt.createElement("div",{className:"DocSearch-StartScreen"},yt.createElement("p",{className:"DocSearch-Help"},c)):!1===n.hasCollections?null:yt.createElement("div",{className:"DocSearch-Dropdown-Container"},yt.createElement($t,rr({},n,{title:i,collection:n.state.collections[0],renderIcon:function(){return yt.createElement("div",{className:"DocSearch-Hit-icon"},yt.createElement(Xt,null))},renderAction:function(e){var t=e.item,r=e.runFavoriteTransition,o=e.runDeleteTransition;return yt.createElement(yt.Fragment,null,yt.createElement("div",{className:"DocSearch-Hit-action"},yt.createElement("button",{className:"DocSearch-Hit-action-button",title:u,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),r((function(){n.favoriteSearches.add(t),n.recentSearches.remove(t),n.refresh()}))}},yt.createElement(Yt,null))),yt.createElement("div",{className:"DocSearch-Hit-action"},yt.createElement("button",{className:"DocSearch-Hit-action-button",title:f,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),o((function(){n.recentSearches.remove(t),n.refresh()}))}},yt.createElement(er,null))))}})),yt.createElement($t,rr({},n,{title:p,collection:n.state.collections[1],renderIcon:function(){return yt.createElement("div",{className:"DocSearch-Hit-icon"},yt.createElement(Yt,null))},renderAction:function(e){var t=e.item,r=e.runDeleteTransition;return yt.createElement("div",{className:"DocSearch-Hit-action"},yt.createElement("button",{className:"DocSearch-Hit-action-button",title:d,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),r((function(){n.favoriteSearches.remove(t),n.refresh()}))}},yt.createElement(er,null)))}})))}var ir=["translations"];function ar(){return ar=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ar.apply(this,arguments)}function cr(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var lr=yt.memo((function(e){var t=e.translations,r=void 0===t?{}:t,n=cr(e,ir);if("error"===n.state.status)return yt.createElement(wt,{translations:null==r?void 0:r.errorScreen});var o=n.state.collections.some((function(e){return e.items.length>0}));return n.state.query?!1===o?yt.createElement(kt,ar({},n,{translations:null==r?void 0:r.noResultsScreen})):yt.createElement(Gt,n):yt.createElement(or,ar({},n,{hasCollections:o,translations:null==r?void 0:r.startScreen}))}),(function(e,t){return"loading"===t.state.status||"stalled"===t.state.status}));function ur(){return yt.createElement("svg",{viewBox:"0 0 38 38",stroke:"currentColor",strokeOpacity:".5"},yt.createElement("g",{fill:"none",fillRule:"evenodd"},yt.createElement("g",{transform:"translate(1 1)",strokeWidth:"2"},yt.createElement("circle",{strokeOpacity:".3",cx:"18",cy:"18",r:"18"}),yt.createElement("path",{d:"M36 18c0-9.94-8.06-18-18-18"},yt.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 18 18",to:"360 18 18",dur:"1s",repeatCount:"indefinite"})))))}var sr=r(9188),fr=["translations"];function mr(){return mr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mr.apply(this,arguments)}function pr(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function vr(e){var t=e.translations,r=void 0===t?{}:t,n=pr(e,fr),o=r.resetButtonTitle,i=void 0===o?"Clear the query":o,a=r.resetButtonAriaLabel,c=void 0===a?"Clear the query":a,l=r.cancelButtonText,u=void 0===l?"Cancel":l,s=r.cancelButtonAriaLabel,f=void 0===s?"Cancel":s,m=n.getFormProps({inputElement:n.inputRef.current}).onReset;return yt.useEffect((function(){n.autoFocus&&n.inputRef.current&&n.inputRef.current.focus()}),[n.autoFocus,n.inputRef]),yt.useEffect((function(){n.isFromSelection&&n.inputRef.current&&n.inputRef.current.select()}),[n.isFromSelection,n.inputRef]),yt.createElement(yt.Fragment,null,yt.createElement("form",{className:"DocSearch-Form",onSubmit:function(e){e.preventDefault()},onReset:m},yt.createElement("label",mr({className:"DocSearch-MagnifierLabel"},n.getLabelProps()),yt.createElement(sr.W,null)),yt.createElement("div",{className:"DocSearch-LoadingIndicator"},yt.createElement(ur,null)),yt.createElement("input",mr({className:"DocSearch-Input",ref:n.inputRef},n.getInputProps({inputElement:n.inputRef.current,autoFocus:n.autoFocus,maxLength:ht}))),yt.createElement("button",{type:"reset",title:i,className:"DocSearch-Reset","aria-label":c,hidden:!n.state.query},yt.createElement(er,null))),yt.createElement("button",{className:"DocSearch-Cancel",type:"reset","aria-label":f,onClick:n.onClose},u))}var dr=["_highlightResult","_snippetResult"];function yr(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function hr(e){return!1===function(){var e="__TEST_KEY__";try{return localStorage.setItem(e,""),localStorage.removeItem(e),!0}catch(t){return!1}}()?{setItem:function(){},getItem:function(){return[]}}:{setItem:function(t){return window.localStorage.setItem(e,JSON.stringify(t))},getItem:function(){var t=window.localStorage.getItem(e);return t?JSON.parse(t):[]}}}function br(e){var t=e.key,r=e.limit,n=void 0===r?5:r,o=hr(t),i=o.getItem().slice(0,n);return{add:function(e){var t=e,r=(t._highlightResult,t._snippetResult,yr(t,dr)),a=i.findIndex((function(e){return e.objectID===r.objectID}));a>-1&&i.splice(a,1),i.unshift(r),i=i.slice(0,n),o.setItem(i)},remove:function(e){i=i.filter((function(t){return t.objectID!==e.objectID})),o.setItem(i)},getAll:function(){return i}}}function gr(e){const t=`algoliasearch-client-js-${e.key}`;let r;const n=()=>(void 0===r&&(r=e.localStorage||window.localStorage),r),o=()=>JSON.parse(n().getItem(t)||"{}"),i=e=>{n().setItem(t,JSON.stringify(e))};return{get:(t,r,n={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{(()=>{const t=e.timeToLive?1e3*e.timeToLive:null,r=o(),n=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(i(n),!t)return;const a=Object.fromEntries(Object.entries(n).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)})));i(a)})();const r=JSON.stringify(t);return o()[r]})).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||n.miss(e)]))).then((([e])=>e)),set:(e,r)=>Promise.resolve().then((()=>{const i=o();return i[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:r},n().setItem(t,JSON.stringify(i)),r})),delete:e=>Promise.resolve().then((()=>{const r=o();delete r[JSON.stringify(e)],n().setItem(t,JSON.stringify(r))})),clear:()=>Promise.resolve().then((()=>{n().removeItem(t)}))}}function Or(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,n,o={miss:()=>Promise.resolve()})=>r.get(e,n,o).catch((()=>Or({caches:t}).get(e,n,o))),set:(e,n)=>r.set(e,n).catch((()=>Or({caches:t}).set(e,n))),delete:e=>r.delete(e).catch((()=>Or({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>Or({caches:t}).clear()))}}function Sr(e={serializable:!0}){let t={};return{get(r,n,o={miss:()=>Promise.resolve()}){const i=JSON.stringify(r);if(i in t)return Promise.resolve(e.serializable?JSON.parse(t[i]):t[i]);const a=n(),c=o&&o.miss||(()=>Promise.resolve());return a.then((e=>c(e))).then((()=>a))},set:(r,n)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}function jr(e){let t=e.length-1;for(;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function wr(e,t){return t?(Object.keys(t).forEach((r=>{e[r]=t[r](e)})),e):e}function Er(e,...t){let r=0;return e.replace(/%s/g,(()=>encodeURIComponent(t[r++])))}const Pr="4.22.1",Ir={WithinQueryParameters:0,WithinHeaders:1};function Dr(e,t){const r=e||{},n=r.data||{};return Object.keys(r).forEach((e=>{-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}const Ar={Read:1,Write:2,Any:3},kr={Up:1,Down:2,Timeouted:3},xr=12e4;function Cr(e,t=kr.Up){return{...e,status:t,lastUpdate:Date.now()}}function Nr(e){return"string"==typeof e?{protocol:"https",url:e,accept:Ar.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||Ar.Any}}const _r={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"};function Tr(e,t){return Promise.all(t.map((t=>e.get(t,(()=>Promise.resolve(Cr(t))))))).then((e=>{const r=e.filter((e=>function(e){return e.status===kr.Up||Date.now()-e.lastUpdate>xr}(e))),n=e.filter((e=>function(e){return e.status===kr.Timeouted&&Date.now()-e.lastUpdate<=xr}(e))),o=[...r,...n];return{getTimeout:(e,t)=>(0===n.length&&0===e?1:n.length+3+e)*t,statelessHosts:o.length>0?o.map((e=>Nr(e))):t}}))}const qr=(e,t)=>(e=>{const t=e.status;return e.isTimedOut||(({isTimedOut:e,status:t})=>!e&&0==~~t)(e)||2!=~~(t/100)&&4!=~~(t/100)})(e)?t.onRetry(e):(({status:e})=>2==~~(e/100))(e)?t.onSuccess(e):t.onFail(e);function Rr(e,t,r,n){const o=[],i=function(e,t){if(e.method===_r.Get||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(r,n),a=function(e,t){const r={...e.headers,...t.headers},n={};return Object.keys(r).forEach((e=>{const t=r[e];n[e.toLowerCase()]=t})),n}(e,n),c=r.method,l=r.method!==_r.Get?{}:{...r.data,...n.data},u={"x-algolia-agent":e.userAgent.value,...e.queryParameters,...l,...n.queryParameters};let s=0;const f=(t,l)=>{const m=t.pop();if(void 0===m)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:Fr(o)};const p={data:i,headers:a,method:c,url:Mr(m,r.path,u),connectTimeout:l(s,e.timeouts.connect),responseTimeout:l(s,n.timeout)},v=e=>{const r={request:p,response:e,host:m,triesLeft:t.length};return o.push(r),r},d={onSuccess:e=>function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e),onRetry(r){const n=v(r);return r.isTimedOut&&s++,Promise.all([e.logger.info("Retryable failure",Ur(n)),e.hostsCache.set(m,Cr(m,r.isTimedOut?kr.Timeouted:kr.Down))]).then((()=>f(t,l)))},onFail(e){throw v(e),function({content:e,status:t},r){let n=e;try{n=JSON.parse(e).message}catch(o){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(n,t,r)}(e,Fr(o))}};return e.requester.send(p).then((e=>qr(e,d)))};return Tr(e.hostsCache,t).then((e=>f([...e.statelessHosts].reverse(),e.getTimeout)))}function Lr(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}function Mr(e,t,r){const n=Hr(r);let o=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return n.length&&(o+=`?${n}`),o}function Hr(e){return Object.keys(e).map((t=>{return Er("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function Fr(e){return e.map((e=>Ur(e)))}function Ur(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}const Br=e=>{const t=e.appId,r=function(e,t,r){const n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:()=>e===Ir.WithinHeaders?n:{},queryParameters:()=>e===Ir.WithinQueryParameters?n:{}}}(void 0!==e.authMode?e.authMode:Ir.WithinHeaders,t,e.apiKey),n=function(e){const{hostsCache:t,logger:r,requester:n,requestsCache:o,responsesCache:i,timeouts:a,userAgent:c,hosts:l,queryParameters:u,headers:s}=e,f={hostsCache:t,logger:r,requester:n,requestsCache:o,responsesCache:i,timeouts:a,userAgent:c,headers:s,queryParameters:u,hosts:l.map((e=>Nr(e))),read(e,t){const r=Dr(t,f.timeouts.read),n=()=>Rr(f,f.hosts.filter((e=>0!=(e.accept&Ar.Read))),e,r);if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();const o={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(o,(()=>f.requestsCache.get(o,(()=>f.requestsCache.set(o,n()).then((e=>Promise.all([f.requestsCache.delete(o),e])),(e=>Promise.all([f.requestsCache.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>f.responsesCache.set(o,e)})},write:(e,t)=>Rr(f,f.hosts.filter((e=>0!=(e.accept&Ar.Write))),e,Dr(t,f.timeouts.write))};return f}({hosts:[{url:`${t}-dsn.algolia.net`,accept:Ar.Read},{url:`${t}.algolia.net`,accept:Ar.Write}].concat(jr([{url:`${t}-1.algolianet.com`},{url:`${t}-2.algolianet.com`},{url:`${t}-3.algolianet.com`}])),...e,headers:{...r.headers(),"content-type":"application/x-www-form-urlencoded",...e.headers},queryParameters:{...r.queryParameters(),...e.queryParameters}}),o={transporter:n,appId:t,addAlgoliaAgent(e,t){n.userAgent.add({segment:e,version:t})},clearCache:()=>Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then((()=>{}))};return wr(o,e.methods)},Vr=e=>(t,r)=>t.method===_r.Get?e.transporter.read(t,r):e.transporter.write(t,r),Kr=e=>(t,r={})=>wr({transporter:e.transporter,appId:e.appId,indexName:t},r.methods),$r=e=>(t,r)=>{const n=t.map((e=>({...e,params:Hr(e.params||{})})));return e.transporter.read({method:_r.Post,path:"1/indexes/*/queries",data:{requests:n},cacheable:!0},r)},Jr=e=>(t,r)=>Promise.all(t.map((t=>{const{facetName:n,facetQuery:o,...i}=t.params;return Kr(e)(t.indexName,{methods:{searchForFacetValues:Qr}}).searchForFacetValues(n,o,{...r,...i})}))),zr=e=>(t,r,n)=>e.transporter.read({method:_r.Post,path:Er("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n),Wr=e=>(t,r)=>e.transporter.read({method:_r.Post,path:Er("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r),Qr=e=>(t,r,n)=>e.transporter.read({method:_r.Post,path:Er("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n),Zr={Debug:1,Info:2,Error:3};function Gr(e,t,r){const n={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:e=>new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const n=(e,n)=>setTimeout((()=>{r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e),o=n(e.connectTimeout,"Connection timeout");let i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===i&&(clearTimeout(o),i=n(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(o),clearTimeout(i),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(o),clearTimeout(i),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))},logger:(o=Zr.Error,{debug:(e,t)=>(Zr.Debug>=o&&console.debug(e,t),Promise.resolve()),info:(e,t)=>(Zr.Info>=o&&console.info(e,t),Promise.resolve()),error:(e,t)=>(console.error(e,t),Promise.resolve())}),responsesCache:Sr(),requestsCache:Sr({serializable:!1}),hostsCache:Or({caches:[gr({key:`${Pr}-${e}`}),Sr()]}),userAgent:Lr(Pr).add({segment:"Browser",version:"lite"}),authMode:Ir.WithinQueryParameters};var o;return Br({...n,...r,methods:{search:$r,searchForFacetValues:Jr,multipleQueries:$r,multipleSearchForFacetValues:Jr,customRequest:Vr,initIndex:e=>t=>Kr(e)(t,{methods:{search:Wr,searchForFacetValues:Qr,findAnswers:zr}})}})}Gr.version=Pr;const Xr=Gr;var Yr="3.5.2";function en(){}function tn(e){return e}function rn(e){return 1===e.button||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function nn(e,t,r){return e.reduce((function(e,n){var o=t(n);return e.hasOwnProperty(o)||(e[o]=[]),e[o].length<(r||5)&&e[o].push(n),e}),{})}var on=["footer","searchBox"];function an(){return an=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},an.apply(this,arguments)}function cn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ln(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cn(Object(r),!0).forEach((function(t){un(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function un(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){c=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function mn(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function pn(e){var t=e.appId,r=e.apiKey,n=e.indexName,o=e.placeholder,i=void 0===o?"Search docs":o,a=e.searchParameters,c=e.maxResultsPerGroup,l=e.onClose,u=void 0===l?en:l,s=e.transformItems,f=void 0===s?tn:s,m=e.hitComponent,p=void 0===m?St:m,v=e.resultsFooterComponent,d=void 0===v?function(){return null}:v,y=e.navigator,h=e.initialScrollY,b=void 0===h?0:h,g=e.transformSearchClient,O=void 0===g?tn:g,S=e.disableUserPersonalization,j=void 0!==S&&S,w=e.initialQuery,E=void 0===w?"":w,P=e.translations,I=void 0===P?{}:P,D=e.getMissingResultsUrl,A=e.insights,k=void 0!==A&&A,x=I.footer,C=I.searchBox,N=mn(I,on),_=sn(yt.useState({query:"",collections:[],completion:null,context:{},isOpen:!1,activeItemId:null,status:"idle"}),2),T=_[0],q=_[1],R=yt.useRef(null),L=yt.useRef(null),M=yt.useRef(null),H=yt.useRef(null),F=yt.useRef(null),U=yt.useRef(10),B=yt.useRef("undefined"!=typeof window?window.getSelection().toString().slice(0,ht):"").current,V=yt.useRef(E||B).current,K=function(e,t,r){return yt.useMemo((function(){var n=Xr(e,t);return n.addAlgoliaAgent("docsearch",Yr),!1===/docsearch.js \(.*\)/.test(n.transporter.userAgent.value)&&n.addAlgoliaAgent("docsearch-react",Yr),r(n)}),[e,t,r])}(t,r,O),$=yt.useRef(br({key:"__DOCSEARCH_FAVORITE_SEARCHES__".concat(n),limit:10})).current,J=yt.useRef(br({key:"__DOCSEARCH_RECENT_SEARCHES__".concat(n),limit:0===$.getAll().length?7:4})).current,z=yt.useCallback((function(e){if(!j){var t="content"===e.type?e.__docsearch_parent:e;t&&-1===$.getAll().findIndex((function(e){return e.objectID===t.objectID}))&&J.add(t)}}),[$,J,j]),W=yt.useCallback((function(e){if(T.context.algoliaInsightsPlugin&&e.__autocomplete_id){var t=e,r={eventName:"Item Selected",index:t.__autocomplete_indexName,items:[t],positions:[e.__autocomplete_id],queryID:t.__autocomplete_queryID};T.context.algoliaInsightsPlugin.insights.clickedObjectIDsAfterSearch(r)}}),[T.context.algoliaInsightsPlugin]),Q=yt.useMemo((function(){return dt({id:"docsearch",defaultActiveItemId:0,placeholder:i,openOnFocus:!0,initialState:{query:V,context:{searchSuggestions:[]}},insights:k,navigator:y,onStateChange:function(e){q(e.state)},getSources:function(e){var o=e.query,i=e.state,l=e.setContext,s=e.setStatus;if(!o)return j?[]:[{sourceId:"recentSearches",onSelect:function(e){var t=e.item,r=e.event;z(t),rn(r)||u()},getItemUrl:function(e){return e.item.url},getItems:function(){return J.getAll()}},{sourceId:"favoriteSearches",onSelect:function(e){var t=e.item,r=e.event;z(t),rn(r)||u()},getItemUrl:function(e){return e.item.url},getItems:function(){return $.getAll()}}];var m=Boolean(k);return K.search([{query:o,indexName:n,params:ln({attributesToRetrieve:["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url"],attributesToSnippet:["hierarchy.lvl1:".concat(U.current),"hierarchy.lvl2:".concat(U.current),"hierarchy.lvl3:".concat(U.current),"hierarchy.lvl4:".concat(U.current),"hierarchy.lvl5:".concat(U.current),"hierarchy.lvl6:".concat(U.current),"content:".concat(U.current)],snippetEllipsisText:"\u2026",highlightPreTag:"<mark>",highlightPostTag:"</mark>",hitsPerPage:20,clickAnalytics:m},a)}]).catch((function(e){throw"RetryError"===e.name&&s("error"),e})).then((function(e){var o=e.results[0],a=o.hits,s=o.nbHits,p=nn(a,(function(e){return Qt(e)}),c);i.context.searchSuggestions.length<Object.keys(p).length&&l({searchSuggestions:Object.keys(p)}),l({nbHits:s});var v={};return m&&(v={__autocomplete_indexName:n,__autocomplete_queryID:o.queryID,__autocomplete_algoliaCredentials:{appId:t,apiKey:r}}),Object.values(p).map((function(e,t){return{sourceId:"hits".concat(t),onSelect:function(e){var t=e.item,r=e.event;z(t),rn(r)||u()},getItemUrl:function(e){return e.item.url},getItems:function(){return Object.values(nn(e,(function(e){return e.hierarchy.lvl1}),c)).map(f).map((function(e){return e.map((function(t){var r=null,n=e.find((function(e){return"lvl1"===e.type&&e.hierarchy.lvl1===t.hierarchy.lvl1}));return"lvl1"!==t.type&&n&&(r=n),ln(ln({},t),{},{__docsearch_parent:r},v)}))})).flat()}}}))}))}})}),[n,a,c,K,u,J,$,z,V,i,y,f,j,k,t,r]),Z=Q.getEnvironmentProps,G=Q.getRootProps,X=Q.refresh;return function(e){var t=e.getEnvironmentProps,r=e.panelElement,n=e.formElement,o=e.inputElement;yt.useEffect((function(){if(r&&n&&o){var e=t({panelElement:r,formElement:n,inputElement:o}),i=e.onTouchStart,a=e.onTouchMove;return window.addEventListener("touchstart",i),window.addEventListener("touchmove",a),function(){window.removeEventListener("touchstart",i),window.removeEventListener("touchmove",a)}}}),[t,r,n,o])}({getEnvironmentProps:Z,panelElement:H.current,formElement:M.current,inputElement:F.current}),function(e){var t=e.container;yt.useEffect((function(){if(t){var e=t.querySelectorAll("a[href]:not([disabled]), button:not([disabled]), input:not([disabled])"),r=e[0],n=e[e.length-1];return t.addEventListener("keydown",o),function(){t.removeEventListener("keydown",o)}}function o(e){"Tab"===e.key&&(e.shiftKey?document.activeElement===r&&(e.preventDefault(),n.focus()):document.activeElement===n&&(e.preventDefault(),r.focus()))}}),[t])}({container:R.current}),yt.useEffect((function(){return document.body.classList.add("DocSearch--active"),function(){var e,t;document.body.classList.remove("DocSearch--active"),null===(e=(t=window).scrollTo)||void 0===e||e.call(t,0,b)}}),[]),yt.useEffect((function(){window.matchMedia("(max-width: 768px)").matches&&(U.current=5)}),[]),yt.useEffect((function(){H.current&&(H.current.scrollTop=0)}),[T.query]),yt.useEffect((function(){V.length>0&&(X(),F.current&&F.current.focus())}),[V,X]),yt.useEffect((function(){function e(){if(L.current){var e=.01*window.innerHeight;L.current.style.setProperty("--docsearch-vh","".concat(e,"px"))}}return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),yt.createElement("div",an({ref:R},G({"aria-expanded":!0}),{className:["DocSearch","DocSearch-Container","stalled"===T.status&&"DocSearch-Container--Stalled","error"===T.status&&"DocSearch-Container--Errored"].filter(Boolean).join(" "),role:"button",tabIndex:0,onMouseDown:function(e){e.target===e.currentTarget&&u()}}),yt.createElement("div",{className:"DocSearch-Modal",ref:L},yt.createElement("header",{className:"DocSearch-SearchBar",ref:M},yt.createElement(vr,an({},Q,{state:T,autoFocus:0===V.length,inputRef:F,isFromSelection:Boolean(V)&&V===B,translations:C,onClose:u}))),yt.createElement("div",{className:"DocSearch-Dropdown",ref:H},yt.createElement(lr,an({},Q,{indexName:n,state:T,hitComponent:p,resultsFooterComponent:d,disableUserPersonalization:j,recentSearches:J,favoriteSearches:$,inputRef:F,translations:N,getMissingResultsUrl:D,onItemClick:function(e,t){W(e),z(e),rn(t)||u()}}))),yt.createElement("footer",{className:"DocSearch-Footer"},yt.createElement(Ot,{translations:x}))))}}}]); \ No newline at end of file diff --git a/assets/js/95451dd5.59f15bad.js b/assets/js/95451dd5.59f15bad.js new file mode 100644 index 0000000000..faf08c380f --- /dev/null +++ b/assets/js/95451dd5.59f15bad.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6201],{9584:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-14.4/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/processing.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/95451dd5.9ac91751.js b/assets/js/95451dd5.9ac91751.js deleted file mode 100644 index 16f3b4e616..0000000000 --- a/assets/js/95451dd5.9ac91751.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6201],{6174:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-14.4/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/processing.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9798ce17.33b4a4af.js b/assets/js/9798ce17.33b4a4af.js new file mode 100644 index 0000000000..fa6281a926 --- /dev/null +++ b/assets/js/9798ce17.33b4a4af.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6224],{9854:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-14.0/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/14.0/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/getting-started/presets.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.0/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/14.0/getting-started/options"}}');var r=n(4848),a=n(8453),o=n(1470),l=n(9365);const i={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"transform"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"transform"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { defaultTransformerOptions } = require('jest-preset-angular/presets');\n// const { defaultTransformerOptions } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),o=n(6347),l=n(205),i=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:r}),[g,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{j&&i(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=l[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:l.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>l});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9798ce17.9f5df379.js b/assets/js/9798ce17.9f5df379.js deleted file mode 100644 index 009352f9d6..0000000000 --- a/assets/js/9798ce17.9f5df379.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6224],{4668:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-14.0/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/14.0/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/getting-started/presets.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.0/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/14.0/getting-started/options"}}');var r=n(4848),a=n(8453),o=n(9489),l=n(7227);const i={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"transform"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"transform"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(l.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { defaultTransformerOptions } = require('jest-preset-angular/presets');\n// const { defaultTransformerOptions } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(l.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),o=n(6347),l=n(6494),i=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:r}),[g,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,l.A)((()=>{j&&i(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=i.indexOf(t),r=l[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:l.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>l});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9903dc99.4700933f.js b/assets/js/9903dc99.4700933f.js new file mode 100644 index 0000000000..ab3c56a6b2 --- /dev/null +++ b/assets/js/9903dc99.4700933f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5487],{96:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Currently, jest-preset-angular is partially compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy,","source":"@site/versioned_docs/version-8.x/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/8.x/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/angular-ivy.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/8.x/getting-started/test-environment"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/8.x/guides/esm-support"}}');var r=n(4848),a=n(8453);const i={id:"angular-ivy",title:"Angular Ivy"},o=void 0,l={},c=[];function u(e){const t={code:"code",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["Currently, ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," is partially compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy,\nyou must run ",(0,r.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,r.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," also provides util script to help you to run ",(0,r.jsx)(t.code,{children:"ngcc"})," with Jest but this script only works via the\nJavaScript version of Jest config"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nrequire('jest-preset-angular/ngcc-jest-processor');\n\nmodule.exports = {\n // [...]\n};\n"})})]})}function d(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function i(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9903dc99.85f43b2f.js b/assets/js/9903dc99.85f43b2f.js deleted file mode 100644 index 6c62d5c1d2..0000000000 --- a/assets/js/9903dc99.85f43b2f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5487],{1098:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Currently, jest-preset-angular is partially compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy,","source":"@site/versioned_docs/version-8.x/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/8.x/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/angular-ivy.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/8.x/getting-started/test-environment"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/8.x/guides/esm-support"}}');var r=n(4848),a=n(8453);const i={id:"angular-ivy",title:"Angular Ivy"},o=void 0,l={},c=[];function u(e){const t={code:"code",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["Currently, ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," is partially compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy,\nyou must run ",(0,r.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,r.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," also provides util script to help you to run ",(0,r.jsx)(t.code,{children:"ngcc"})," with Jest but this script only works via the\nJavaScript version of Jest config"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nrequire('jest-preset-angular/ngcc-jest-processor');\n\nmodule.exports = {\n // [...]\n};\n"})})]})}function d(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function i(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9a2fa73a.ee87693b.js b/assets/js/9a2fa73a.ee87693b.js new file mode 100644 index 0000000000..097463e7ca --- /dev/null +++ b/assets/js/9a2fa73a.ee87693b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8937],{4241:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-13.0/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/13.0/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/using-with-babel.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/13.0/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/13.0/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),u=n(1682),c=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function b(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=b({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{g&&i(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9a2fa73a.ef8612ec.js b/assets/js/9a2fa73a.ef8612ec.js deleted file mode 100644 index 6c8b4c4b1e..0000000000 --- a/assets/js/9a2fa73a.ef8612ec.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8937],{9465:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-13.0/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/13.0/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/using-with-babel.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/13.0/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/13.0/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),u=n(5167),c=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function b(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=b({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{g&&i(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9bc9e25c.8097de8a.js b/assets/js/9bc9e25c.8097de8a.js new file mode 100644 index 0000000000..0e20d14fc5 --- /dev/null +++ b/assets/js/9bc9e25c.8097de8a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[223],{8946:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-13.0/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/13.0/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/introduction.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/13.0/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9bc9e25c.c9f71c3d.js b/assets/js/9bc9e25c.c9f71c3d.js deleted file mode 100644 index dc50e7e258..0000000000 --- a/assets/js/9bc9e25c.c9f71c3d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[223],{6551:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-13.0/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/13.0/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/introduction.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/13.0/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9d48492b.b8c10d9a.js b/assets/js/9d48492b.b8c10d9a.js deleted file mode 100644 index 3c241490fc..0000000000 --- a/assets/js/9d48492b.b8c10d9a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3737],{4243:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.js,","source":"@site/versioned_docs/version-14.0/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/14.0/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/getting-started/test-environment.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/14.0/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.0/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,l={},d=[{value:"Configure test environment",id:"configure-test-environment",level:3}];function c(e){const t={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.js",children:(0,r.jsx)(t.code,{children:"setup-jest.js"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/angular/angular/tree/main/packages/zone.js",children:"Angular zone patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]}),"\n",(0,r.jsxs)(t.p,{children:["While ",(0,r.jsx)(t.code,{children:"setup-jest.js"})," above is for running Jest with ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode, we also provide ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.mjs",children:(0,r.jsx)(t.code,{children:"setup-jest.mjs"})}),"\nto run with ",(0,r.jsx)(t.strong,{children:"ESM"})," mode."]}),"\n",(0,r.jsx)(t.h3,{id:"configure-test-environment",children:"Configure test environment"}),"\n",(0,r.jsxs)(t.p,{children:["When creating Angular test environment with ",(0,r.jsx)(t.code,{children:"TestBed"}),", it is possible to specify the ",(0,r.jsx)(t.code,{children:"testEnvironmentOptions"})," via ",(0,r.jsx)(t.code,{children:"globalThis"})," in the Jest setup file.\nFor example:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-test.ts\nglobalThis.ngJest = {\n testEnvironmentOptions: {\n teardown: {\n destroyAfterEach: false,\n rethrowErrors: true,\n },\n errorOnUnknownElements: true,\n errorOnUnknownProperties: true,\n },\n};\n\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," will look at ",(0,r.jsx)(t.code,{children:"globalThis.ngJest"})," and pass the correct ",(0,r.jsx)(t.a,{href:"https://angular.dev/api/core/testing/TestEnvironmentOptions",children:(0,r.jsx)(t.code,{children:"TestEnvironmentOptions"})})," object to ",(0,r.jsx)(t.code,{children:"TestBed"}),"."]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9d48492b.d956ac2e.js b/assets/js/9d48492b.d956ac2e.js new file mode 100644 index 0000000000..ac3b973dc5 --- /dev/null +++ b/assets/js/9d48492b.d956ac2e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3737],{5452:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.js,","source":"@site/versioned_docs/version-14.0/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/14.0/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/getting-started/test-environment.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/14.0/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.0/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,l={},d=[{value:"Configure test environment",id:"configure-test-environment",level:3}];function c(e){const t={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.js",children:(0,r.jsx)(t.code,{children:"setup-jest.js"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/angular/angular/tree/main/packages/zone.js",children:"Angular zone patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]}),"\n",(0,r.jsxs)(t.p,{children:["While ",(0,r.jsx)(t.code,{children:"setup-jest.js"})," above is for running Jest with ",(0,r.jsx)(t.strong,{children:"CommonJS"})," mode, we also provide ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/setup-jest.mjs",children:(0,r.jsx)(t.code,{children:"setup-jest.mjs"})}),"\nto run with ",(0,r.jsx)(t.strong,{children:"ESM"})," mode."]}),"\n",(0,r.jsx)(t.h3,{id:"configure-test-environment",children:"Configure test environment"}),"\n",(0,r.jsxs)(t.p,{children:["When creating Angular test environment with ",(0,r.jsx)(t.code,{children:"TestBed"}),", it is possible to specify the ",(0,r.jsx)(t.code,{children:"testEnvironmentOptions"})," via ",(0,r.jsx)(t.code,{children:"globalThis"})," in the Jest setup file.\nFor example:"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// setup-test.ts\nglobalThis.ngJest = {\n testEnvironmentOptions: {\n teardown: {\n destroyAfterEach: false,\n rethrowErrors: true,\n },\n errorOnUnknownElements: true,\n errorOnUnknownProperties: true,\n },\n};\n\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," will look at ",(0,r.jsx)(t.code,{children:"globalThis.ngJest"})," and pass the correct ",(0,r.jsx)(t.a,{href:"https://angular.dev/api/core/testing/TestEnvironmentOptions",children:(0,r.jsx)(t.code,{children:"TestEnvironmentOptions"})})," object to ",(0,r.jsx)(t.code,{children:"TestBed"}),"."]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9fc1d339.037448cd.js b/assets/js/9fc1d339.037448cd.js new file mode 100644 index 0000000000..5b7c22ffb7 --- /dev/null +++ b/assets/js/9fc1d339.037448cd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8201],{1223:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-11.1/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/11.1/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/troubleshooting.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/11.1/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9fc1d339.231cb785.js b/assets/js/9fc1d339.231cb785.js deleted file mode 100644 index ee70de229e..0000000000 --- a/assets/js/9fc1d339.231cb785.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8201],{4772:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-11.1/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/11.1/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/troubleshooting.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/11.1/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a05464cd.b42f96f6.js b/assets/js/a05464cd.859016ea.js similarity index 94% rename from assets/js/a05464cd.b42f96f6.js rename to assets/js/a05464cd.859016ea.js index a4eba742c5..3692103b56 100644 --- a/assets/js/a05464cd.b42f96f6.js +++ b/assets/js/a05464cd.859016ea.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1832],{94:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>g,frontMatter:()=>p,metadata:()=>s,toc:()=>h});const s=JSON.parse('{"id":"guides/snapshot-testing","title":"Snapshot testing","description":"jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.","source":"@site/versioned_docs/version-14.4/guides/snapshot-testing.md","sourceDirName":"guides","slug":"/guides/snapshot-testing","permalink":"/jest-preset-angular/docs/guides/snapshot-testing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/snapshot-testing.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"snapshot-testing","title":"Snapshot testing"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/guides/jsdom-version"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/guides/using-with-babel"}}');var i=t(4848),r=t(8453),l=t(9489),a=t(7227),o=t(1574);const p={id:"snapshot-testing",title:"Snapshot testing"},c=void 0,d={},h=[{value:"Snapshot serializers",id:"snapshot-serializers",level:2},{value:"Remove html comments (<code>html-comment</code>)",id:"remove-html-comments-html-comment",level:3},{value:"Examples:",id:"examples",level:4},{value:"Display component HTML (<code>ng-snapshot</code>)",id:"display-component-html-ng-snapshot",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Examples:",id:"examples-1",level:4},{value:"With options",id:"with-options",level:4},{value:"Remove Angular attributes (<code>no-ng-attributes</code>)",id:"remove-angular-attributes-no-ng-attributes",level:3},{value:"Examples:",id:"examples-2",level:4}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"jest-preset-angular"})," provides several snapshot serializers to generate clearer and more human-readable snapshot."]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"BY DEFAULT"}),", the ",(0,i.jsx)(n.a,{href:"/jest-preset-angular/docs/getting-started/presets",children:"preset"})," provides all of the snapshot serializers below."]})}),"\n",(0,i.jsx)(n.h2,{id:"snapshot-serializers",children:"Snapshot serializers"}),"\n","\n",(0,i.jsx)(o.A,{toc:h.slice(1)}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsxs)(n.h3,{id:"remove-html-comments-html-comment",children:["Remove html comments (",(0,i.jsx)(n.code,{children:"html-comment"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow removing all the comments in the component HTML in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"examples",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"display-component-html-ng-snapshot",children:["Display component HTML (",(0,i.jsx)(n.code,{children:"ng-snapshot"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow displaying component HTML with data in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["options(",(0,i.jsx)(n.strong,{children:"optional"}),"):","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"omitAllCompAttrs: remove all component DOM attributes"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type NgSnapshotOptions = {\n omitAllCompAttrs?: boolean;\n};\n"})}),"\n",(0,i.jsx)(n.h4,{id:"examples-1",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsx)(n.h4,{id:"with-options",children:"With options"}),"\n",(0,i.jsxs)(n.admonition,{title:"Effective priority",type:"info",children:[(0,i.jsx)(n.p,{children:"The configured serializers will have affect in this order:"}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Jest config"})," -> ",(0,i.jsx)(n.code,{children:"setup files"})," -> ",(0,i.jsx)(n.code,{children:"test files"})]}),(0,i.jsx)(n.p,{children:"The later the higher priority. This means that with the same serializer, the later one will override the configuration\nof the previous one in the chain."})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In setup files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"or in individual test files:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"remove-angular-attributes-no-ng-attributes",children:["Remove Angular attributes (",(0,i.jsx)(n.code,{children:"no-ng-attributes"}),")"]}),"\n",(0,i.jsxs)(n.p,{children:["Allow removing attributes generated by Angular fixture, like ",(0,i.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,i.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,i.jsx)(n.code,{children:"_ngcontent-c*"})," etc., from component snapshot"]}),"\n",(0,i.jsx)(n.h4,{id:"examples-2",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})]})}function g(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1832],{4121:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>g,frontMatter:()=>p,metadata:()=>s,toc:()=>h});const s=JSON.parse('{"id":"guides/snapshot-testing","title":"Snapshot testing","description":"jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.","source":"@site/versioned_docs/version-14.4/guides/snapshot-testing.md","sourceDirName":"guides","slug":"/guides/snapshot-testing","permalink":"/jest-preset-angular/docs/guides/snapshot-testing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/snapshot-testing.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"snapshot-testing","title":"Snapshot testing"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/guides/jsdom-version"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/guides/using-with-babel"}}');var i=t(4848),r=t(8453),l=t(1470),a=t(9365),o=t(4252);const p={id:"snapshot-testing",title:"Snapshot testing"},c=void 0,d={},h=[{value:"Snapshot serializers",id:"snapshot-serializers",level:2},{value:"Remove html comments (<code>html-comment</code>)",id:"remove-html-comments-html-comment",level:3},{value:"Examples:",id:"examples",level:4},{value:"Display component HTML (<code>ng-snapshot</code>)",id:"display-component-html-ng-snapshot",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Examples:",id:"examples-1",level:4},{value:"With options",id:"with-options",level:4},{value:"Remove Angular attributes (<code>no-ng-attributes</code>)",id:"remove-angular-attributes-no-ng-attributes",level:3},{value:"Examples:",id:"examples-2",level:4}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"jest-preset-angular"})," provides several snapshot serializers to generate clearer and more human-readable snapshot."]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"BY DEFAULT"}),", the ",(0,i.jsx)(n.a,{href:"/jest-preset-angular/docs/getting-started/presets",children:"preset"})," provides all of the snapshot serializers below."]})}),"\n",(0,i.jsx)(n.h2,{id:"snapshot-serializers",children:"Snapshot serializers"}),"\n","\n",(0,i.jsx)(o.A,{toc:h.slice(1)}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsxs)(n.h3,{id:"remove-html-comments-html-comment",children:["Remove html comments (",(0,i.jsx)(n.code,{children:"html-comment"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow removing all the comments in the component HTML in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"examples",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/html-comment'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeHtmlCommentsSerializer from 'jest-preset-angular/build/serializers/html-comment';\n\nexpect.addSnapshotSerializer(removeHtmlCommentsSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"display-component-html-ng-snapshot",children:["Display component HTML (",(0,i.jsx)(n.code,{children:"ng-snapshot"}),")"]}),"\n",(0,i.jsx)(n.p,{children:"Allow displaying component HTML with data in snapshot."}),"\n",(0,i.jsx)(n.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["options(",(0,i.jsx)(n.strong,{children:"optional"}),"):","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"omitAllCompAttrs: remove all component DOM attributes"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type NgSnapshotOptions = {\n omitAllCompAttrs?: boolean;\n};\n"})}),"\n",(0,i.jsx)(n.h4,{id:"examples-1",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/ng-snapshot'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer(componentSnapshotSerializer);\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsx)(n.h4,{id:"with-options",children:"With options"}),"\n",(0,i.jsxs)(n.admonition,{title:"Effective priority",type:"info",children:[(0,i.jsx)(n.p,{children:"The configured serializers will have affect in this order:"}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Jest config"})," -> ",(0,i.jsx)(n.code,{children:"setup files"})," -> ",(0,i.jsx)(n.code,{children:"test files"})]}),(0,i.jsx)(n.p,{children:"The later the higher priority. This means that with the same serializer, the later one will override the configuration\nof the previous one in the chain."})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In setup files:"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"or in individual test files:"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import componentSnapshotSerializer from 'jest-preset-angular/build/serializers/ng-snapshot';\n\nexpect.addSnapshotSerializer({\n print: (val, print, indent, options, colors) =>\n componentSnapshotSerializer.print(\n val,\n print,\n indent,\n {\n ...options,\n omitAllCompAttrs: true,\n },\n colors,\n ),\n test: componentSnapshotSerializer.test,\n});\n\nit('should work', () => {\n //[...]\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"remove-angular-attributes-no-ng-attributes",children:["Remove Angular attributes (",(0,i.jsx)(n.code,{children:"no-ng-attributes"}),")"]}),"\n",(0,i.jsxs)(n.p,{children:["Allow removing attributes generated by Angular fixture, like ",(0,i.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,i.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,i.jsx)(n.code,{children:"_ngcontent-c*"})," etc., from component snapshot"]}),"\n",(0,i.jsx)(n.h4,{id:"examples-2",children:"Examples:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"In Jest config"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n snapshotSerializers: ['jest-preset-angular/build/serializers/no-ng-attributes'],\n //[...]\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in setup test environment file"}),"\n"]}),"\n",(0,i.jsxs)(l.A,{groupId:"code-examples",children:[(0,i.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})}),(0,i.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //[...]\n setupFilesAfterEnv: ['./setup-jest.ts'],\n //[...]\n};\n"})})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Or in individual test files"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",metastring:'title="foo.component.spec.ts"',children:"import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';\n\nexpect.addSnapshotSerializer(removeNgAttributes);\n\nit('should work', () => {\n //[...]\n});\n"})})]})}function g(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}}}]); \ No newline at end of file diff --git a/assets/js/a09c2993.1d3055e0.js b/assets/js/a09c2993.1d3055e0.js deleted file mode 100644 index fb0cc99010..0000000000 --- a/assets/js/a09c2993.1d3055e0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5899],{4778:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/docs/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/next/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/introduction.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/next/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(t){const e={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...t.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e.p,{children:[(0,o.jsx)(e.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(e.p,{children:["This is a part of the article: ",(0,o.jsx)(e.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(e.admonition,{type:"important",children:(0,o.jsxs)(e.p,{children:["Starting from ",(0,o.jsx)(e.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(e.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(e.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(t={}){const{wrapper:e}={...(0,r.R)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(l,{...t})}):l(t)}},8453:(t,e,n)=>{n.d(e,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(t){const e=s.useContext(r);return s.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function c(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(o):t.components||o:i(t.components),s.createElement(r.Provider,{value:e},t.children)}}}]); \ No newline at end of file diff --git a/assets/js/a09c2993.812a7242.js b/assets/js/a09c2993.812a7242.js new file mode 100644 index 0000000000..9df619ea66 --- /dev/null +++ b/assets/js/a09c2993.812a7242.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5899],{1920:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/docs/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/next/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/introduction.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/next/processing"}}');var r=n(4848),o=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(t){const e={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,o.R)(),...t.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(e.p,{children:[(0,r.jsx)(e.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,r.jsxs)(e.p,{children:["This is a part of the article: ",(0,r.jsx)(e.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,r.jsx)(e.admonition,{type:"important",children:(0,r.jsxs)(e.p,{children:["Starting from ",(0,r.jsx)(e.strong,{children:"v9.0.0"}),", we follow closely native ",(0,r.jsx)(e.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,r.jsx)(e.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(t={}){const{wrapper:e}={...(0,o.R)(),...t.components};return e?(0,r.jsx)(e,{...t,children:(0,r.jsx)(l,{...t})}):l(t)}},8453:(t,e,n)=>{n.d(e,{R:()=>i,x:()=>c});var s=n(6540);const r={},o=s.createContext(r);function i(t){const e=s.useContext(o);return s.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function c(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(r):t.components||r:i(t.components),s.createElement(o.Provider,{value:e},t.children)}}}]); \ No newline at end of file diff --git a/assets/js/a389e28e.c7e40c39.js b/assets/js/a389e28e.c7e40c39.js new file mode 100644 index 0000000000..0f2ab9c008 --- /dev/null +++ b/assets/js/a389e28e.c7e40c39.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7554],{8827:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-12.0/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/12.0/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/esm-support.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/12.0/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/12.0/guides/jsdom-version"}}');var r=s(4848),a=s(8453),o=s(1470),i=s(9365);const l={id:"esm-support",title:"ESM Support"},u=void 0,c={},d=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/12.0/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsxs)(t.p,{children:["Besides, there is ",(0,r.jsx)(t.code,{children:"setup-jest.mjs"})," to add to Jest setup file to ensure that Jest can set up test environment properly."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},1470:(e,t,s)=>{s.d(t,{A:()=>S});var n=s(6540),r=s(4164),a=s(3104),o=s(6347),i=s(205),l=s(7485),u=s(1682),c=s(679);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,l.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[u,d]=m({queryString:s,groupId:r}),[f,g]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),j=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=s(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,s=l.indexOf(t),r=i[s].value;r!==n&&(u(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;t=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;t=l[s]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:i.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>i});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a389e28e.d95c09f9.js b/assets/js/a389e28e.d95c09f9.js deleted file mode 100644 index 885b78c206..0000000000 --- a/assets/js/a389e28e.d95c09f9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7554],{7585:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-12.0/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/12.0/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/esm-support.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/12.0/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/12.0/guides/jsdom-version"}}');var r=s(4848),a=s(8453),o=s(9489),i=s(7227);const l={id:"esm-support",title:"ESM Support"},u=void 0,c={},d=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/12.0/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsxs)(t.p,{children:["Besides, there is ",(0,r.jsx)(t.code,{children:"setup-jest.mjs"})," to add to Jest setup file to ensure that Jest can set up test environment properly."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},9489:(e,t,s)=>{s.d(t,{A:()=>S});var n=s(6540),r=s(4164),a=s(4245),o=s(6347),i=s(6494),l=s(2814),u=s(5167),c=s(9900);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,l.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[u,d]=m({queryString:s,groupId:r}),[f,g]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),j=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=s(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,s=l.indexOf(t),r=i[s].value;r!==n&&(u(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;t=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;t=l[s]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:i.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>i});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a74b641e.088cd730.js b/assets/js/a74b641e.088cd730.js new file mode 100644 index 0000000000..5552ebc724 --- /dev/null +++ b/assets/js/a74b641e.088cd730.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1841],{6092:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-9.x/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/9.x/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/absolute-imports.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/9.x/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/9.x/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a74b641e.c778c318.js b/assets/js/a74b641e.c778c318.js deleted file mode 100644 index 62444e065c..0000000000 --- a/assets/js/a74b641e.c778c318.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1841],{8721:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-9.x/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/9.x/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/absolute-imports.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/9.x/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/9.x/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a7bd4aaa.f0be55e8.js b/assets/js/a7bd4aaa.95046d7a.js similarity index 81% rename from assets/js/a7bd4aaa.f0be55e8.js rename to assets/js/a7bd4aaa.95046d7a.js index dfbdd05390..3bf23b1965 100644 --- a/assets/js/a7bd4aaa.f0be55e8.js +++ b/assets/js/a7bd4aaa.95046d7a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7098],{2881:(e,n,s)=>{s.r(n),s.d(n,{default:()=>x});s(6540);var r=s(4239),t=s(3718),o=s(1704),i=s(2831),c=s(1210),u=s(4848);function a(e){const{version:n}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c.A,{version:n.version,tag:(0,t.k)(n.pluginId,n.version)}),(0,u.jsx)(r.be,{children:n.noIndex&&(0,u.jsx)("meta",{name:"robots",content:"noindex, nofollow"})})]})}function l(e){const{version:n,route:s}=e;return(0,u.jsx)(r.e3,{className:n.className,children:(0,u.jsx)(o.n,{version:n,children:(0,i.v)(s.routes)})})}function x(e){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a,{...e}),(0,u.jsx)(l,{...e})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7098],{4532:(e,n,s)=>{s.r(n),s.d(n,{default:()=>x});s(6540);var r=s(9024),t=s(2565),o=s(3025),i=s(2831),c=s(1463),u=s(4848);function a(e){const{version:n}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c.A,{version:n.version,tag:(0,t.k)(n.pluginId,n.version)}),(0,u.jsx)(r.be,{children:n.noIndex&&(0,u.jsx)("meta",{name:"robots",content:"noindex, nofollow"})})]})}function l(e){const{version:n,route:s}=e;return(0,u.jsx)(r.e3,{className:n.className,children:(0,u.jsx)(o.n,{version:n,children:(0,i.v)(s.routes)})})}function x(e){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a,{...e}),(0,u.jsx)(l,{...e})]})}}}]); \ No newline at end of file diff --git a/assets/js/a7d04da7.18bdb0d0.js b/assets/js/a7d04da7.18bdb0d0.js new file mode 100644 index 0000000000..808f7e5801 --- /dev/null +++ b/assets/js/a7d04da7.18bdb0d0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2363],{7080:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-14.4/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/troubleshooting.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/guides/absolute-imports"}}');var r=t(4848),a=t(8453),o=t(1470),i=t(9365);const l={id:"troubleshooting",title:"Troubleshooting"},c=void 0,d={},u=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function h(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:["You can check Jest ",(0,r.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,r.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,r.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,r.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,r.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,r.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,r.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,r.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title="tsconfig.spec.json"',children:'{\n "compilerOptions": {\n "emitDecoratorMetadata": true\n }\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["In general, this is related to ",(0,r.jsx)(n.code,{children:"Angular"}),"'s reflection and also depends on a reflection library, as e. g. included in ",(0,r.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy ",(0,r.jsx)(n.code,{children:"Angular"}),"'s current requirements, but in case these change, you can install ",(0,r.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import 'core-js/es/reflect';\nimport 'core-js/proposals/reflect-metadata';\n"})}),"\n",(0,r.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,r.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,r.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,r.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,r.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,r.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="some.component.spec.ts"',children:"beforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,r.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,r.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,r.jsx)(n.p,{children:"Add this to your global mock file"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,r.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,r.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,r.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,r.jsx)(n.code,{children:"JS"})," file with ",(0,r.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,r.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,r.jsx)(n.code,{children:"@angular"}),", ",(0,r.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,r.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,r.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,r.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,r.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,r.jsx)(n.p,{children:"or"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,r.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,r.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,r.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,r.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Install ",(0,r.jsx)(n.code,{children:"babel-jest"}),", ",(0,r.jsx)(n.code,{children:"@babel/core"})," and ",(0,r.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,r.jsxs)(n.li,{children:["Create a ",(0,r.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,r.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title=".babelrc"',children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Define the usage of ",(0,r.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,r.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,r.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,r.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,r.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,r.jsx)(n.code,{children:"firebase"})," and ",(0,r.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,r.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,r.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,r.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,r.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,r.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,r.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,r.jsxs)(n.p,{children:["In these cases, a ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,r.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,r.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,r.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.resolver.ts"',children:"import type { SyncResolver } from 'jest-resolve';\n\nconst myResolver: SyncResolver = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n\nexport = myResolver;\n"})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '<rootDir>/src/jest.resolver.ts',\n //...\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '<rootDir>/src/jest.resolver.js',\n //...\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,r.jsxs)(n.p,{children:["Please use Angular ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function p(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},9365:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),a=t(3104),o=t(6347),i=t(205),l=t(7485),c=t(1682),d=t(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function g(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=h(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,u]=m({queryString:t,groupId:r}),[g,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??g;return p({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),f(e)}),[u,f,a]),tabValues:a}}var f=t(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=t(4848);function x(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...n,...e}),(0,b.jsx)(v,{...n,...e})]})}function w(e){const n=(0,f.A)();return(0,b.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a7d04da7.92ad4b1c.js b/assets/js/a7d04da7.92ad4b1c.js deleted file mode 100644 index 4147082f71..0000000000 --- a/assets/js/a7d04da7.92ad4b1c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2363],{6932:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-14.4/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/troubleshooting.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/guides/absolute-imports"}}');var r=t(4848),a=t(8453),o=t(9489),i=t(7227);const l={id:"troubleshooting",title:"Troubleshooting"},c=void 0,d={},u=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function p(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:["You can check Jest ",(0,r.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,r.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,r.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,r.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,r.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,r.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,r.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,r.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title="tsconfig.spec.json"',children:'{\n "compilerOptions": {\n "emitDecoratorMetadata": true\n }\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["In general, this is related to ",(0,r.jsx)(n.code,{children:"Angular"}),"'s reflection and also depends on a reflection library, as e. g. included in ",(0,r.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy ",(0,r.jsx)(n.code,{children:"Angular"}),"'s current requirements, but in case these change, you can install ",(0,r.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import 'core-js/es/reflect';\nimport 'core-js/proposals/reflect-metadata';\n"})}),"\n",(0,r.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,r.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,r.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,r.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,r.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,r.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,r.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="some.component.spec.ts"',children:"beforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,r.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,r.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,r.jsx)(n.p,{children:"Add this to your global mock file"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,r.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,r.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,r.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,r.jsx)(n.code,{children:"JS"})," file with ",(0,r.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,r.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,r.jsx)(n.code,{children:"@angular"}),", ",(0,r.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,r.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,r.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,r.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,r.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,r.jsx)(n.p,{children:"or"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,r.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,r.jsxs)(n.p,{children:["Reference: ",(0,r.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,r.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,r.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,r.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Install ",(0,r.jsx)(n.code,{children:"babel-jest"}),", ",(0,r.jsx)(n.code,{children:"@babel/core"})," and ",(0,r.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,r.jsxs)(n.li,{children:["Create a ",(0,r.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,r.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'title=".babelrc"',children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Define the usage of ",(0,r.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,r.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n //...\n babelConfig: true,\n //...\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,r.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,r.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,r.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,r.jsx)(n.code,{children:"firebase"})," and ",(0,r.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,r.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,r.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,r.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,r.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,r.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,r.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,r.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,r.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,r.jsxs)(n.p,{children:["In these cases, a ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,r.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,r.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,r.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.resolver.ts"',children:"import type { SyncResolver } from 'jest-resolve';\n\nconst myResolver: SyncResolver = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n\nexport = myResolver;\n"})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '<rootDir>/src/jest.resolver.ts',\n //...\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n resolver: '<rootDir>/src/jest.resolver.js',\n //...\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,r.jsxs)(n.p,{children:["Please use Angular ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,r.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),a=t(4245),o=t(6347),i=t(6494),l=t(2814),c=t(5167),d=t(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function h(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function g(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!h({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,u]=m({queryString:t,groupId:r}),[g,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),f(e)}),[u,f,a]),tabValues:a}}var f=t(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=t(4848);function x(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>l.push(e),onKeyDown:u,onClick:d,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...n,...e}),(0,b.jsx)(v,{...n,...e})]})}function w(e){const n=(0,f.A)();return(0,b.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a7d61b99.269f525c.js b/assets/js/a7d61b99.269f525c.js new file mode 100644 index 0000000000..7171663279 --- /dev/null +++ b/assets/js/a7d61b99.269f525c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2766],{3011:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-12.0/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/12.0/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/jsdom-version.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/12.0/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/12.0/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a7d61b99.d79ff599.js b/assets/js/a7d61b99.d79ff599.js deleted file mode 100644 index 2a62cdd5ca..0000000000 --- a/assets/js/a7d61b99.d79ff599.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2766],{9776:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-12.0/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/12.0/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/jsdom-version.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/12.0/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/12.0/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a89007e0.5198d775.js b/assets/js/a89007e0.5198d775.js new file mode 100644 index 0000000000..768c4d4802 --- /dev/null +++ b/assets/js/a89007e0.5198d775.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3767],{5858:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>l,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-14.2/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/14.2/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/angular-13+.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.2/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.2/guides/esm-support"}}');var r=s(4848),a=s(8453),o=s(1470),i=s(9365);const l={id:"angular-13+",title:"Angular >=13"},u=void 0,c={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/14.2/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,r.jsxs)(n.p,{children:["Your ",(0,r.jsx)(n.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(n.p,{children:"or for ESM mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,n,s)=>{s.d(n,{A:()=>o});s(6540);var t=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:n,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,t.A)(r.tabItem,o),hidden:s,children:n})}},1470:(e,n,s)=>{s.d(n,{A:()=>A});var t=s(6540),r=s(4164),a=s(3104),o=s(6347),i=s(205),l=s(7485),u=s(1682),c=s(679);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,s])}function g(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function h(e){let{queryString:n=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,l.aZ)(a),(0,t.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:a}))),[u,d]=h({queryString:s,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,c.Dv)(s);return[r,(0,t.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),f=(()=>{const e=u??m;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,t.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:n,block:s,selectedValue:t,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const n=e.currentTarget,s=l.indexOf(n),r=i[s].value;r!==t&&(u(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;n=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;n=l[s]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},n),children:i.map((e=>{let{value:n,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,t.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function w(e){const n=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function A(e){const n=(0,j.A)();return(0,x.jsx)(w,{...e,children:d(e.children)},String(n))}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a89007e0.e6910c63.js b/assets/js/a89007e0.e6910c63.js deleted file mode 100644 index 51067756fe..0000000000 --- a/assets/js/a89007e0.e6910c63.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3767],{4918:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>u,default:()=>g,frontMatter:()=>l,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-14.2/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/14.2/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/angular-13+.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/14.2/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/14.2/guides/esm-support"}}');var r=s(4848),a=s(8453),o=s(9489),i=s(7227);const l={id:"angular-13+",title:"Angular >=13"},u=void 0,c={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/14.2/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,r.jsxs)(n.p,{children:["Your ",(0,r.jsx)(n.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\n"})}),"\n",(0,r.jsx)(n.p,{children:"or for ESM mode"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,n,s)=>{s.d(n,{A:()=>o});s(6540);var t=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:n,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,t.A)(r.tabItem,o),hidden:s,children:n})}},9489:(e,n,s)=>{s.d(n,{A:()=>A});var t=s(6540),r=s(4164),a=s(4245),o=s(6347),i=s(6494),l=s(2814),u=s(5167),c=s(9900);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,u.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,s])}function g(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function h(e){let{queryString:n=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,l.aZ)(a),(0,t.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:a}))),[u,d]=h({queryString:s,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,c.Dv)(s);return[r,(0,t.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),f=(()=>{const e=u??m;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,t.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=s(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:n,block:s,selectedValue:t,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const n=e.currentTarget,s=l.indexOf(n),r=i[s].value;r!==t&&(u(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;n=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;n=l[s]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},n),children:i.map((e=>{let{value:n,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>l.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,t.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function w(e){const n=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function A(e){const n=(0,j.A)();return(0,x.jsx)(w,{...e,children:d(e.children)},String(n))}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a94703ab.5a426d96.js b/assets/js/a94703ab.5a426d96.js deleted file mode 100644 index fb856e220e..0000000000 --- a/assets/js/a94703ab.5a426d96.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9048],{8001:(e,t,n)=>{n.r(t),n.d(t,{default:()=>be});var a=n(6540),o=n(4164),i=n(4239),s=n(8630),l=n(5357),r=n(40),c=n(3230),d=n(4245),u=n(4067);const m={backToTopButton:"backToTopButton_sjWU",backToTopButtonShow:"backToTopButtonShow_xfvO"};var b=n(4848);function h(){const{shown:e,scrollToTop:t}=function(e){let{threshold:t}=e;const[n,o]=(0,a.useState)(!1),i=(0,a.useRef)(!1),{startScroll:s,cancelScroll:l}=(0,d.gk)();return(0,d.Mq)(((e,n)=>{let{scrollY:a}=e;const s=n?.scrollY;s&&(i.current?i.current=!1:a>=s?(l(),o(!1)):a<t?o(!1):a+window.innerHeight<document.documentElement.scrollHeight&&o(!0))})),(0,u.$)((e=>{e.location.hash&&(i.current=!0,o(!1))})),{shown:n,scrollToTop:()=>s(0)}}({threshold:300});return(0,b.jsx)("button",{"aria-label":(0,c.T)({id:"theme.BackToTopButton.buttonAriaLabel",message:"Scroll back to top",description:"The ARIA label for the back to top button"}),className:(0,o.A)("clean-btn",s.G.common.backToTopButton,m.backToTopButton,e&&m.backToTopButtonShow),type:"button",onClick:t})}var p=n(6350),x=n(6347),f=n(2216),j=n(6957),v=n(20);function _(e){return(0,b.jsx)("svg",{width:"20",height:"20","aria-hidden":"true",...e,children:(0,b.jsxs)("g",{fill:"#7a7a7a",children:[(0,b.jsx)("path",{d:"M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"}),(0,b.jsx)("path",{d:"M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"})]})})}const A={collapseSidebarButton:"collapseSidebarButton_PEFL",collapseSidebarButtonIcon:"collapseSidebarButtonIcon_kv0_"};function g(e){let{onClick:t}=e;return(0,b.jsx)("button",{type:"button",title:(0,c.T)({id:"theme.docs.sidebar.collapseButtonTitle",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),"aria-label":(0,c.T)({id:"theme.docs.sidebar.collapseButtonAriaLabel",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),className:(0,o.A)("button button--secondary button--outline",A.collapseSidebarButton),onClick:t,children:(0,b.jsx)(_,{className:A.collapseSidebarButtonIcon})})}var k=n(2),C=n(4799);const S=Symbol("EmptyContext"),T=a.createContext(S);function N(e){let{children:t}=e;const[n,o]=(0,a.useState)(null),i=(0,a.useMemo)((()=>({expandedItem:n,setExpandedItem:o})),[n]);return(0,b.jsx)(T.Provider,{value:i,children:t})}var I=n(4549),B=n(260),y=n(4783),w=n(1062);function L(e){let{collapsed:t,categoryLabel:n,onClick:a}=e;return(0,b.jsx)("button",{"aria-label":t?(0,c.T)({id:"theme.DocSidebarItem.expandCategoryAriaLabel",message:"Expand sidebar category '{label}'",description:"The ARIA label to expand the sidebar category"},{label:n}):(0,c.T)({id:"theme.DocSidebarItem.collapseCategoryAriaLabel",message:"Collapse sidebar category '{label}'",description:"The ARIA label to collapse the sidebar category"},{label:n}),"aria-expanded":!t,type:"button",className:"clean-btn menu__caret",onClick:a})}function E(e){let{item:t,onItemClick:n,activePath:i,level:r,index:c,...d}=e;const{items:u,label:m,collapsible:h,className:p,href:x}=t,{docs:{sidebar:{autoCollapseCategories:f}}}=(0,j.p)(),v=function(e){const t=(0,w.A)();return(0,a.useMemo)((()=>e.href&&!e.linkUnlisted?e.href:!t&&e.collapsible?(0,l.Nr)(e):void 0),[e,t])}(t),_=(0,l.w8)(t,i),A=(0,B.ys)(x,i),{collapsed:g,setCollapsed:k}=(0,I.u)({initialState:()=>!!h&&(!_&&t.collapsed)}),{expandedItem:N,setExpandedItem:E}=function(){const e=(0,a.useContext)(T);if(e===S)throw new C.dV("DocSidebarItemsExpandedStateProvider");return e}(),M=function(e){void 0===e&&(e=!g),E(e?null:c),k(e)};return function(e){let{isActive:t,collapsed:n,updateCollapsed:o}=e;const i=(0,C.ZC)(t);(0,a.useEffect)((()=>{t&&!i&&n&&o(!1)}),[t,i,n,o])}({isActive:_,collapsed:g,updateCollapsed:M}),(0,a.useEffect)((()=>{h&&null!=N&&N!==c&&f&&k(!0)}),[h,N,c,k,f]),(0,b.jsxs)("li",{className:(0,o.A)(s.G.docs.docSidebarItemCategory,s.G.docs.docSidebarItemCategoryLevel(r),"menu__list-item",{"menu__list-item--collapsed":g},p),children:[(0,b.jsxs)("div",{className:(0,o.A)("menu__list-item-collapsible",{"menu__list-item-collapsible--active":A}),children:[(0,b.jsx)(y.A,{className:(0,o.A)("menu__link",{"menu__link--sublist":h,"menu__link--sublist-caret":!x&&h,"menu__link--active":_}),onClick:h?e=>{n?.(t),x?M(!1):(e.preventDefault(),M())}:()=>{n?.(t)},"aria-current":A?"page":void 0,role:h&&!x?"button":void 0,"aria-expanded":h&&!x?!g:void 0,href:h?v??"#":v,...d,children:m}),x&&h&&(0,b.jsx)(L,{collapsed:g,categoryLabel:m,onClick:e=>{e.preventDefault(),M()}})]}),(0,b.jsx)(I.N,{lazy:!0,as:"ul",className:"menu__list",collapsed:g,children:(0,b.jsx)(U,{items:u,tabIndex:g?-1:0,onItemClick:n,activePath:i,level:r+1})})]})}var M=n(877),H=n(716);const G={menuExternalLink:"menuExternalLink_NmtK"};function W(e){let{item:t,onItemClick:n,activePath:a,level:i,index:r,...c}=e;const{href:d,label:u,className:m,autoAddBaseUrl:h}=t,p=(0,l.w8)(t,a),x=(0,M.A)(d);return(0,b.jsx)("li",{className:(0,o.A)(s.G.docs.docSidebarItemLink,s.G.docs.docSidebarItemLinkLevel(i),"menu__list-item",m),children:(0,b.jsxs)(y.A,{className:(0,o.A)("menu__link",!x&&G.menuExternalLink,{"menu__link--active":p}),autoAddBaseUrl:h,"aria-current":p?"page":void 0,to:d,...x&&{onClick:n?()=>n(t):void 0},...c,children:[u,!x&&(0,b.jsx)(H.A,{})]})},u)}const P={menuHtmlItem:"menuHtmlItem_M9Kj"};function R(e){let{item:t,level:n,index:a}=e;const{value:i,defaultStyle:l,className:r}=t;return(0,b.jsx)("li",{className:(0,o.A)(s.G.docs.docSidebarItemLink,s.G.docs.docSidebarItemLinkLevel(n),l&&[P.menuHtmlItem,"menu__list-item"],r),dangerouslySetInnerHTML:{__html:i}},a)}function D(e){let{item:t,...n}=e;switch(t.type){case"category":return(0,b.jsx)(E,{item:t,...n});case"html":return(0,b.jsx)(R,{item:t,...n});default:return(0,b.jsx)(W,{item:t,...n})}}function F(e){let{items:t,...n}=e;const a=(0,l.Y)(t,n.activePath);return(0,b.jsx)(N,{children:a.map(((e,t)=>(0,b.jsx)(D,{item:e,index:t,...n},t)))})}const U=(0,a.memo)(F),V={menu:"menu_SIkG",menuWithAnnouncementBar:"menuWithAnnouncementBar_GW3s"};function Y(e){let{path:t,sidebar:n,className:i}=e;const l=function(){const{isActive:e}=(0,k.M)(),[t,n]=(0,a.useState)(e);return(0,d.Mq)((t=>{let{scrollY:a}=t;e&&n(0===a)}),[e]),e&&t}();return(0,b.jsx)("nav",{"aria-label":(0,c.T)({id:"theme.docs.sidebar.navAriaLabel",message:"Docs sidebar",description:"The ARIA label for the sidebar navigation"}),className:(0,o.A)("menu thin-scrollbar",V.menu,l&&V.menuWithAnnouncementBar,i),children:(0,b.jsx)("ul",{className:(0,o.A)(s.G.docs.docSidebarMenu,"menu__list"),children:(0,b.jsx)(U,{items:n,activePath:t,level:1})})})}const K="sidebar_njMd",z="sidebarWithHideableNavbar_wUlq",q="sidebarHidden_VK0M",O="sidebarLogo_isFc";function J(e){let{path:t,sidebar:n,onCollapse:a,isHidden:i}=e;const{navbar:{hideOnScroll:s},docs:{sidebar:{hideable:l}}}=(0,j.p)();return(0,b.jsxs)("div",{className:(0,o.A)(K,s&&z,i&&q),children:[s&&(0,b.jsx)(v.A,{tabIndex:-1,className:O}),(0,b.jsx)(Y,{path:t,sidebar:n}),l&&(0,b.jsx)(g,{onClick:a})]})}const Q=a.memo(J);var X=n(763),Z=n(1938);const $=e=>{let{sidebar:t,path:n}=e;const a=(0,Z.M)();return(0,b.jsx)("ul",{className:(0,o.A)(s.G.docs.docSidebarMenu,"menu__list"),children:(0,b.jsx)(U,{items:t,activePath:n,onItemClick:e=>{"category"===e.type&&e.href&&a.toggle(),"link"===e.type&&a.toggle()},level:1})})};function ee(e){return(0,b.jsx)(X.GX,{component:$,props:e})}const te=a.memo(ee);function ne(e){const t=(0,f.l)(),n="desktop"===t||"ssr"===t,a="mobile"===t;return(0,b.jsxs)(b.Fragment,{children:[n&&(0,b.jsx)(Q,{...e}),a&&(0,b.jsx)(te,{...e})]})}const ae={expandButton:"expandButton_TmdG",expandButtonIcon:"expandButtonIcon_i1dp"};function oe(e){let{toggleSidebar:t}=e;return(0,b.jsx)("div",{className:ae.expandButton,title:(0,c.T)({id:"theme.docs.sidebar.expandButtonTitle",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),"aria-label":(0,c.T)({id:"theme.docs.sidebar.expandButtonAriaLabel",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),tabIndex:0,role:"button",onKeyDown:t,onClick:t,children:(0,b.jsx)(_,{className:ae.expandButtonIcon})})}const ie={docSidebarContainer:"docSidebarContainer_YfHR",docSidebarContainerHidden:"docSidebarContainerHidden_DPk8",sidebarViewport:"sidebarViewport_aRkj"};function se(e){let{children:t}=e;const n=(0,r.t)();return(0,b.jsx)(a.Fragment,{children:t},n?.name??"noSidebar")}function le(e){let{sidebar:t,hiddenSidebarContainer:n,setHiddenSidebarContainer:i}=e;const{pathname:l}=(0,x.zy)(),[r,c]=(0,a.useState)(!1),d=(0,a.useCallback)((()=>{r&&c(!1),!r&&(0,p.O)()&&c(!0),i((e=>!e))}),[i,r]);return(0,b.jsx)("aside",{className:(0,o.A)(s.G.docs.docSidebarContainer,ie.docSidebarContainer,n&&ie.docSidebarContainerHidden),onTransitionEnd:e=>{e.currentTarget.classList.contains(ie.docSidebarContainer)&&n&&c(!0)},children:(0,b.jsx)(se,{children:(0,b.jsxs)("div",{className:(0,o.A)(ie.sidebarViewport,r&&ie.sidebarViewportHidden),children:[(0,b.jsx)(ne,{sidebar:t,path:l,onCollapse:d,isHidden:r}),r&&(0,b.jsx)(oe,{toggleSidebar:d})]})})})}const re={docMainContainer:"docMainContainer_TBSr",docMainContainerEnhanced:"docMainContainerEnhanced_lQrH",docItemWrapperEnhanced:"docItemWrapperEnhanced_JWYK"};function ce(e){let{hiddenSidebarContainer:t,children:n}=e;const a=(0,r.t)();return(0,b.jsx)("main",{className:(0,o.A)(re.docMainContainer,(t||!a)&&re.docMainContainerEnhanced),children:(0,b.jsx)("div",{className:(0,o.A)("container padding-top--md padding-bottom--lg",re.docItemWrapper,t&&re.docItemWrapperEnhanced),children:n})})}const de={docRoot:"docRoot_UBD9",docsWrapper:"docsWrapper_hBAB"};function ue(e){let{children:t}=e;const n=(0,r.t)(),[o,i]=(0,a.useState)(!1);return(0,b.jsxs)("div",{className:de.docsWrapper,children:[(0,b.jsx)(h,{}),(0,b.jsxs)("div",{className:de.docRoot,children:[n&&(0,b.jsx)(le,{sidebar:n.items,hiddenSidebarContainer:o,setHiddenSidebarContainer:i}),(0,b.jsx)(ce,{hiddenSidebarContainer:o,children:t})]})]})}var me=n(3510);function be(e){const t=(0,l.B5)(e);if(!t)return(0,b.jsx)(me.A,{});const{docElement:n,sidebarName:a,sidebarItems:c}=t;return(0,b.jsx)(i.e3,{className:(0,o.A)(s.G.page.docsDocPage),children:(0,b.jsx)(r.V,{name:a,items:c,children:(0,b.jsx)(ue,{children:n})})})}},3510:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var a=n(4164),o=n(3230),i=n(5225),s=n(4848);function l(e){let{className:t}=e;return(0,s.jsx)("main",{className:(0,a.A)("container margin-vert--xl",t),children:(0,s.jsx)("div",{className:"row",children:(0,s.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,s.jsx)(i.A,{as:"h1",className:"hero__title",children:(0,s.jsx)(o.A,{id:"theme.NotFound.title",description:"The title of the 404 page",children:"Page Not Found"})}),(0,s.jsx)("p",{children:(0,s.jsx)(o.A,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page",children:"We could not find what you were looking for."})}),(0,s.jsx)("p",{children:(0,s.jsx)(o.A,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page",children:"Please contact the owner of the site that linked you to the original URL and let them know their link is broken."})})]})})})}}}]); \ No newline at end of file diff --git a/assets/js/a94703ab.95f72f34.js b/assets/js/a94703ab.95f72f34.js new file mode 100644 index 0000000000..2c0fb7b8e1 --- /dev/null +++ b/assets/js/a94703ab.95f72f34.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9048],{1377:(e,t,n)=>{n.r(t),n.d(t,{default:()=>be});var a=n(6540),o=n(4164),i=n(9024),s=n(7559),l=n(6972),r=n(609),c=n(1312),d=n(3104),u=n(5062);const m={backToTopButton:"backToTopButton_sjWU",backToTopButtonShow:"backToTopButtonShow_xfvO"};var b=n(4848);function h(){const{shown:e,scrollToTop:t}=function(e){let{threshold:t}=e;const[n,o]=(0,a.useState)(!1),i=(0,a.useRef)(!1),{startScroll:s,cancelScroll:l}=(0,d.gk)();return(0,d.Mq)(((e,n)=>{let{scrollY:a}=e;const s=n?.scrollY;s&&(i.current?i.current=!1:a>=s?(l(),o(!1)):a<t?o(!1):a+window.innerHeight<document.documentElement.scrollHeight&&o(!0))})),(0,u.$)((e=>{e.location.hash&&(i.current=!0,o(!1))})),{shown:n,scrollToTop:()=>s(0)}}({threshold:300});return(0,b.jsx)("button",{"aria-label":(0,c.T)({id:"theme.BackToTopButton.buttonAriaLabel",message:"Scroll back to top",description:"The ARIA label for the back to top button"}),className:(0,o.A)("clean-btn",s.G.common.backToTopButton,m.backToTopButton,e&&m.backToTopButtonShow),type:"button",onClick:t})}var p=n(3109),x=n(6347),f=n(4581),j=n(6342),v=n(3465);function _(e){return(0,b.jsx)("svg",{width:"20",height:"20","aria-hidden":"true",...e,children:(0,b.jsxs)("g",{fill:"#7a7a7a",children:[(0,b.jsx)("path",{d:"M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"}),(0,b.jsx)("path",{d:"M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"})]})})}const A={collapseSidebarButton:"collapseSidebarButton_PEFL",collapseSidebarButtonIcon:"collapseSidebarButtonIcon_kv0_"};function g(e){let{onClick:t}=e;return(0,b.jsx)("button",{type:"button",title:(0,c.T)({id:"theme.docs.sidebar.collapseButtonTitle",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),"aria-label":(0,c.T)({id:"theme.docs.sidebar.collapseButtonAriaLabel",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),className:(0,o.A)("button button--secondary button--outline",A.collapseSidebarButton),onClick:t,children:(0,b.jsx)(_,{className:A.collapseSidebarButtonIcon})})}var k=n(5041),C=n(9532);const S=Symbol("EmptyContext"),T=a.createContext(S);function N(e){let{children:t}=e;const[n,o]=(0,a.useState)(null),i=(0,a.useMemo)((()=>({expandedItem:n,setExpandedItem:o})),[n]);return(0,b.jsx)(T.Provider,{value:i,children:t})}var I=n(1422),B=n(9169),y=n(8774),w=n(2303);function L(e){let{collapsed:t,categoryLabel:n,onClick:a}=e;return(0,b.jsx)("button",{"aria-label":t?(0,c.T)({id:"theme.DocSidebarItem.expandCategoryAriaLabel",message:"Expand sidebar category '{label}'",description:"The ARIA label to expand the sidebar category"},{label:n}):(0,c.T)({id:"theme.DocSidebarItem.collapseCategoryAriaLabel",message:"Collapse sidebar category '{label}'",description:"The ARIA label to collapse the sidebar category"},{label:n}),"aria-expanded":!t,type:"button",className:"clean-btn menu__caret",onClick:a})}function E(e){let{item:t,onItemClick:n,activePath:i,level:r,index:c,...d}=e;const{items:u,label:m,collapsible:h,className:p,href:x}=t,{docs:{sidebar:{autoCollapseCategories:f}}}=(0,j.p)(),v=function(e){const t=(0,w.A)();return(0,a.useMemo)((()=>e.href&&!e.linkUnlisted?e.href:!t&&e.collapsible?(0,l.Nr)(e):void 0),[e,t])}(t),_=(0,l.w8)(t,i),A=(0,B.ys)(x,i),{collapsed:g,setCollapsed:k}=(0,I.u)({initialState:()=>!!h&&(!_&&t.collapsed)}),{expandedItem:N,setExpandedItem:E}=function(){const e=(0,a.useContext)(T);if(e===S)throw new C.dV("DocSidebarItemsExpandedStateProvider");return e}(),M=function(e){void 0===e&&(e=!g),E(e?null:c),k(e)};return function(e){let{isActive:t,collapsed:n,updateCollapsed:o}=e;const i=(0,C.ZC)(t);(0,a.useEffect)((()=>{t&&!i&&n&&o(!1)}),[t,i,n,o])}({isActive:_,collapsed:g,updateCollapsed:M}),(0,a.useEffect)((()=>{h&&null!=N&&N!==c&&f&&k(!0)}),[h,N,c,k,f]),(0,b.jsxs)("li",{className:(0,o.A)(s.G.docs.docSidebarItemCategory,s.G.docs.docSidebarItemCategoryLevel(r),"menu__list-item",{"menu__list-item--collapsed":g},p),children:[(0,b.jsxs)("div",{className:(0,o.A)("menu__list-item-collapsible",{"menu__list-item-collapsible--active":A}),children:[(0,b.jsx)(y.A,{className:(0,o.A)("menu__link",{"menu__link--sublist":h,"menu__link--sublist-caret":!x&&h,"menu__link--active":_}),onClick:h?e=>{n?.(t),x?M(!1):(e.preventDefault(),M())}:()=>{n?.(t)},"aria-current":A?"page":void 0,role:h&&!x?"button":void 0,"aria-expanded":h&&!x?!g:void 0,href:h?v??"#":v,...d,children:m}),x&&h&&(0,b.jsx)(L,{collapsed:g,categoryLabel:m,onClick:e=>{e.preventDefault(),M()}})]}),(0,b.jsx)(I.N,{lazy:!0,as:"ul",className:"menu__list",collapsed:g,children:(0,b.jsx)(U,{items:u,tabIndex:g?-1:0,onItemClick:n,activePath:i,level:r+1})})]})}var M=n(6654),H=n(3186);const G={menuExternalLink:"menuExternalLink_NmtK"};function W(e){let{item:t,onItemClick:n,activePath:a,level:i,index:r,...c}=e;const{href:d,label:u,className:m,autoAddBaseUrl:h}=t,p=(0,l.w8)(t,a),x=(0,M.A)(d);return(0,b.jsx)("li",{className:(0,o.A)(s.G.docs.docSidebarItemLink,s.G.docs.docSidebarItemLinkLevel(i),"menu__list-item",m),children:(0,b.jsxs)(y.A,{className:(0,o.A)("menu__link",!x&&G.menuExternalLink,{"menu__link--active":p}),autoAddBaseUrl:h,"aria-current":p?"page":void 0,to:d,...x&&{onClick:n?()=>n(t):void 0},...c,children:[u,!x&&(0,b.jsx)(H.A,{})]})},u)}const P={menuHtmlItem:"menuHtmlItem_M9Kj"};function R(e){let{item:t,level:n,index:a}=e;const{value:i,defaultStyle:l,className:r}=t;return(0,b.jsx)("li",{className:(0,o.A)(s.G.docs.docSidebarItemLink,s.G.docs.docSidebarItemLinkLevel(n),l&&[P.menuHtmlItem,"menu__list-item"],r),dangerouslySetInnerHTML:{__html:i}},a)}function D(e){let{item:t,...n}=e;switch(t.type){case"category":return(0,b.jsx)(E,{item:t,...n});case"html":return(0,b.jsx)(R,{item:t,...n});default:return(0,b.jsx)(W,{item:t,...n})}}function F(e){let{items:t,...n}=e;const a=(0,l.Y)(t,n.activePath);return(0,b.jsx)(N,{children:a.map(((e,t)=>(0,b.jsx)(D,{item:e,index:t,...n},t)))})}const U=(0,a.memo)(F),V={menu:"menu_SIkG",menuWithAnnouncementBar:"menuWithAnnouncementBar_GW3s"};function Y(e){let{path:t,sidebar:n,className:i}=e;const l=function(){const{isActive:e}=(0,k.M)(),[t,n]=(0,a.useState)(e);return(0,d.Mq)((t=>{let{scrollY:a}=t;e&&n(0===a)}),[e]),e&&t}();return(0,b.jsx)("nav",{"aria-label":(0,c.T)({id:"theme.docs.sidebar.navAriaLabel",message:"Docs sidebar",description:"The ARIA label for the sidebar navigation"}),className:(0,o.A)("menu thin-scrollbar",V.menu,l&&V.menuWithAnnouncementBar,i),children:(0,b.jsx)("ul",{className:(0,o.A)(s.G.docs.docSidebarMenu,"menu__list"),children:(0,b.jsx)(U,{items:n,activePath:t,level:1})})})}const K="sidebar_njMd",z="sidebarWithHideableNavbar_wUlq",q="sidebarHidden_VK0M",O="sidebarLogo_isFc";function J(e){let{path:t,sidebar:n,onCollapse:a,isHidden:i}=e;const{navbar:{hideOnScroll:s},docs:{sidebar:{hideable:l}}}=(0,j.p)();return(0,b.jsxs)("div",{className:(0,o.A)(K,s&&z,i&&q),children:[s&&(0,b.jsx)(v.A,{tabIndex:-1,className:O}),(0,b.jsx)(Y,{path:t,sidebar:n}),l&&(0,b.jsx)(g,{onClick:a})]})}const Q=a.memo(J);var X=n(5600),Z=n(2069);const $=e=>{let{sidebar:t,path:n}=e;const a=(0,Z.M)();return(0,b.jsx)("ul",{className:(0,o.A)(s.G.docs.docSidebarMenu,"menu__list"),children:(0,b.jsx)(U,{items:t,activePath:n,onItemClick:e=>{"category"===e.type&&e.href&&a.toggle(),"link"===e.type&&a.toggle()},level:1})})};function ee(e){return(0,b.jsx)(X.GX,{component:$,props:e})}const te=a.memo(ee);function ne(e){const t=(0,f.l)(),n="desktop"===t||"ssr"===t,a="mobile"===t;return(0,b.jsxs)(b.Fragment,{children:[n&&(0,b.jsx)(Q,{...e}),a&&(0,b.jsx)(te,{...e})]})}const ae={expandButton:"expandButton_TmdG",expandButtonIcon:"expandButtonIcon_i1dp"};function oe(e){let{toggleSidebar:t}=e;return(0,b.jsx)("div",{className:ae.expandButton,title:(0,c.T)({id:"theme.docs.sidebar.expandButtonTitle",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),"aria-label":(0,c.T)({id:"theme.docs.sidebar.expandButtonAriaLabel",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),tabIndex:0,role:"button",onKeyDown:t,onClick:t,children:(0,b.jsx)(_,{className:ae.expandButtonIcon})})}const ie={docSidebarContainer:"docSidebarContainer_YfHR",docSidebarContainerHidden:"docSidebarContainerHidden_DPk8",sidebarViewport:"sidebarViewport_aRkj"};function se(e){let{children:t}=e;const n=(0,r.t)();return(0,b.jsx)(a.Fragment,{children:t},n?.name??"noSidebar")}function le(e){let{sidebar:t,hiddenSidebarContainer:n,setHiddenSidebarContainer:i}=e;const{pathname:l}=(0,x.zy)(),[r,c]=(0,a.useState)(!1),d=(0,a.useCallback)((()=>{r&&c(!1),!r&&(0,p.O)()&&c(!0),i((e=>!e))}),[i,r]);return(0,b.jsx)("aside",{className:(0,o.A)(s.G.docs.docSidebarContainer,ie.docSidebarContainer,n&&ie.docSidebarContainerHidden),onTransitionEnd:e=>{e.currentTarget.classList.contains(ie.docSidebarContainer)&&n&&c(!0)},children:(0,b.jsx)(se,{children:(0,b.jsxs)("div",{className:(0,o.A)(ie.sidebarViewport,r&&ie.sidebarViewportHidden),children:[(0,b.jsx)(ne,{sidebar:t,path:l,onCollapse:d,isHidden:r}),r&&(0,b.jsx)(oe,{toggleSidebar:d})]})})})}const re={docMainContainer:"docMainContainer_TBSr",docMainContainerEnhanced:"docMainContainerEnhanced_lQrH",docItemWrapperEnhanced:"docItemWrapperEnhanced_JWYK"};function ce(e){let{hiddenSidebarContainer:t,children:n}=e;const a=(0,r.t)();return(0,b.jsx)("main",{className:(0,o.A)(re.docMainContainer,(t||!a)&&re.docMainContainerEnhanced),children:(0,b.jsx)("div",{className:(0,o.A)("container padding-top--md padding-bottom--lg",re.docItemWrapper,t&&re.docItemWrapperEnhanced),children:n})})}const de={docRoot:"docRoot_UBD9",docsWrapper:"docsWrapper_hBAB"};function ue(e){let{children:t}=e;const n=(0,r.t)(),[o,i]=(0,a.useState)(!1);return(0,b.jsxs)("div",{className:de.docsWrapper,children:[(0,b.jsx)(h,{}),(0,b.jsxs)("div",{className:de.docRoot,children:[n&&(0,b.jsx)(le,{sidebar:n.items,hiddenSidebarContainer:o,setHiddenSidebarContainer:i}),(0,b.jsx)(ce,{hiddenSidebarContainer:o,children:t})]})]})}var me=n(3363);function be(e){const t=(0,l.B5)(e);if(!t)return(0,b.jsx)(me.A,{});const{docElement:n,sidebarName:a,sidebarItems:c}=t;return(0,b.jsx)(i.e3,{className:(0,o.A)(s.G.page.docsDocPage),children:(0,b.jsx)(r.V,{name:a,items:c,children:(0,b.jsx)(ue,{children:n})})})}},3363:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var a=n(4164),o=n(1312),i=n(1107),s=n(4848);function l(e){let{className:t}=e;return(0,s.jsx)("main",{className:(0,a.A)("container margin-vert--xl",t),children:(0,s.jsx)("div",{className:"row",children:(0,s.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,s.jsx)(i.A,{as:"h1",className:"hero__title",children:(0,s.jsx)(o.A,{id:"theme.NotFound.title",description:"The title of the 404 page",children:"Page Not Found"})}),(0,s.jsx)("p",{children:(0,s.jsx)(o.A,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page",children:"We could not find what you were looking for."})}),(0,s.jsx)("p",{children:(0,s.jsx)(o.A,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page",children:"Please contact the owner of the site that linked you to the original URL and let them know their link is broken."})})]})})})}}}]); \ No newline at end of file diff --git a/assets/js/a9789633.ba5010f0.js b/assets/js/a9789633.ba5010f0.js deleted file mode 100644 index dd1a8bc720..0000000000 --- a/assets/js/a9789633.ba5010f0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3543],{9893:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-9.x/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/9.x/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/troubleshooting.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/9.x/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a9789633.e91e430c.js b/assets/js/a9789633.e91e430c.js new file mode 100644 index 0000000000..faa4a8b09d --- /dev/null +++ b/assets/js/a9789633.e91e430c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3543],{9131:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-9.x/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/9.x/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/troubleshooting.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/9.x/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/aa079c8b.6e9216b4.js b/assets/js/aa079c8b.6e9216b4.js deleted file mode 100644 index bc0972c620..0000000000 --- a/assets/js/aa079c8b.6e9216b4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2772],{2201:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-13.0/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/13.0/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/getting-started/options.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/13.0/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/13.0/getting-started/test-environment"}}');var r=t(4848),o=t(8453),i=t(9489),a=t(7227);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function h(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(n.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(n.p,{children:["More information about ",(0,r.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsxs)(n.admonition,{type:"important",children:[(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),(0,r.jsx)(n.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(n.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(n.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(n.code,{children:"esbuild"})," in ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(n.code,{children:"esbuild"}),", one can do the following:"]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n\nexport default jestConfig;\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport snapshotSerializers from 'jest-preset-angular/build/serializers';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["Jest runs with ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["We're using ",(0,r.jsx)(n.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(n.code,{children:"ts"}),"), HTML (",(0,r.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(n.code,{children:"js"}),"), JSON (",(0,r.jsx)(n.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(n.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(n.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,r.jsx)(n.code,{children:"package.json"})," definitions."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,r.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,r.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,r.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(n.code,{children:".mjs"})," files which come from ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(n.code,{children:"TS"}),", ",(0,r.jsx)(n.code,{children:"JS"}),", ",(0,r.jsx)(n.code,{children:"MJS"}),", ",(0,r.jsx)(n.code,{children:"HTML"}),", or ",(0,r.jsx)(n.code,{children:"SVG"})," file through so called ",(0,r.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},7227:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var o=t(4848);function i(e){let{children:n,hidden:t,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),o=t(4245),i=t(6347),a=t(6494),l=t(2814),c=t(5167),d=t(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function j(e){let{queryString:n=!1,groupId:t}=e;const r=(0,i.W6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function f(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=h(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:o}))),[c,u]=j({queryString:t,groupId:r}),[f,m]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=c??f;return p({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{g&&l(g)}),[g]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),m(e)}),[u,m,o]),tabValues:o}}var m=t(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=a[t].value;r!==s&&(c(n),i(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:a.map((e=>{let{value:n,label:t,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>l.push(e),onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:o}=e;const i=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function y(e){const n=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function w(e){const n=(0,m.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var s=t(6540);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/aa079c8b.94ee3eac.js b/assets/js/aa079c8b.94ee3eac.js new file mode 100644 index 0000000000..3eb34d4d26 --- /dev/null +++ b/assets/js/aa079c8b.94ee3eac.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2772],{374:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-13.0/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/13.0/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/getting-started/options.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/13.0/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/13.0/getting-started/test-environment"}}');var r=t(4848),o=t(8453),i=t(1470),a=t(9365);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function h(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(n.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(n.p,{children:["More information about ",(0,r.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsxs)(n.admonition,{type:"important",children:[(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),(0,r.jsx)(n.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(n.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(n.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(n.code,{children:"esbuild"})," in ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(n.code,{children:"esbuild"}),", one can do the following:"]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n\nexport default jestConfig;\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport snapshotSerializers from 'jest-preset-angular/build/serializers';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["Jest runs with ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["We're using ",(0,r.jsx)(n.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(n.code,{children:"ts"}),"), HTML (",(0,r.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(n.code,{children:"js"}),"), JSON (",(0,r.jsx)(n.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(n.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(n.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,r.jsx)(n.code,{children:"package.json"})," definitions."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,r.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,r.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,r.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(n.code,{children:".mjs"})," files which come from ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(n.code,{children:"TS"}),", ",(0,r.jsx)(n.code,{children:"JS"}),", ",(0,r.jsx)(n.code,{children:"MJS"}),", ",(0,r.jsx)(n.code,{children:"HTML"}),", or ",(0,r.jsx)(n.code,{children:"SVG"})," file through so called ",(0,r.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},9365:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var o=t(4848);function i(e){let{children:n,hidden:t,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),o=t(3104),i=t(6347),a=t(205),l=t(7485),c=t(1682),d=t(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function j(e){let{queryString:n=!1,groupId:t}=e;const r=(0,i.W6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function f(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=h(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:o}))),[c,u]=j({queryString:t,groupId:r}),[f,m]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=c??f;return p({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{g&&l(g)}),[g]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),m(e)}),[u,m,o]),tabValues:o}}var m=t(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=a[t].value;r!==s&&(c(n),i(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:a.map((e=>{let{value:n,label:t,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:o}=e;const i=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function y(e){const n=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function w(e){const n=(0,m.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var s=t(6540);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/aad144a3.581d5e11.js b/assets/js/aad144a3.581d5e11.js deleted file mode 100644 index 627e251037..0000000000 --- a/assets/js/aad144a3.581d5e11.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9104],{9785:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-11.1/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/11.1/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/angular-13+.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/11.1/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/11.1/guides/esm-support"}}');var t=n(4848),i=n(8453);const o={id:"angular-13+",title:"Angular >=13"},a=void 0,l={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3}];function c(e){const s={a:"a",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,t.jsx)(s.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,t.jsx)(s.code,{children:"CommonJS"})," mode with ",(0,t.jsx)(s.strong,{children:"Angular 13"})," using ",(0,t.jsx)(s.a,{href:"/jest-preset-angular/docs/11.1/getting-started/presets",children:"default preset"}),".\nJest ESM support with ",(0,t.jsx)(s.strong,{children:"Angular 13"})," is new and may have issues."]}),"\n",(0,t.jsxs)(s.p,{children:["Starting from ",(0,t.jsx)(s.strong,{children:"v11.0.0"}),", ",(0,t.jsx)(s.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,t.jsx)(s.strong,{children:"Angular 13"}),":"]}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"ng-jest-resolver"})," is introduced as a custom Jest resolver to resolve ",(0,t.jsx)(s.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"moduleFileExtensions"})," is updated to include ",(0,t.jsx)(s.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,t.jsx)(s.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"transform"})," is updated to include ",(0,t.jsx)(s.code,{children:".mjs"})," extension to transform to ",(0,t.jsx)(s.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(s.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:["Upgrade the project to ",(0,t.jsx)(s.strong,{children:"Angular 13"})," following ",(0,t.jsx)(s.a,{href:"https://update.angular.io/",children:"guide"})]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,t.jsx)(s.p,{children:"there are no migration steps required"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["If one is ",(0,t.jsx)(s.strong,{children:"NOT"})," having ",(0,t.jsx)(s.code,{children:"preset: 'jest-preset-angular'"})," in Jest config, the config needs to be updated with new values for\n",(0,t.jsx)(s.code,{children:"resolver"}),", ",(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," and ",(0,t.jsx)(s.code,{children:"transform"}),":"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})}),"\n",(0,t.jsx)(s.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,t.jsxs)(s.p,{children:["ES Modules support is new and may encounter issues. See ",(0,t.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,t.jsxs)(s.p,{children:["Your ",(0,t.jsx)(s.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"const { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n globals: {\n 'ts-jest': {\n useESM: true,\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n },\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})}),"\n",(0,t.jsxs)(s.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,t.jsx)(s.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,t.jsx)(s.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,t.jsxs)(s.p,{children:["The ",(0,t.jsx)(s.code,{children:"jest-preset-angular/setup-jest"})," file doesn't work with ESM, because it uses ",(0,t.jsx)(s.code,{children:"require"}),". For now you should skip using this file, and replace the contents of your ",(0,t.jsx)(s.code,{children:"setup-jest.ts"})," with:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'zone.js';\nimport 'zone.js/testing';\nimport './jest-global-mocks';\n\nimport { getTestBed } from '@angular/core/testing';\nimport { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';\n\ngetTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {\n teardown: {\n destroyAfterEach: true, // Angular recommends this, but it may break existing tests\n },\n});\ngetTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\n"})}),"\n",(0,t.jsx)(s.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,t.jsxs)(s.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,t.jsx)(s.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["Angular 13 ESM package format makes Jest resolution not able to resolve the correct ",(0,t.jsx)(s.code,{children:".mjs"})," files. Even though we introduced\n",(0,t.jsx)(s.code,{children:"ng-jest-resolver"})," as a part of the preset, this resolver won't work for all scenarios. One might get Jest error like"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,t.jsxs)(s.p,{children:["To fix this issue, one needs to add ",(0,t.jsx)(s.code,{children:"mjs"})," to ",(0,t.jsx)(s.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})}),"\n",(0,t.jsxs)(s.p,{children:["If the issue still ",(0,t.jsx)(s.strong,{children:"persists"}),", you might need to configure ",(0,t.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#modulenamemapper-objectstring-string--arraystring",children:"moduleNameMapper"}),"\nor extend the behavior the default ",(0,t.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/resolvers/ng-jest-resolver.ts",children:"resolver"})," of this preset."]}),"\n",(0,t.jsx)(s.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,t.jsxs)(s.p,{children:["Besides, the changes in Angular packages themselves, ",(0,t.jsx)(s.strong,{children:"Angular"})," libraries which are built with ",(0,t.jsx)(s.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,t.jsx)(s.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,t.jsx)(s.strong,{children:"CommonJS"})," mode."]}),"\n",(0,t.jsxs)(s.p,{children:["To fix this issue, one should modify ",(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,t.jsx)(s,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>o,x:()=>a});var r=n(6540);const t={},i=r.createContext(t);function o(e){const s=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:o(e.components),r.createElement(i.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/aad144a3.5ad8a7db.js b/assets/js/aad144a3.5ad8a7db.js new file mode 100644 index 0000000000..6e6e194921 --- /dev/null +++ b/assets/js/aad144a3.5ad8a7db.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9104],{568:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-11.1/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/11.1/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/angular-13+.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/11.1/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/11.1/guides/esm-support"}}');var t=n(4848),i=n(8453);const o={id:"angular-13+",title:"Angular >=13"},a=void 0,l={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3}];function c(e){const s={a:"a",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,t.jsx)(s.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,t.jsx)(s.code,{children:"CommonJS"})," mode with ",(0,t.jsx)(s.strong,{children:"Angular 13"})," using ",(0,t.jsx)(s.a,{href:"/jest-preset-angular/docs/11.1/getting-started/presets",children:"default preset"}),".\nJest ESM support with ",(0,t.jsx)(s.strong,{children:"Angular 13"})," is new and may have issues."]}),"\n",(0,t.jsxs)(s.p,{children:["Starting from ",(0,t.jsx)(s.strong,{children:"v11.0.0"}),", ",(0,t.jsx)(s.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,t.jsx)(s.strong,{children:"Angular 13"}),":"]}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"ng-jest-resolver"})," is introduced as a custom Jest resolver to resolve ",(0,t.jsx)(s.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"moduleFileExtensions"})," is updated to include ",(0,t.jsx)(s.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,t.jsx)(s.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"transform"})," is updated to include ",(0,t.jsx)(s.code,{children:".mjs"})," extension to transform to ",(0,t.jsx)(s.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(s.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:["Upgrade the project to ",(0,t.jsx)(s.strong,{children:"Angular 13"})," following ",(0,t.jsx)(s.a,{href:"https://update.angular.io/",children:"guide"})]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,t.jsx)(s.p,{children:"there are no migration steps required"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["If one is ",(0,t.jsx)(s.strong,{children:"NOT"})," having ",(0,t.jsx)(s.code,{children:"preset: 'jest-preset-angular'"})," in Jest config, the config needs to be updated with new values for\n",(0,t.jsx)(s.code,{children:"resolver"}),", ",(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," and ",(0,t.jsx)(s.code,{children:"transform"}),":"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})}),"\n",(0,t.jsx)(s.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,t.jsxs)(s.p,{children:["ES Modules support is new and may encounter issues. See ",(0,t.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,t.jsxs)(s.p,{children:["Your ",(0,t.jsx)(s.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"const { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n globals: {\n 'ts-jest': {\n useESM: true,\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n },\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})}),"\n",(0,t.jsxs)(s.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,t.jsx)(s.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,t.jsx)(s.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,t.jsxs)(s.p,{children:["The ",(0,t.jsx)(s.code,{children:"jest-preset-angular/setup-jest"})," file doesn't work with ESM, because it uses ",(0,t.jsx)(s.code,{children:"require"}),". For now you should skip using this file, and replace the contents of your ",(0,t.jsx)(s.code,{children:"setup-jest.ts"})," with:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'zone.js';\nimport 'zone.js/testing';\nimport './jest-global-mocks';\n\nimport { getTestBed } from '@angular/core/testing';\nimport { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';\n\ngetTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {\n teardown: {\n destroyAfterEach: true, // Angular recommends this, but it may break existing tests\n },\n});\ngetTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\n"})}),"\n",(0,t.jsx)(s.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,t.jsxs)(s.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,t.jsx)(s.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["Angular 13 ESM package format makes Jest resolution not able to resolve the correct ",(0,t.jsx)(s.code,{children:".mjs"})," files. Even though we introduced\n",(0,t.jsx)(s.code,{children:"ng-jest-resolver"})," as a part of the preset, this resolver won't work for all scenarios. One might get Jest error like"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,t.jsxs)(s.p,{children:["To fix this issue, one needs to add ",(0,t.jsx)(s.code,{children:"mjs"})," to ",(0,t.jsx)(s.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})}),"\n",(0,t.jsxs)(s.p,{children:["If the issue still ",(0,t.jsx)(s.strong,{children:"persists"}),", you might need to configure ",(0,t.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#modulenamemapper-objectstring-string--arraystring",children:"moduleNameMapper"}),"\nor extend the behavior the default ",(0,t.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/resolvers/ng-jest-resolver.ts",children:"resolver"})," of this preset."]}),"\n",(0,t.jsx)(s.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,t.jsxs)(s.p,{children:["Besides, the changes in Angular packages themselves, ",(0,t.jsx)(s.strong,{children:"Angular"})," libraries which are built with ",(0,t.jsx)(s.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,t.jsx)(s.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,t.jsx)(s.strong,{children:"CommonJS"})," mode."]}),"\n",(0,t.jsxs)(s.p,{children:["To fix this issue, one should modify ",(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,t.jsx)(s,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>o,x:()=>a});var r=n(6540);const t={},i=r.createContext(t);function o(e){const s=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:o(e.components),r.createElement(i.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/adb64ee2.7b680c76.js b/assets/js/adb64ee2.7b680c76.js new file mode 100644 index 0000000000..ef07451ee5 --- /dev/null +++ b/assets/js/adb64ee2.7b680c76.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8480],{5622:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-8.x/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/8.x/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/processing.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/8.x/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/8.x/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/adb64ee2.a262d5b4.js b/assets/js/adb64ee2.a262d5b4.js deleted file mode 100644 index 557fec6ec1..0000000000 --- a/assets/js/adb64ee2.a262d5b4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8480],{7794:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-8.x/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/8.x/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/processing.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/8.x/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/8.x/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/af572879.4cc2ec36.js b/assets/js/af572879.2b536d52.js similarity index 72% rename from assets/js/af572879.4cc2ec36.js rename to assets/js/af572879.2b536d52.js index 49f17c898b..10414da4c8 100644 --- a/assets/js/af572879.4cc2ec36.js +++ b/assets/js/af572879.2b536d52.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6308],{1551:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-14.3/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/14.3/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/getting-started/installation.md","tags":[],"version":"14.3","lastUpdatedBy":"ahnpnl","lastUpdatedAt":1734689944000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.3/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.3/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(9489),i=n(7227);const o={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(i.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsx)(t.p,{children:"In your project root, create a setup file with following contents:"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(t.p,{children:"Add the following section to your root Jest config"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label":"TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label":"TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"tsconfig-cjs",label:"Tsconfig CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json5",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig CJS"}',children:"{\n //...\n extends: './tsconfig.json',\n compilerOptions: {\n //...\n module: 'CommonJS',\n types: ['jest'],\n },\n include: ['src/**/*.spec.ts', 'src/**/*.d.ts'],\n //...\n}\n"})})}),(0,r.jsx)(i.A,{value:"tsconfig-esm",label:"Tsconfig ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig ESM"}',children:'{\n //...\n "extends": "./tsconfig.json",\n "compilerOptions": {\n //...\n "module": "ES2022",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n //...\n}\n'})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="package.json"',children:'{\n //...\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n //...\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),i=n(6494),o=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[g,j]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&o(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=n(1062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>o.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function S(e){const t=(0,j.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6308],{2630:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/installation","title":"Installation","description":"Dependencies","source":"@site/versioned_docs/version-14.3/getting-started/installation.md","sourceDirName":"getting-started","slug":"/getting-started/installation","permalink":"/jest-preset-angular/docs/14.3/getting-started/installation","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/getting-started/installation.md","tags":[],"version":"14.3","lastUpdatedBy":"ahnpnl","lastUpdatedAt":1734689944000,"frontMatter":{"id":"installation","title":"Installation"},"sidebar":"docs","previous":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.3/processing"},"next":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.3/getting-started/presets"}}');var r=n(4848),a=n(8453),l=n(1470),i=n(9365);const o={id:"installation",title:"Installation"},c=void 0,u={},d=[{value:"Dependencies",id:"dependencies",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Customizing",id:"customizing",level:3},{value:"Global mocks",id:"global-mocks",level:4},{value:"Avoid karma conflicts",id:"avoid-karma-conflicts",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"dependencies",children:"Dependencies"}),"\n",(0,r.jsxs)(t.p,{children:["You can install ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," and dependencies all at once with one of the following commands."]}),"\n",(0,r.jsxs)(l.A,{groupId:"npm2yarn",children:[(0,r.jsx)(i.A,{value:"npm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"npm install -D jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"yarn",label:"Yarn",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"yarn add --dev jest jest-preset-angular @types/jest\n"})})}),(0,r.jsx)(i.A,{value:"pnpm",label:"pnpm",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"pnpm add -D jest jest-preset-angular @types/jest\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Angular doesn't support native ",(0,r.jsx)(t.code,{children:"async/await"})," in testing with ",(0,r.jsx)(t.code,{children:"target"})," higher than ",(0,r.jsx)(t.code,{children:"ES2016"}),", see ",(0,r.jsx)(t.a,{href:"https://github.com/angular/components/issues/21632#issuecomment-764975917",children:"https://github.com/angular/components/issues/21632#issuecomment-764975917"})]})}),"\n",(0,r.jsx)(t.p,{children:"In your project root, create a setup file with following contents:"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(t.p,{children:"Add the following section to your root Jest config"}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label":"TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label":"TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust your ",(0,r.jsx)(t.code,{children:"tsconfig.spec.json"})," to be:"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"tsconfig-cjs",label:"Tsconfig CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json5",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig CJS"}',children:"{\n //...\n extends: './tsconfig.json',\n compilerOptions: {\n //...\n module: 'CommonJS',\n types: ['jest'],\n },\n include: ['src/**/*.spec.ts', 'src/**/*.d.ts'],\n //...\n}\n"})})}),(0,r.jsx)(i.A,{value:"tsconfig-esm",label:"Tsconfig ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="tsconfig.spec.json" tab={"label": "Tsconfig ESM"}',children:'{\n //...\n "extends": "./tsconfig.json",\n "compilerOptions": {\n //...\n "module": "ES2022",\n "types": ["jest"]\n },\n "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]\n //...\n}\n'})})})]}),"\n",(0,r.jsxs)(t.p,{children:["Adjust ",(0,r.jsx)(t.code,{children:"scripts"})," part your ",(0,r.jsx)(t.code,{children:"package.json"})," to use ",(0,r.jsx)(t.code,{children:"jest"})," instead of ",(0,r.jsx)(t.code,{children:"ng"}),", e.g."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-json",metastring:'title="package.json"',children:'{\n //...\n "scripts": {\n "test": "jest",\n "test:watch": "jest --watch"\n }\n //...\n}\n'})}),"\n",(0,r.jsx)(t.h3,{id:"customizing",children:"Customizing"}),"\n",(0,r.jsx)(t.h4,{id:"global-mocks",children:"Global mocks"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," which is different from normal browsers. You might need some global browser mocks to\nsimulate the behaviors of real browsers in ",(0,r.jsx)(t.code,{children:"JSDOM"}),". To add global mocks, you can do the following:"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Create a file ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})," to your root project."]}),"\n",(0,r.jsx)(t.li,{children:"Import it in your global setup file:"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\nimport './jest-global-mocks';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["An example for ",(0,r.jsx)(t.code,{children:"jest-global-mocks.ts"})]}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest-global-mocks.ts"',children:"Object.defineProperty(document, 'doctype', {\n value: '<!DOCTYPE html>',\n});\nObject.defineProperty(window, 'getComputedStyle', {\n value: () => {\n return {\n display: 'none',\n appearance: ['-webkit-appearance'],\n };\n },\n});\n/**\n * ISSUE: https://github.com/angular/material2/issues/7101\n * Workaround for JSDOM missing transform property\n */\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})})]}),"\n",(0,r.jsx)(t.h4,{id:"avoid-karma-conflicts",children:"Avoid karma conflicts"}),"\n",(0,r.jsxs)(t.p,{children:["By Angular CLI defaults you'll have a ",(0,r.jsx)(t.code,{children:"src/test.ts"})," file which will be picked up by jest. To circumvent this you can either rename it to ",(0,r.jsx)(t.code,{children:"src/karmaTest.ts"})," or hide it from jest by adding ",(0,r.jsx)(t.code,{children:"<rootDir>/src/test.ts"})," to jest ",(0,r.jsx)(t.code,{children:"testPathIgnorePatterns"})," option."]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),i=n(205),o=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=m({queryString:n,groupId:r}),[g,j]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),f=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{f&&o(f)}),[f]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),j(e)}),[d,j,a]),tabValues:a}}var j=n(2303);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(c(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{o.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",f.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function S(e){const t=(0,j.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/afba4106.0969fa6f.js b/assets/js/afba4106.0969fa6f.js deleted file mode 100644 index 885cf3748b..0000000000 --- a/assets/js/afba4106.0969fa6f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1942],{9415:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-11.0/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/11.0/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/getting-started/test-environment.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/11.0/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/11.0/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,d={},c=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/afba4106.7e5bad69.js b/assets/js/afba4106.7e5bad69.js new file mode 100644 index 0000000000..a48d1fc0c5 --- /dev/null +++ b/assets/js/afba4106.7e5bad69.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1942],{5831:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-11.0/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/11.0/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/getting-started/test-environment.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/11.0/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/11.0/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,c={},d=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b2161dc5.e00abd30.js b/assets/js/b2161dc5.e00abd30.js new file mode 100644 index 0000000000..a51b185c22 --- /dev/null +++ b/assets/js/b2161dc5.e00abd30.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[709],{8615:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-14.0/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/14.0/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/processing.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/14.0/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.0/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b2161dc5.e0f04e03.js b/assets/js/b2161dc5.e0f04e03.js deleted file mode 100644 index 9e5c297472..0000000000 --- a/assets/js/b2161dc5.e0f04e03.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[709],{6468:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-14.0/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/14.0/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/processing.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/14.0/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.0/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b4c5bdfe.29fd6207.js b/assets/js/b4c5bdfe.29fd6207.js deleted file mode 100644 index 43e9b44f8c..0000000000 --- a/assets/js/b4c5bdfe.29fd6207.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4344],{7496:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-14.2/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/14.2/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/processing.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/14.2/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.2/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b4c5bdfe.92ec3263.js b/assets/js/b4c5bdfe.92ec3263.js new file mode 100644 index 0000000000..12c77d718c --- /dev/null +++ b/assets/js/b4c5bdfe.92ec3263.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4344],{8556:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-14.2/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/14.2/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/processing.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/14.2/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.2/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b647df5a.3c8c159b.js b/assets/js/b647df5a.3c8c159b.js deleted file mode 100644 index f7949f28cd..0000000000 --- a/assets/js/b647df5a.3c8c159b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2624],{7921:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-8.x/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/8.x/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/using-with-babel.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/8.x/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/8.x/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const l={id:"using-with-babel",title:"Using with Babel"},r=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'ts-jest',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>l,x:()=>r});var t=n(6540);const i={},o=t.createContext(i);function l(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function r(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b647df5a.d394a46f.js b/assets/js/b647df5a.d394a46f.js new file mode 100644 index 0000000000..644da98c4a --- /dev/null +++ b/assets/js/b647df5a.d394a46f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2624],{31:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-8.x/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/8.x/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/using-with-babel.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/8.x/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/8.x/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const l={id:"using-with-babel",title:"Using with Babel"},r=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'ts-jest',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>l,x:()=>r});var t=n(6540);const i={},o=t.createContext(i);function l(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function r(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b83f237d.212ef8af.js b/assets/js/b83f237d.212ef8af.js new file mode 100644 index 0000000000..ce980813d7 --- /dev/null +++ b/assets/js/b83f237d.212ef8af.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8930],{5804:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-14.2/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/14.2/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/absolute-imports.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.2/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/14.2/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b83f237d.e714b26f.js b/assets/js/b83f237d.e714b26f.js deleted file mode 100644 index cf1286b903..0000000000 --- a/assets/js/b83f237d.e714b26f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8930],{3350:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-14.2/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/14.2/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/absolute-imports.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/14.2/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/14.2/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c00c612c.b8bba764.js b/assets/js/c00c612c.b8bba764.js new file mode 100644 index 0000000000..a674716eeb --- /dev/null +++ b/assets/js/c00c612c.b8bba764.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5603],{4126:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-10.x/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/10.x/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/getting-started/test-environment.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/10.x/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/10.x/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,c={},d=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c00c612c.d919a0b2.js b/assets/js/c00c612c.d919a0b2.js deleted file mode 100644 index c3b8d357b3..0000000000 --- a/assets/js/c00c612c.d919a0b2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5603],{3828:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"If you look at setup-jest.ts,","source":"@site/versioned_docs/version-10.x/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/10.x/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/getting-started/test-environment.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/10.x/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/10.x/guides/angular-ivy"}}');var r=n(4848),i=n(8453);const o={id:"test-environment",title:"Test environment"},a=void 0,d={},c=[];function l(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,r.jsxs)(t.p,{children:["If you look at ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts",children:(0,r.jsx)(t.code,{children:"setup-jest.ts"})}),",\nwhat we're doing here is we're adding globals required by Angular. With the included ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch",children:"jest-zone-patch"}),"\nwe also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal."]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c1bdbc58.9d4617ce.js b/assets/js/c1bdbc58.9d4617ce.js deleted file mode 100644 index 02fe6182cf..0000000000 --- a/assets/js/c1bdbc58.9d4617ce.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9467],{8945:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-14.0/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/14.0/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/introduction.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.0/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c1bdbc58.fa73e3a0.js b/assets/js/c1bdbc58.fa73e3a0.js new file mode 100644 index 0000000000..4e4ce901b9 --- /dev/null +++ b/assets/js/c1bdbc58.fa73e3a0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9467],{9159:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-14.0/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/14.0/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/introduction.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/14.0/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c44fa306.cd9e8bfb.js b/assets/js/c44fa306.cd9e8bfb.js new file mode 100644 index 0000000000..e5d777c3b0 --- /dev/null +++ b/assets/js/c44fa306.cd9e8bfb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2274],{4044:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-8.x/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/8.x/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/getting-started/presets.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/8.x/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/8.x/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},c=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function l(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with a preset, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsx)(t.tbody,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"jest-preset-angular"})}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"ts-jest"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]})})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular');\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c44fa306.ef143eab.js b/assets/js/c44fa306.ef143eab.js deleted file mode 100644 index 2d430ac064..0000000000 --- a/assets/js/c44fa306.ef143eab.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2274],{8070:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-8.x/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/8.x/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/getting-started/presets.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/8.x/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/8.x/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},c=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function l(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with a preset, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsx)(t.tbody,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"jest-preset-angular"})}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"ts-jest"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]})})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular');\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c49413db.72672b32.js b/assets/js/c49413db.72672b32.js new file mode 100644 index 0000000000..9153c673a9 --- /dev/null +++ b/assets/js/c49413db.72672b32.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1767],{2575:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-10.x/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/10.x/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/esm-support.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/10.x/guides/angular-ivy"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/10.x/guides/jsdom-version"}}');var o=t(4848),r=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:["To use ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,o.jsx)(s.code,{children:"ts-jest"})," config option ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/next/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/next/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:["There is also a ",(0,o.jsx)(s.a,{href:"/jest-preset-angular/docs/10.x/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,o.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,o.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})}),"\n",(0,o.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,o.jsxs)(s.admonition,{type:"tip",children:[(0,o.jsxs)(s.p,{children:["Jest will attempt to load ",(0,o.jsx)(s.strong,{children:"ESM"})," files from ",(0,o.jsx)(s.code,{children:"node_modules"})," with default ",(0,o.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,o.jsx)(s.strong,{children:"ESM"})," built files or ",(0,o.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,o.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,o.jsxs)(s.p,{children:["To fix that, one can use ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,o.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const o={},r=n.createContext(o);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c49413db.ce0f734b.js b/assets/js/c49413db.ce0f734b.js deleted file mode 100644 index 7b2abb6e81..0000000000 --- a/assets/js/c49413db.ce0f734b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1767],{1334:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-10.x/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/10.x/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/esm-support.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/10.x/guides/angular-ivy"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/10.x/guides/jsdom-version"}}');var o=t(4848),r=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:["To use ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,o.jsx)(s.code,{children:"ts-jest"})," config option ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/next/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/next/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:["There is also a ",(0,o.jsx)(s.a,{href:"/jest-preset-angular/docs/10.x/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,o.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,o.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})}),"\n",(0,o.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,o.jsxs)(s.admonition,{type:"tip",children:[(0,o.jsxs)(s.p,{children:["Jest will attempt to load ",(0,o.jsx)(s.strong,{children:"ESM"})," files from ",(0,o.jsx)(s.code,{children:"node_modules"})," with default ",(0,o.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,o.jsx)(s.strong,{children:"ESM"})," built files or ",(0,o.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,o.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,o.jsxs)(s.p,{children:["To fix that, one can use ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,o.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const o={},r=n.createContext(o);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c4ba122c.e20af9ef.js b/assets/js/c4ba122c.e20af9ef.js deleted file mode 100644 index 3b08ff9691..0000000000 --- a/assets/js/c4ba122c.e20af9ef.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4769],{8324:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>b,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-14.2/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/14.2/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/using-with-babel.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/14.2/guides/snapshot-testing"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.2/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(9489),o=n(7227);const i={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// babel.config.js\nmodule.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function b(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),o=n(6494),i=n(2814),u=n(5167),c=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function b(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!b({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return b({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{g&&i(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!b({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>i.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c4ba122c.fcb4165c.js b/assets/js/c4ba122c.fcb4165c.js new file mode 100644 index 0000000000..30242b1b48 --- /dev/null +++ b/assets/js/c4ba122c.fcb4165c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4769],{5747:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-14.2/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/14.2/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/using-with-babel.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/14.2/guides/snapshot-testing"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.2/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(1470),o=n(9365);const i={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// babel.config.js\nmodule.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})}),(0,r.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),o=n(205),i=n(7485),u=n(1682),c=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function b(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,i]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=b({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,o.A)((()=>{g&&i(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=i.indexOf(t),r=o[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;t=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;t=i[n]??i[i.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{i.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c62dfc48.f814772c.js b/assets/js/c62dfc48.f814772c.js new file mode 100644 index 0000000000..a72a5a9dc8 --- /dev/null +++ b/assets/js/c62dfc48.f814772c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[51],{7704:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-14.0/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/14.0/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/troubleshooting.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.0/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})}),"\n",(0,t.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,t.jsxs)(n.p,{children:["Please use Angular ",(0,t.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,t.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,t.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c7279284.2f96c938.js b/assets/js/c7279284.2f96c938.js new file mode 100644 index 0000000000..915a527a37 --- /dev/null +++ b/assets/js/c7279284.2f96c938.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1605],{3063:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>l});const t=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-11.0/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/11.0/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/getting-started/options.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/11.0/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/11.0/getting-started/test-environment"}}');var o=n(4848),r=n(8453);const i={id:"options",title:"Options"},c=void 0,d={},l=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function a(e){const s={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(s.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(s.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(s.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(s.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(s.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(s.p,{children:["More information about ",(0,o.jsx)(s.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsxs)(s.admonition,{type:"important",children:[(0,o.jsxs)(s.p,{children:["Since ",(0,o.jsx)(s.strong,{children:"v9.0.0"}),", ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,o.jsx)(s.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config"]}),(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})]}),"\n",(0,o.jsx)(s.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"const snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})}),"\n",(0,o.jsx)(s.admonition,{type:"important",children:(0,o.jsxs)(s.p,{children:["Jest runs with ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,o.jsx)(s.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,o.jsx)(s.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,o.jsx)(s.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(s.ul,{children:["\n",(0,o.jsxs)(s.li,{children:["we're using some ",(0,o.jsx)(s.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(s.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(s.code,{children:"ts"}),"), HTML (",(0,o.jsx)(s.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(s.code,{children:"js"}),"), JSON (",(0,o.jsx)(s.code,{children:"json"}),") and ESM JavaScript (",(0,o.jsx)(s.code,{children:"mjs"}),") files."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,o.jsx)(s.code,{children:"RegExp"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,o.jsx)(s.code,{children:"package.json"})," definitions."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(s.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(s.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(s.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(s.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(s.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,o.jsx)(s.code,{children:".mjs"})," files which come from ",(0,o.jsx)(s.code,{children:"node_modules"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"transform"'})," \u2013 run every ",(0,o.jsx)(s.code,{children:"TS"}),", ",(0,o.jsx)(s.code,{children:"JS"}),", ",(0,o.jsx)(s.code,{children:"MJS"}),", ",(0,o.jsx)(s.code,{children:"HTML"}),", or ",(0,o.jsx)(s.code,{children:"SVG"})," file through so called ",(0,o.jsx)(s.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>i,x:()=>c});var t=n(6540);const o={},r=t.createContext(o);function i(e){const s=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function c(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c7279284.f7c6a82e.js b/assets/js/c7279284.f7c6a82e.js deleted file mode 100644 index 985984e8ea..0000000000 --- a/assets/js/c7279284.f7c6a82e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1605],{598:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>c,contentTitle:()=>d,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>l});const t=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-11.0/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/11.0/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/getting-started/options.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/11.0/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/11.0/getting-started/test-environment"}}');var o=n(4848),r=n(8453);const i={id:"options",title:"Options"},d=void 0,c={},l=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function a(e){const s={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(s.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(s.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(s.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(s.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(s.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(s.p,{children:["More information about ",(0,o.jsx)(s.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsxs)(s.admonition,{type:"important",children:[(0,o.jsxs)(s.p,{children:["Since ",(0,o.jsx)(s.strong,{children:"v9.0.0"}),", ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,o.jsx)(s.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config"]}),(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})]}),"\n",(0,o.jsx)(s.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"const snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})}),"\n",(0,o.jsx)(s.admonition,{type:"important",children:(0,o.jsxs)(s.p,{children:["Jest runs with ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,o.jsx)(s.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,o.jsx)(s.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,o.jsx)(s.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(s.ul,{children:["\n",(0,o.jsxs)(s.li,{children:["we're using some ",(0,o.jsx)(s.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(s.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(s.code,{children:"ts"}),"), HTML (",(0,o.jsx)(s.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(s.code,{children:"js"}),"), JSON (",(0,o.jsx)(s.code,{children:"json"}),") and ESM JavaScript (",(0,o.jsx)(s.code,{children:"mjs"}),") files."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,o.jsx)(s.code,{children:"RegExp"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,o.jsx)(s.code,{children:"package.json"})," definitions."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(s.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(s.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(s.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(s.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(s.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,o.jsx)(s.code,{children:".mjs"})," files which come from ",(0,o.jsx)(s.code,{children:"node_modules"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"transform"'})," \u2013 run every ",(0,o.jsx)(s.code,{children:"TS"}),", ",(0,o.jsx)(s.code,{children:"JS"}),", ",(0,o.jsx)(s.code,{children:"MJS"}),", ",(0,o.jsx)(s.code,{children:"HTML"}),", or ",(0,o.jsx)(s.code,{children:"SVG"})," file through so called ",(0,o.jsx)(s.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>i,x:()=>d});var t=n(6540);const o={},r=t.createContext(o);function i(e){const s=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function d(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/cd9c57cb.dccd457f.js b/assets/js/cd9c57cb.dccd457f.js deleted file mode 100644 index 644309c07b..0000000000 --- a/assets/js/cd9c57cb.dccd457f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5297],{2803:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-10.x/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/10.x/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/absolute-imports.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/10.x/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/10.x/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/cd9c57cb.e70ee565.js b/assets/js/cd9c57cb.e70ee565.js new file mode 100644 index 0000000000..338303bb25 --- /dev/null +++ b/assets/js/cd9c57cb.e70ee565.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5297],{4710:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-10.x/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/10.x/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/absolute-imports.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/10.x/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/10.x/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d069ae84.1510012e.js b/assets/js/d069ae84.1510012e.js new file mode 100644 index 0000000000..f36ce48818 --- /dev/null +++ b/assets/js/d069ae84.1510012e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1454],{9453:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-11.0/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/11.0/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/angular-13+.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/11.0/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/11.0/guides/esm-support"}}');var t=n(4848),o=n(8453);const i={id:"angular-13+",title:"Angular >=13"},a=void 0,l={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3}];function c(e){const s={a:"a",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,t.jsx)(s.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,t.jsx)(s.code,{children:"CommonJS"})," mode with ",(0,t.jsx)(s.strong,{children:"Angular 13"})," using ",(0,t.jsx)(s.a,{href:"/jest-preset-angular/docs/11.0/getting-started/presets",children:"default preset"}),".\nJest ESM support with ",(0,t.jsx)(s.strong,{children:"Angular 13"})," is new and may have issues."]}),"\n",(0,t.jsxs)(s.p,{children:["Starting from ",(0,t.jsx)(s.strong,{children:"v11.0.0"}),", ",(0,t.jsx)(s.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,t.jsx)(s.strong,{children:"Angular 13"}),":"]}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"ng-jest-resolver"})," is introduced as a custom Jest resolver to resolve ",(0,t.jsx)(s.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"moduleFileExtensions"})," is updated to include ",(0,t.jsx)(s.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,t.jsx)(s.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"transform"})," is updated to include ",(0,t.jsx)(s.code,{children:".mjs"})," extension to transform to ",(0,t.jsx)(s.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(s.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:["Upgrade the project to ",(0,t.jsx)(s.strong,{children:"Angular 13"})," following ",(0,t.jsx)(s.a,{href:"https://update.angular.io/",children:"guide"})]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,t.jsx)(s.p,{children:"there are no migration steps required"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["If one is ",(0,t.jsx)(s.strong,{children:"NOT"})," having ",(0,t.jsx)(s.code,{children:"preset: 'jest-preset-angular'"})," in Jest config, the config needs to be updated with new values for\n",(0,t.jsx)(s.code,{children:"resolver"}),", ",(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," and ",(0,t.jsx)(s.code,{children:"transform"}),":"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})}),"\n",(0,t.jsx)(s.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,t.jsxs)(s.p,{children:["ES Modules support is new and may encounter issues. See ",(0,t.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,t.jsxs)(s.p,{children:["Your ",(0,t.jsx)(s.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"const { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n globals: {\n 'ts-jest': {\n useESM: true,\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n },\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})}),"\n",(0,t.jsxs)(s.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,t.jsx)(s.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,t.jsx)(s.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,t.jsxs)(s.p,{children:["The ",(0,t.jsx)(s.code,{children:"jest-preset-angular/setup-jest"})," file doesn't work with ESM, because it uses ",(0,t.jsx)(s.code,{children:"require"}),". For now you should skip using this file, and replace the contents of your ",(0,t.jsx)(s.code,{children:"setup-jest.ts"})," with:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'zone.js';\nimport 'zone.js/testing';\nimport './jest-global-mocks';\n\nimport { getTestBed } from '@angular/core/testing';\nimport { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';\n\ngetTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\n"})}),"\n",(0,t.jsx)(s.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,t.jsxs)(s.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,t.jsx)(s.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["Angular 13 ESM package format makes Jest resolution not able to resolve the correct ",(0,t.jsx)(s.code,{children:".mjs"})," files. Even though we introduced\n",(0,t.jsx)(s.code,{children:"ng-jest-resolver"})," as a part of the preset, this resolver won't work for all scenarios. One might get Jest error like"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,t.jsxs)(s.p,{children:["To fix this issue, one needs to add ",(0,t.jsx)(s.code,{children:"mjs"})," to ",(0,t.jsx)(s.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})}),"\n",(0,t.jsxs)(s.p,{children:["If the issue still ",(0,t.jsx)(s.strong,{children:"persists"}),", you might need to configure ",(0,t.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#modulenamemapper-objectstring-string--arraystring",children:"moduleNameMapper"}),"\nor extend the behavior the default ",(0,t.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/resolvers/ng-jest-resolver.ts",children:"resolver"})," of this preset."]}),"\n",(0,t.jsx)(s.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,t.jsxs)(s.p,{children:["Besides, the changes in Angular packages themselves, ",(0,t.jsx)(s.strong,{children:"Angular"})," libraries which are built with ",(0,t.jsx)(s.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,t.jsx)(s.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,t.jsx)(s.strong,{children:"CommonJS"})," mode."]}),"\n",(0,t.jsxs)(s.p,{children:["To fix this issue, one should modify ",(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,t.jsx)(s,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>i,x:()=>a});var r=n(6540);const t={},o=r.createContext(t);function i(e){const s=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d069ae84.9a63b295.js b/assets/js/d069ae84.9a63b295.js deleted file mode 100644 index 4b9e0466a3..0000000000 --- a/assets/js/d069ae84.9a63b295.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1454],{7175:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-11.0/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/11.0/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/angular-13+.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/11.0/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/11.0/guides/esm-support"}}');var t=n(4848),o=n(8453);const i={id:"angular-13+",title:"Angular >=13"},a=void 0,l={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3}];function c(e){const s={a:"a",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,t.jsx)(s.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,t.jsx)(s.code,{children:"CommonJS"})," mode with ",(0,t.jsx)(s.strong,{children:"Angular 13"})," using ",(0,t.jsx)(s.a,{href:"/jest-preset-angular/docs/11.0/getting-started/presets",children:"default preset"}),".\nJest ESM support with ",(0,t.jsx)(s.strong,{children:"Angular 13"})," is new and may have issues."]}),"\n",(0,t.jsxs)(s.p,{children:["Starting from ",(0,t.jsx)(s.strong,{children:"v11.0.0"}),", ",(0,t.jsx)(s.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,t.jsx)(s.strong,{children:"Angular 13"}),":"]}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"ng-jest-resolver"})," is introduced as a custom Jest resolver to resolve ",(0,t.jsx)(s.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"moduleFileExtensions"})," is updated to include ",(0,t.jsx)(s.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,t.jsx)(s.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:[(0,t.jsx)(s.code,{children:"transform"})," is updated to include ",(0,t.jsx)(s.code,{children:".mjs"})," extension to transform to ",(0,t.jsx)(s.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(s.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsxs)(s.p,{children:["Upgrade the project to ",(0,t.jsx)(s.strong,{children:"Angular 13"})," following ",(0,t.jsx)(s.a,{href:"https://update.angular.io/",children:"guide"})]}),"\n"]}),"\n",(0,t.jsxs)(s.li,{children:["\n",(0,t.jsx)(s.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,t.jsx)(s.p,{children:"there are no migration steps required"}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["If one is ",(0,t.jsx)(s.strong,{children:"NOT"})," having ",(0,t.jsx)(s.code,{children:"preset: 'jest-preset-angular'"})," in Jest config, the config needs to be updated with new values for\n",(0,t.jsx)(s.code,{children:"resolver"}),", ",(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," and ",(0,t.jsx)(s.code,{children:"transform"}),":"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})}),"\n",(0,t.jsx)(s.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,t.jsxs)(s.p,{children:["ES Modules support is new and may encounter issues. See ",(0,t.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v13",children:"example-app-v13"})," for an example with tests that run using ESM, and using ESM + isolated."]}),"\n",(0,t.jsxs)(s.p,{children:["Your ",(0,t.jsx)(s.code,{children:"jest.config.js"})," should be changed to something like:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"const { pathsToModuleNameMapper } = require('ts-jest/utils');\nconst { paths } = require('./tsconfig.json').compilerOptions;\n\n/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */\nmodule.exports = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n globals: {\n 'ts-jest': {\n useESM: true,\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n },\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n"})}),"\n",(0,t.jsxs)(s.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,t.jsx)(s.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,t.jsx)(s.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'jest-preset-angular/setup-jest';\nimport './jest-global-mocks';\n"})}),"\n",(0,t.jsxs)(s.p,{children:["The ",(0,t.jsx)(s.code,{children:"jest-preset-angular/setup-jest"})," file doesn't work with ESM, because it uses ",(0,t.jsx)(s.code,{children:"require"}),". For now you should skip using this file, and replace the contents of your ",(0,t.jsx)(s.code,{children:"setup-jest.ts"})," with:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-ts",children:"// setup-jest.ts\nimport 'zone.js';\nimport 'zone.js/testing';\nimport './jest-global-mocks';\n\nimport { getTestBed } from '@angular/core/testing';\nimport { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';\n\ngetTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\n"})}),"\n",(0,t.jsx)(s.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,t.jsxs)(s.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,t.jsx)(s.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,t.jsxs)(s.ul,{children:["\n",(0,t.jsxs)(s.li,{children:["Angular 13 ESM package format makes Jest resolution not able to resolve the correct ",(0,t.jsx)(s.code,{children:".mjs"})," files. Even though we introduced\n",(0,t.jsx)(s.code,{children:"ng-jest-resolver"})," as a part of the preset, this resolver won't work for all scenarios. One might get Jest error like"]}),"\n"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,t.jsxs)(s.p,{children:["To fix this issue, one needs to add ",(0,t.jsx)(s.code,{children:"mjs"})," to ",(0,t.jsx)(s.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n"})}),"\n",(0,t.jsxs)(s.p,{children:["If the issue still ",(0,t.jsx)(s.strong,{children:"persists"}),", you might need to configure ",(0,t.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#modulenamemapper-objectstring-string--arraystring",children:"moduleNameMapper"}),"\nor extend the behavior the default ",(0,t.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/blob/main/src/resolvers/ng-jest-resolver.ts",children:"resolver"})," of this preset."]}),"\n",(0,t.jsx)(s.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,t.jsxs)(s.p,{children:["Besides, the changes in Angular packages themselves, ",(0,t.jsx)(s.strong,{children:"Angular"})," libraries which are built with ",(0,t.jsx)(s.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,t.jsx)(s.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,t.jsx)(s.strong,{children:"CommonJS"})," mode."]}),"\n",(0,t.jsxs)(s.p,{children:["To fix this issue, one should modify ",(0,t.jsx)(s.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,t.jsx)(s.pre,{children:(0,t.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,t.jsx)(s,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>i,x:()=>a});var r=n(6540);const t={},o=r.createContext(t);function i(e){const s=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d19b9e8a.629e3e46.js b/assets/js/d19b9e8a.629e3e46.js deleted file mode 100644 index 6f7921531c..0000000000 --- a/assets/js/d19b9e8a.629e3e46.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5240],{475:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/docs/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/next/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/absolute-imports.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/next/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/next/guides/troubleshooting"}}');var n=s(4848),i=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,n.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,n.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,n.jsxs)(t.p,{children:["More information see ",(0,n.jsx)(t.code,{children:"ts-jest"})," ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const n={},i=o.createContext(n);function r(e){const t=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:r(e.components),o.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d19b9e8a.e88ee538.js b/assets/js/d19b9e8a.e88ee538.js new file mode 100644 index 0000000000..c5ce609f58 --- /dev/null +++ b/assets/js/d19b9e8a.e88ee538.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5240],{4521:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>c});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/docs/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/next/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/absolute-imports.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/next/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/next/guides/troubleshooting"}}');var n=s(4848),i=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},c=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,i.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,n.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,n.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,n.jsxs)(t.p,{children:["More information see ",(0,n.jsx)(t.code,{children:"ts-jest"})," ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const n={},i=o.createContext(n);function r(e){const t=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:r(e.components),o.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d1b207fe.5f201ca7.js b/assets/js/d1b207fe.5f201ca7.js deleted file mode 100644 index 5008145f25..0000000000 --- a/assets/js/d1b207fe.5f201ca7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1090],{4351:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-13.0/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/13.0/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/troubleshooting.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/13.0/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})}),"\n",(0,t.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,t.jsxs)(n.p,{children:["Please use Angular ",(0,t.jsx)(n.a,{href:"https://angular.io/api/core/inject",children:"inject"})," instead of ",(0,t.jsx)(n.a,{href:"https://angular.io/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,t.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c62dfc48.365183b8.js b/assets/js/d1b207fe.fcc3dae8.js similarity index 89% rename from assets/js/c62dfc48.365183b8.js rename to assets/js/d1b207fe.fcc3dae8.js index 6d50a9b1dc..c95965f6b4 100644 --- a/assets/js/c62dfc48.365183b8.js +++ b/assets/js/d1b207fe.fcc3dae8.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[51],{4880:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-14.0/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/14.0/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/guides/troubleshooting.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.0/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})}),"\n",(0,t.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,t.jsxs)(n.p,{children:["Please use Angular ",(0,t.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,t.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,t.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1090],{7972:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-13.0/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/13.0/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/troubleshooting.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/13.0/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})}),"\n",(0,t.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,t.jsxs)(n.p,{children:["Please use Angular ",(0,t.jsx)(n.a,{href:"https://angular.io/api/core/inject",children:"inject"})," instead of ",(0,t.jsx)(n.a,{href:"https://angular.io/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,t.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d2df711a.592d21bd.js b/assets/js/d2df711a.592d21bd.js new file mode 100644 index 0000000000..7f21f20947 --- /dev/null +++ b/assets/js/d2df711a.592d21bd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2601],{7498:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-11.0/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/11.0/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/absolute-imports.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/11.0/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/11.0/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d2df711a.695c325b.js b/assets/js/d2df711a.695c325b.js deleted file mode 100644 index d903e700e2..0000000000 --- a/assets/js/d2df711a.695c325b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2601],{9350:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-11.0/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/11.0/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/absolute-imports.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/11.0/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/11.0/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d4836a8e.7c5ead09.js b/assets/js/d4836a8e.7c5ead09.js deleted file mode 100644 index a7a62134ed..0000000000 --- a/assets/js/d4836a8e.7c5ead09.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[106],{3191:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/docs/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/next/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/esm-support.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/next/guides/angular-13+"},"next":{"title":"JSDOM version","permalink":"/jest-preset-angular/docs/next/guides/jsdom-version"}}');var r=s(4848),o=s(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/next/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsx)(t.p,{children:"Besides, there is utility function to ensure that Jest can set up test environment properly."}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>a});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d4836a8e.f08aad97.js b/assets/js/d4836a8e.f08aad97.js new file mode 100644 index 0000000000..b01266e29a --- /dev/null +++ b/assets/js/d4836a8e.f08aad97.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[106],{248:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/docs/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/next/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/guides/esm-support.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/next/guides/angular-13+"},"next":{"title":"JSDOM version","permalink":"/jest-preset-angular/docs/next/guides/jsdom-version"}}');var r=s(4848),o=s(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/next/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsx)(t.p,{children:"Besides, there is utility function to ensure that Jest can set up test environment properly."}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts"',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>a});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d720bb60.590e55e8.js b/assets/js/d720bb60.590e55e8.js new file mode 100644 index 0000000000..7c0b8fecfb --- /dev/null +++ b/assets/js/d720bb60.590e55e8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5596],{6281:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});const s=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-9.x/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/9.x/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/angular-ivy.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/9.x/getting-started/test-environment"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/9.x/guides/esm-support"}}');var r=n(4848),i=n(8453);const o={id:"angular-ivy",title:"Angular Ivy"},a=void 0,c={},l=[];function u(e){const t={code:"code",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["Starting from ",(0,r.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,r.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,r.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," also provides util script to help you to run ",(0,r.jsx)(t.code,{children:"ngcc"})," with Jest but this script only works via the\nJavaScript version of Jest config"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nrequire('jest-preset-angular/ngcc-jest-processor');\n\nmodule.exports = {\n // [...]\n};\n"})})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d720bb60.685933de.js b/assets/js/d720bb60.685933de.js deleted file mode 100644 index 1d22474369..0000000000 --- a/assets/js/d720bb60.685933de.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5596],{2758:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});const s=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-9.x/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/9.x/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/guides/angular-ivy.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/9.x/getting-started/test-environment"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/9.x/guides/esm-support"}}');var r=n(4848),i=n(8453);const o={id:"angular-ivy",title:"Angular Ivy"},a=void 0,c={},l=[];function u(e){const t={code:"code",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["Starting from ",(0,r.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,r.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,r.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," also provides util script to help you to run ",(0,r.jsx)(t.code,{children:"ngcc"})," with Jest but this script only works via the\nJavaScript version of Jest config"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nrequire('jest-preset-angular/ngcc-jest-processor');\n\nmodule.exports = {\n // [...]\n};\n"})})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>a});var s=n(6540);const r={},i=s.createContext(r);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d9330f66.00861d4f.js b/assets/js/d9330f66.00861d4f.js new file mode 100644 index 0000000000..97fc288dfe --- /dev/null +++ b/assets/js/d9330f66.00861d4f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8678],{7587:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-13.0/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/13.0/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/esm-support.md","tags":[],"version":"13.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/13.0/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/13.0/guides/jsdom-version"}}');var r=s(4848),a=s(8453),o=s(1470),i=s(9365);const l={id:"esm-support",title:"ESM Support"},u=void 0,c={},d=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/13.0/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsxs)(t.p,{children:["Besides, there is ",(0,r.jsx)(t.code,{children:"setup-jest.mjs"})," to add to Jest setup file to ensure that Jest can set up test environment properly."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html)$',\n useESM: true,\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},1470:(e,t,s)=>{s.d(t,{A:()=>S});var n=s(6540),r=s(4164),a=s(3104),o=s(6347),i=s(205),l=s(7485),u=s(1682),c=s(679);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,l.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[u,d]=m({queryString:s,groupId:r}),[f,g]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),j=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=s(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,s=l.indexOf(t),r=i[s].value;r!==n&&(u(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;t=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;t=l[s]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:i.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>i});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d9330f66.04da02d0.js b/assets/js/d9330f66.04da02d0.js deleted file mode 100644 index 929e04372d..0000000000 --- a/assets/js/d9330f66.04da02d0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8678],{3344:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-13.0/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/13.0/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-13.0/guides/esm-support.md","tags":[],"version":"13.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/13.0/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/13.0/guides/jsdom-version"}}');var r=s(4848),a=s(8453),o=s(9489),i=s(7227);const l={id:"esm-support",title:"ESM Support"},u=void 0,c={},d=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["To use ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,r.jsx)(t.code,{children:"ts-jest"})," config option ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["There is also a ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/13.0/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["We have ",(0,r.jsx)(t.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,r.jsxs)(t.p,{children:["Besides, there is ",(0,r.jsx)(t.code,{children:"setup-jest.mjs"})," to add to Jest setup file to ensure that Jest can set up test environment properly."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"import 'jest-preset-angular/setup-jest.mjs';\n"})}),"\n",(0,r.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html)$',\n useESM: true,\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n extensionsToTreatAsEsm: ['.ts'],\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n useESM: true,\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,r.jsxs)(t.admonition,{type:"tip",children:[(0,r.jsxs)(t.p,{children:["Jest will attempt to load ",(0,r.jsx)(t.strong,{children:"ESM"})," files from ",(0,r.jsx)(t.code,{children:"node_modules"})," with default ",(0,r.jsx)(t.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,r.jsx)(t.strong,{children:"ESM"})," built files or ",(0,r.jsx)(t.strong,{children:"ESM"})," files which are outside ",(0,r.jsx)(t.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,r.jsxs)(t.p,{children:["To fix that, one can use ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,r.jsx)(t.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,r.jsx)(t.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})}),(0,r.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig = {\n //...\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,s)=>{s.d(t,{A:()=>o});s(6540);var n=s(4164);const r={tabItem:"tabItem_Ymn6"};var a=s(4848);function o(e){let{children:t,hidden:s,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,n.A)(r.tabItem,o),hidden:s,children:t})}},9489:(e,t,s)=>{s.d(t,{A:()=>S});var n=s(6540),r=s(4164),a=s(4245),o=s(6347),i=s(6494),l=s(2814),u=s(5167),c=s(9900);function d(e){return n.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:s}=e;return(0,n.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:s,attributes:n,default:r}}=e;return{value:t,label:s,attributes:n,default:r}}))}(s);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,s])}function h(e){let{value:t,tabValues:s}=e;return s.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:s}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:s}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!s)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:t,groupId:s});return[(0,l.aZ)(a),(0,n.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:s=!1,groupId:r}=e,a=p(e),[o,l]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:s}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=s.find((e=>e.default))??s[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:a}))),[u,d]=m({queryString:s,groupId:r}),[f,g]=function(e){let{groupId:t}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(s);return[r,(0,n.useCallback)((e=>{s&&a.set(e)}),[s,a])]}({groupId:r}),j=(()=>{const e=u??f;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,n.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),g(e)}),[d,g,a]),tabValues:a}}var g=s(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=s(4848);function b(e){let{className:t,block:s,selectedValue:n,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,s=l.indexOf(t),r=i[s].value;r!==n&&(u(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const s=l.indexOf(e.currentTarget)+1;t=l[s]??l[0];break}case"ArrowLeft":{const s=l.indexOf(e.currentTarget)-1;t=l[s]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":s},t),children:i.map((e=>{let{value:t,label:s,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:n===t?0:-1,"aria-selected":n===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":n===t}),children:s??t},t)}))})}function v(e){let{lazy:t,children:s,selectedValue:a}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>i});var n=s(6540);const r={},a=n.createContext(r);function o(e){const t=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d957c22b.3c2b6e64.js b/assets/js/d957c22b.3c2b6e64.js new file mode 100644 index 0000000000..f2d9d9776a --- /dev/null +++ b/assets/js/d957c22b.3c2b6e64.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9353],{5867:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-14.4/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/angular-13+.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/guides/esm-support"}}');var r=t(4848),a=t(8453),o=t(1470),i=t(9365);const l={id:"angular-13+",title:"Angular >=13"},c=void 0,u={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example-apps"})," for the tests that run using ESM mode."]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>S});var s=t(6540),r=t(4164),a=t(3104),o=t(6347),i=t(205),l=t(7485),c=t(1682),u=t(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function g(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function h(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,d]=m({queryString:t,groupId:r}),[h,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,u.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),f(e)}),[d,f,a]),tabValues:a}}var f=t(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>{l.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=h(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function S(e){const n=(0,f.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d957c22b.8cc61010.js b/assets/js/d957c22b.8cc61010.js deleted file mode 100644 index 7a414d0f14..0000000000 --- a/assets/js/d957c22b.8cc61010.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9353],{6833:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/angular-13+","title":"Angular >=13","description":"Angular 13 introduces ESM package format for Angular packages. jest-preset-angular","source":"@site/versioned_docs/version-14.4/guides/angular-13+.md","sourceDirName":"guides","slug":"/guides/angular-13+","permalink":"/jest-preset-angular/docs/guides/angular-13+","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/angular-13+.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-13+","title":"Angular >=13"},"sidebar":"docs","previous":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/guides/angular-ivy"},"next":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/guides/esm-support"}}');var r=t(4848),a=t(8453),o=t(9489),i=t(7227);const l={id:"angular-13+",title:"Angular >=13"},c=void 0,u={},d=[{value:"Migration steps from Angular < 13",id:"migration-steps-from-angular--13",level:2},{value:"Using ES Modules",id:"using-es-modules",level:3},{value:"Potential issues with Angular 13 ESM package format and workaround",id:"potential-issues-with-angular-13-esm-package-format-and-workaround",level:2},{value:"<code>Cannot find modules</code> error when importing any deep paths from Angular ESM format packages",id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",level:3},{value:"Usage with Angular libraries which are built with Angular CLI 13",id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",level:3},{value:"Usage with Ionic 6 or 7",id:"usage-with-ionic-6-or-7",level:3}];function p(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Angular 13"})," introduces ESM package format for Angular packages. ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),"\ncurrently supports testing with Jest in ",(0,r.jsx)(n.code,{children:"CommonJS"})," mode with ",(0,r.jsx)(n.strong,{children:"Angular 13"})," using ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/getting-started/presets",children:"default preset"}),"."]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["With Jest 28 and ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(n.strong,{children:"v12.0.0"}),", ",(0,r.jsx)(n.code,{children:"ng-jest-resolver"})," is no longer required to have in Jest config. This\nresolver is also excluded from our default and default ESM presets."]})}),"\n",(0,r.jsxs)(n.p,{children:["Starting from ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduces a few extra changes to be able to run Jest with ",(0,r.jsx)(n.strong,{children:"Angular 13"}),":"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," is updated to include ",(0,r.jsx)(n.code,{children:"mjs"})," files as accepted module format."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," is added to inform Jest to transform ",(0,r.jsx)(n.code,{children:".mjs"})," files."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"transform"})," is updated to include ",(0,r.jsx)(n.code,{children:".mjs"})," extension to transform to ",(0,r.jsx)(n.code,{children:"CommonJS"})," codes."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"migration-steps-from-angular--13",children:"Migration steps from Angular < 13"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Upgrade the project to ",(0,r.jsx)(n.strong,{children:"Angular 13"})," following ",(0,r.jsx)(n.a,{href:"https://angular.dev/update-guide/",children:"guide"})]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"If one is using the default preset as following:"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.p,{children:"there are no migration steps required"}),"\n",(0,r.jsx)(n.h3,{id:"using-es-modules",children:"Using ES Modules"}),"\n",(0,r.jsxs)(n.p,{children:["ES Modules support is new and may encounter issues. See ",(0,r.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example-apps"})," for the tests that run using ESM mode."]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\nimport { pathsToModuleNameMapper } from 'ts-jest';\nimport { compilerOptions } from './tsconfig.json';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig-esm.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n isolatedModules: true,\n useESM: true,\n },\n ],\n },\n moduleNameMapper: {\n ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),\n tslib: 'tslib/tslib.es6.js',\n },\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsxs)(n.p,{children:["Before upgrading to ng13 and switching to ES Modules, your ",(0,r.jsx)(n.code,{children:"setup-jest.ts"})," file most likely uses the preset ",(0,r.jsx)(n.code,{children:"setup-jest"}),", like the following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv();\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label":"TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv();\n"})})})]}),"\n",(0,r.jsx)(n.h2,{id:"potential-issues-with-angular-13-esm-package-format-and-workaround",children:"Potential issues with Angular 13 ESM package format and workaround"}),"\n",(0,r.jsxs)(n.h3,{id:"cannot-find-modules-error-when-importing-any-deep-paths-from-angular-esm-format-packages",children:[(0,r.jsx)(n.code,{children:"Cannot find modules"})," error when importing any deep paths from Angular ESM format packages"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Cannot find module '@angular/common/locales/xx' from 'src/app/app.component.spec.ts'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one needs to add ",(0,r.jsx)(n.code,{children:"mjs"})," to ",(0,r.jsx)(n.code,{children:"moduleFileExtensions"})," as following"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-angular-libraries-which-are-built-with-angular-cli-13",children:"Usage with Angular libraries which are built with Angular CLI 13"}),"\n",(0,r.jsxs)(n.p,{children:["Besides, the changes in Angular packages themselves, ",(0,r.jsx)(n.strong,{children:"Angular"})," libraries which are built with ",(0,r.jsx)(n.strong,{children:"Angular CLI 13"})," also introduce\nESM package format. Similar to Angular packages, Jest doesn't understand ",(0,r.jsx)(n.code,{children:".mjs"})," files which are in these new format\nlibraries in Jest ",(0,r.jsx)(n.strong,{children:"CommonJS"})," mode."]}),"\n",(0,r.jsxs)(n.p,{children:["To fix this issue, one should modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.h3,{id:"usage-with-ionic-6-or-7",children:"Usage with Ionic 6 or 7"}),"\n",(0,r.jsxs)(n.p,{children:["To support Ionic 6 or 7 you will need to modify ",(0,r.jsx)(n.code,{children:"transformIgnorePatterns"})," to be as following:"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // ...other options\n transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\\\.mjs$))'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var a=t(4848);function o(e){let{children:n,hidden:t,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>S});var s=t(6540),r=t(4164),a=t(4245),o=t(6347),i=t(6494),l=t(2814),c=t(5167),u=t(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function g(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:t}=e;const r=(0,o.W6)(),a=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const n=new URLSearchParams(r.location.search);n.set(a,e),r.replace({...r.location,search:n.toString()})}),[a,r])]}function h(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!g({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:a}))),[c,d]=m({queryString:t,groupId:r}),[h,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,a]=(0,u.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&a.set(e)}),[t,a])]}({groupId:r}),j=(()=>{const e=c??h;return g({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!g({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),f(e)}),[d,f,a]),tabValues:a}}var f=t(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const n=e.currentTarget,t=l.indexOf(n),r=i[t].value;r!==s&&(c(n),o(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:a}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>l.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function y(e){const n=h(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function S(e){const n=(0,f.A)();return(0,x.jsx)(y,{...e,children:d(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/daab97c5.9a3b2179.js b/assets/js/daab97c5.9a3b2179.js deleted file mode 100644 index 31236c6c26..0000000000 --- a/assets/js/daab97c5.9a3b2179.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1555],{1132:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-11.1/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/11.1/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/processing.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/11.1/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/11.1/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/daab97c5.b99fdee7.js b/assets/js/daab97c5.b99fdee7.js new file mode 100644 index 0000000000..d3fe125abf --- /dev/null +++ b/assets/js/daab97c5.b99fdee7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1555],{648:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-11.1/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/11.1/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/processing.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/11.1/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/11.1/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/dd1da75d.2f2e0f37.js b/assets/js/dd1da75d.2f2e0f37.js new file mode 100644 index 0000000000..ecf7e748ff --- /dev/null +++ b/assets/js/dd1da75d.2f2e0f37.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7951],{9747:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>j,frontMatter:()=>c,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"In Jest, a test environment defines the sandbox context in which your tests run.","source":"@site/versioned_docs/version-14.4/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/getting-started/test-environment.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/guides/angular-ivy"}}');var i=n(4848),r=n(8453),o=n(1470),l=n(9365),a=n(4252);const c={id:"test-environment",title:"Test environment"},p=void 0,d={},u=[{value:"Functions",id:"functions",level:2},{value:"<code>setupZoneTestEnv(options)</code>",id:"setupzonetestenvoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Example:",id:"example",level:4},{value:"<code>setupZonelessTestEnv(options)</code>",id:"setupzonelesstestenvoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Example:",id:"example-1",level:4}];function h(e){const t={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.p,{children:"In Jest, a test environment defines the sandbox context in which your tests run.\nFor Angular projects, setting up the correct test environment is essential to ensure compatibility with the\nframework-specific features, such as dependency injection and change detection."}),"\n",(0,i.jsxs)(t.p,{children:[(0,i.jsx)(t.code,{children:"jest-preset-angular"})," provides utility functions to simplify setting up a Jest test environment tailored for Angular projects.\nThese functions support both ",(0,i.jsx)(t.strong,{children:"zone-based"})," and ",(0,i.jsx)(t.strong,{children:"zoneless"})," environments, catering to different testing needs."]}),"\n",(0,i.jsx)(t.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,i.jsx)(a.A,{toc:u.slice(1)}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h3,{id:"setupzonetestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZoneTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that uses ",(0,i.jsx)(t.code,{children:"zone.js"}),", which is the mechanism for tracking asynchronous operations.\nIt is suitable for most Angular applications that rely on ",(0,i.jsx)(t.code,{children:"zone.js"})," for change detection and other framework features."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(t.h3,{id:"setupzonelesstestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZonelessTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that ",(0,i.jsx)(t.strong,{children:"DOESN'T"})," use ",(0,i.jsx)(t.code,{children:"zone.js"}),", as described in ",(0,i.jsx)(t.a,{href:"https://angular.dev/guide/experimental/zoneless",children:"Angular experimental zoneless guide"}),".\nIt is designed for projects that have disabled ",(0,i.jsx)(t.code,{children:"zone.js"}),", which can lead to improved performance and simplified testing."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example-1",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless/index.mjs';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}}}]); \ No newline at end of file diff --git a/assets/js/dd1da75d.e12469a5.js b/assets/js/dd1da75d.e12469a5.js deleted file mode 100644 index 83c145ce8f..0000000000 --- a/assets/js/dd1da75d.e12469a5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7951],{2877:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>j,frontMatter:()=>c,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/test-environment","title":"Test environment","description":"In Jest, a test environment defines the sandbox context in which your tests run.","source":"@site/versioned_docs/version-14.4/getting-started/test-environment.md","sourceDirName":"getting-started","slug":"/getting-started/test-environment","permalink":"/jest-preset-angular/docs/getting-started/test-environment","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/getting-started/test-environment.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"test-environment","title":"Test environment"},"sidebar":"docs","previous":{"title":"Options","permalink":"/jest-preset-angular/docs/getting-started/options"},"next":{"title":"Angular Ivy","permalink":"/jest-preset-angular/docs/guides/angular-ivy"}}');var i=n(4848),r=n(8453),o=n(9489),l=n(7227),a=n(1574);const c={id:"test-environment",title:"Test environment"},p=void 0,d={},u=[{value:"Functions",id:"functions",level:2},{value:"<code>setupZoneTestEnv(options)</code>",id:"setupzonetestenvoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Example:",id:"example",level:4},{value:"<code>setupZonelessTestEnv(options)</code>",id:"setupzonelesstestenvoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Example:",id:"example-1",level:4}];function h(e){const t={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.p,{children:"In Jest, a test environment defines the sandbox context in which your tests run.\nFor Angular projects, setting up the correct test environment is essential to ensure compatibility with the\nframework-specific features, such as dependency injection and change detection."}),"\n",(0,i.jsxs)(t.p,{children:[(0,i.jsx)(t.code,{children:"jest-preset-angular"})," provides utility functions to simplify setting up a Jest test environment tailored for Angular projects.\nThese functions support both ",(0,i.jsx)(t.strong,{children:"zone-based"})," and ",(0,i.jsx)(t.strong,{children:"zoneless"})," environments, catering to different testing needs."]}),"\n",(0,i.jsx)(t.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,i.jsx)(a.A,{toc:u.slice(1)}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h3,{id:"setupzonetestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZoneTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that uses ",(0,i.jsx)(t.code,{children:"zone.js"}),", which is the mechanism for tracking asynchronous operations.\nIt is suitable for most Angular applications that rely on ",(0,i.jsx)(t.code,{children:"zone.js"})," for change detection and other framework features."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs';\n\nsetupZoneTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,i.jsx)(t.h3,{id:"setupzonelesstestenvoptions",children:(0,i.jsx)(t.code,{children:"setupZonelessTestEnv(options)"})}),"\n",(0,i.jsxs)(t.p,{children:["Configures a test environment that ",(0,i.jsx)(t.strong,{children:"DOESN'T"})," use ",(0,i.jsx)(t.code,{children:"zone.js"}),", as described in ",(0,i.jsx)(t.a,{href:"https://angular.dev/guide/experimental/zoneless",children:"Angular experimental zoneless guide"}),".\nIt is designed for projects that have disabled ",(0,i.jsx)(t.code,{children:"zone.js"}),", which can lead to improved performance and simplified testing."]}),"\n",(0,i.jsx)(t.p,{children:"You can customize the environment by providing options as function arguments."}),"\n",(0,i.jsx)(t.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"options"}),(0,i.jsx)(t.strong,{children:"(optional)"}),": An object follows ",(0,i.jsx)(t.a,{href:"https://github.com/angular/angular/blob/a55341b1ab8d2bc4285a4cce59df7fc0b23c0125/packages/core/testing/src/test_bed_common.ts#L95",children:"TestEnvironmentOptions interface"}),", which allows fine-tuning the environment."]}),"\n"]}),"\n",(0,i.jsx)(t.h4,{id:"example-1",children:"Example:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Create a Jest setup file:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript CJS"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="setup-jest.ts" tab={"label": "TypeScript ESM"}',children:"import { setupZonelessTestEnv } from 'jest-preset-angular/setup-env/zoneless/index.mjs';\n\nsetupZonelessTestEnv({\n //...options\n});\n"})})})]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Update your Jest configuration:"}),"\n"]}),"\n",(0,i.jsxs)(o.A,{groupId:"code-examples",children:[(0,i.jsx)(l.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})}),(0,i.jsx)(l.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}}}]); \ No newline at end of file diff --git a/assets/js/dd8b0175.809badf8.js b/assets/js/dd8b0175.809badf8.js new file mode 100644 index 0000000000..a061d1c79c --- /dev/null +++ b/assets/js/dd8b0175.809badf8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2972],{4125:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-11.1/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/11.1/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/jsdom-version.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/11.1/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/11.1/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/dd8b0175.869182ee.js b/assets/js/dd8b0175.869182ee.js deleted file mode 100644 index 0725bfd97a..0000000000 --- a/assets/js/dd8b0175.869182ee.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2972],{2248:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-11.1/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/11.1/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/jsdom-version.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/11.1/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/11.1/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/df70a34a.201b89c1.js b/assets/js/df70a34a.201b89c1.js deleted file mode 100644 index d8f50be121..0000000000 --- a/assets/js/df70a34a.201b89c1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9197],{736:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-10.x/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/10.x/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/using-with-babel.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/10.x/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/10.x/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const l={id:"using-with-babel",title:"Using with Babel"},r=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>l,x:()=>r});var t=n(6540);const i={},o=t.createContext(i);function l(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function r(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/df70a34a.23f587dc.js b/assets/js/df70a34a.23f587dc.js new file mode 100644 index 0000000000..a4442ba626 --- /dev/null +++ b/assets/js/df70a34a.23f587dc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9197],{7267:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>a,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-10.x/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/10.x/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/using-with-babel.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/10.x/guides/jsdom-version"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/10.x/guides/absolute-imports"}}');var i=n(4848),o=n(8453);const r={id:"using-with-babel",title:"Using with Babel"},l=void 0,a={},c=[];function d(e){const s={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["If you wish to use ",(0,i.jsx)(s.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,i.jsxs)(s.ol,{children:["\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install dependencies required by the official Jest documentation for ",(0,i.jsx)(s.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(s.li,{children:["\n",(0,i.jsxs)(s.p,{children:["Install ",(0,i.jsx)(s.code,{children:"@babel/preset-env"})," and add ",(0,i.jsx)(s.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsxs)(s.em,{children:["Note: do not use a ",(0,i.jsx)(s.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,i.jsx)(s.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,i.jsx)(s.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,i.jsxs)(s.ol,{start:"3",children:["\n",(0,i.jsx)(s.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-js",children:"module.exports = {\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>r,x:()=>l});var t=n(6540);const i={},o=t.createContext(i);function r(e){const s=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function l(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),t.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/dff5aaca.23b97e4b.js b/assets/js/dff5aaca.23b97e4b.js deleted file mode 100644 index deeba9dec4..0000000000 --- a/assets/js/dff5aaca.23b97e4b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[744],{5730:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-14.2/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/14.2/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/troubleshooting.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.2/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nrequire('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// jestGlobalMocks.ts\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nwindow.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n resolver: '<rootDir>/src/jest.resolver.js',\n};\n"})}),"\n",(0,t.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,t.jsxs)(n.p,{children:["Please use Angular ",(0,t.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,t.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,t.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/dff5aaca.ce3ca414.js b/assets/js/dff5aaca.ce3ca414.js new file mode 100644 index 0000000000..65a4fee2fe --- /dev/null +++ b/assets/js/dff5aaca.ce3ca414.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[744],{7707:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-14.2/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/14.2/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/guides/troubleshooting.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/14.2/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4},{value:"Inject dependencies with TypeScript interface or exported namespace",id:"inject-dependencies-with-typescript-interface-or-exported-namespace",level:3}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nrequire('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// jestGlobalMocks.ts\nObject.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nwindow.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// setup-jest.ts\nimport $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n resolver: '<rootDir>/src/jest.resolver.js',\n};\n"})}),"\n",(0,t.jsx)(n.h3,{id:"inject-dependencies-with-typescript-interface-or-exported-namespace",children:"Inject dependencies with TypeScript interface or exported namespace"}),"\n",(0,t.jsxs)(n.p,{children:["Please use Angular ",(0,t.jsx)(n.a,{href:"https://angular.dev/api/core/inject",children:"inject"})," instead of ",(0,t.jsx)(n.a,{href:"https://angular.dev/api/core/Inject",children:"@Inject"}),".\nThis is because ",(0,t.jsx)(n.code,{children:"jest-preset-angular"})," has caveat when working with class constructor and decorator."]})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e0a3f9c8.842f8c29.js b/assets/js/e0a3f9c8.842f8c29.js deleted file mode 100644 index f6d650f660..0000000000 --- a/assets/js/e0a3f9c8.842f8c29.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[46],{5509:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-11.1/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/11.1/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/esm-support.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/11.1/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/11.1/guides/jsdom-version"}}');var o=t(4848),r=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:["To use ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,o.jsx)(s.code,{children:"ts-jest"})," config option ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:["There is also a ",(0,o.jsx)(s.a,{href:"/jest-preset-angular/docs/11.1/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,o.jsx)(s.admonition,{type:"tip",children:(0,o.jsxs)(s.p,{children:["We have ",(0,o.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,o.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,o.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})}),"\n",(0,o.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,o.jsxs)(s.admonition,{type:"tip",children:[(0,o.jsxs)(s.p,{children:["Jest will attempt to load ",(0,o.jsx)(s.strong,{children:"ESM"})," files from ",(0,o.jsx)(s.code,{children:"node_modules"})," with default ",(0,o.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,o.jsx)(s.strong,{children:"ESM"})," built files or ",(0,o.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,o.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,o.jsxs)(s.p,{children:["To fix that, one can use ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,o.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const o={},r=n.createContext(o);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e0a3f9c8.908793f9.js b/assets/js/e0a3f9c8.908793f9.js new file mode 100644 index 0000000000..781a221f66 --- /dev/null +++ b/assets/js/e0a3f9c8.908793f9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[46],{1438:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"guides/esm-support","title":"ESM Support","description":"To use jest-preset-angular with ESM support, you\'ll first need to check ESM Jest documentation.","source":"@site/versioned_docs/version-11.1/guides/esm-support.md","sourceDirName":"guides","slug":"/guides/esm-support","permalink":"/jest-preset-angular/docs/11.1/guides/esm-support","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/esm-support.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"esm-support","title":"ESM Support"},"sidebar":"docs","previous":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/11.1/guides/angular-13+"},"next":{"title":"Configure other JSDOM versions","permalink":"/jest-preset-angular/docs/11.1/guides/jsdom-version"}}');var o=t(4848),r=t(8453);const i={id:"esm-support",title:"ESM Support"},a=void 0,l={},c=[{value:"Examples",id:"examples",level:3},{value:"Manual configuration",id:"manual-configuration",level:4},{value:"Use ESM presets",id:"use-esm-presets",level:4}];function d(e){const s={a:"a",admonition:"admonition",code:"code",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:["To use ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," with ESM support, you'll first need to check ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/ecmascript-modules",children:"ESM Jest documentation"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," supports ESM via a ",(0,o.jsx)(s.code,{children:"ts-jest"})," config option ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/useESM",children:"useESM"})," in combination with jest config option ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/en/configuration#extensionstotreatasesm-arraystring",children:"extensionsToTreatAsEsm"}),"."]}),"\n",(0,o.jsxs)(s.p,{children:["There is also a ",(0,o.jsx)(s.a,{href:"/jest-preset-angular/docs/11.1/getting-started/presets",children:"preset"})," to work with ESM."]}),"\n",(0,o.jsx)(s.admonition,{type:"tip",children:(0,o.jsxs)(s.p,{children:["We have ",(0,o.jsx)(s.a,{href:"https://github.com/thymikee/jest-preset-angular/tree/main/examples",children:"example apps"})," which contains base ESM setup to work with Jest and Angular."]})}),"\n",(0,o.jsx)(s.h3,{id:"examples",children:"Examples"}),"\n",(0,o.jsx)(s.h4,{id:"manual-configuration",children:"Manual configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n extensionsToTreatAsEsm: ['.ts'],\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.html$',\n useESM: true,\n },\n },\n};\n"})}),"\n",(0,o.jsx)(s.h4,{id:"use-esm-presets",children:"Use ESM presets"}),"\n",(0,o.jsxs)(s.admonition,{type:"tip",children:[(0,o.jsxs)(s.p,{children:["Jest will attempt to load ",(0,o.jsx)(s.strong,{children:"ESM"})," files from ",(0,o.jsx)(s.code,{children:"node_modules"})," with default ",(0,o.jsx)(s.code,{children:"jest-resolve"})," which usually works for most of the cases.\nHowever, there are cases like Angular libraries ",(0,o.jsx)(s.strong,{children:"ESM"})," built files or ",(0,o.jsx)(s.strong,{children:"ESM"})," files which are outside ",(0,o.jsx)(s.code,{children:"node_modules"})," might not be loaded\ncorrectly."]}),(0,o.jsxs)(s.p,{children:["To fix that, one can use ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," in jest config to instruct Jest to load the correct ",(0,o.jsx)(s.strong,{children:"ESM"})," files or create a\ncustom Jest ",(0,o.jsx)(s.a,{href:"https://jestjs.io/docs/configuration#resolver-string",children:"resolver"}),"."]})]}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n"})})]})}function u(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>a});var n=t(6540);const o={},r=n.createContext(o);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e1715838.0954cdaf.js b/assets/js/e1715838.0954cdaf.js deleted file mode 100644 index 671dda6df9..0000000000 --- a/assets/js/e1715838.0954cdaf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6603],{8343:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-9.x/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/9.x/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/introduction.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/9.x/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e1715838.1d92ad5f.js b/assets/js/e1715838.1d92ad5f.js new file mode 100644 index 0000000000..1ac25d5ef2 --- /dev/null +++ b/assets/js/e1715838.1d92ad5f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6603],{3804:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-9.x/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/9.x/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/introduction.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/9.x/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e36b815f.28711f06.js b/assets/js/e36b815f.28711f06.js deleted file mode 100644 index 45a1d7d367..0000000000 --- a/assets/js/e36b815f.28711f06.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2659],{7957:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-14.4/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/absolute-imports.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e36b815f.c818c8fc.js b/assets/js/e36b815f.c818c8fc.js new file mode 100644 index 0000000000..e6d84be993 --- /dev/null +++ b/assets/js/e36b815f.c818c8fc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2659],{6146:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-14.4/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/absolute-imports.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e59053ae.3b71f4c4.js b/assets/js/e59053ae.3b71f4c4.js deleted file mode 100644 index 0f1d4dce2f..0000000000 --- a/assets/js/e59053ae.3b71f4c4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2008],{9998:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>p,contentTitle:()=>c,default:()=>j,frontMatter:()=>d,metadata:()=>n,toc:()=>h});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"In Jest, presets are pre-defined configurations that help streamline and standardize the process of setting up testing environments.","source":"@site/versioned_docs/version-14.4/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/getting-started/presets.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/getting-started/options"}}');var r=t(4848),i=t(8453),o=t(9489),a=t(7227),l=t(1574);const d={id:"presets",title:"Presets"},c=void 0,p={},h=[{value:"Functions",id:"functions",level:2},{value:"<code>createCjsPreset(options)</code>",id:"createcjspresetoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns",level:4},{value:"Example:",id:"example",level:4},{value:"<code>createEsmPreset(options)</code>",id:"createesmpresetoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Example:",id:"example-1",level:4},{value:"Legacy presets",id:"legacy-presets",level:3},{value:"Example",id:"example-2",level:4}];function g(e){const s={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["In Jest, ",(0,r.jsx)(s.strong,{children:"presets"})," are pre-defined configurations that help streamline and standardize the process of setting up testing environments.\nThey allow developers to quickly configure Jest with specific transformers, file extensions, and other options."]}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," provides very opinionated presets and based on what we found to be useful."]}),"\n",(0,r.jsx)(s.admonition,{type:"important",children:(0,r.jsx)(s.p,{children:"The current best practice for using presets is to call one of the utility functions below to create (and optionally extend) presets. Legacy presets are listed at the bottom of the page."})}),"\n",(0,r.jsx)(s.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,r.jsx)(l.A,{toc:h.slice(1)}),"\n",(0,r.jsx)(s.hr,{}),"\n",(0,r.jsx)(s.h3,{id:"createcjspresetoptions",children:(0,r.jsx)(s.code,{children:"createCjsPreset(options)"})}),"\n",(0,r.jsxs)(s.p,{children:["Create a configuration to process JavaScript/TypeScript/HTML/SVG files (",(0,r.jsx)(s.code,{children:"ts|js|mjs|html|svg"}),")."]}),"\n",(0,r.jsx)(s.h4,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"options"})," (",(0,r.jsx)(s.strong,{children:"OPTIONAL"}),")","\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"tsconfig"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/tsconfig",children:"tsconfig options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"isolatedModules"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules",children:"isolatedModules options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"astTransformers"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/astTransformers",children:"astTransformers options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"diagnostics"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/diagnostics",children:"diagnostics options page"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(s.h4,{id:"returns",children:"Returns"}),"\n",(0,r.jsx)(s.p,{children:"An object contains Jest config:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",children:"type CjsPresetTransformerOptions = {\n tsconfig: string;\n stringifyContentPathRegex: string;\n};\n\ntype CjsPresetType = {\n testEnvironment: string;\n moduleFileExtensions: Array<string>;\n snapshotSerializers: Array<string>;\n transformIgnorePatterns: Array<string>;\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': ['jest-preset-angular', CjsPresetTransformerOptions];\n };\n};\n"})}),"\n",(0,r.jsx)(s.h4,{id:"example",children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import presets from 'jest-preset-angular/presets';\nimport type { Config } from 'jest';\n\nconst presetConfig = presets.createCjsPreset({\n //...options\n});\n\nconst jestConfig: Config = {\n ...presetConfig,\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h3,{id:"createesmpresetoptions",children:(0,r.jsx)(s.code,{children:"createEsmPreset(options)"})}),"\n",(0,r.jsxs)(s.p,{children:["Create a configuration to process JavaScript/TypeScript/HTML/SVG files (",(0,r.jsx)(s.code,{children:"ts|js|html|svg"}),")."]}),"\n",(0,r.jsx)(s.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"options"})," (",(0,r.jsx)(s.strong,{children:"OPTIONAL"}),")","\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"tsconfig"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/tsconfig",children:"tsconfig options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"isolatedModules"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules",children:"isolatedModules options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"astTransformers"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/astTransformers",children:"astTransformers options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"diagnostics"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/diagnostics",children:"diagnostics options page"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(s.h4,{id:"returns-1",children:"Returns"}),"\n",(0,r.jsx)(s.p,{children:"An object contains Jest config:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",children:"type EsmPresetTransformerOptions = {\n tsconfig: string;\n stringifyContentPathRegex: string;\n useEsm: true;\n};\n\ntype EsmPresetType = {\n testEnvironment: string;\n moduleFileExtensions: Array<string>;\n snapshotSerializers: Array<string>;\n extensionsToTreatAsEsm: Array;\n transformIgnorePatterns: Array<string>;\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': ['jest-preset-angular', EsmPresetTransformerOptions];\n };\n};\n"})}),"\n",(0,r.jsx)(s.h4,{id:"example-1",children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import presets from 'jest-preset-angular/presets';\nimport type { Config } from 'jest';\n\nconst presetConfig = presets.createEsmPreset({\n //...options\n});\n\nconst jestConfig: Config = {\n ...presetConfig,\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h3,{id:"legacy-presets",children:"Legacy presets"}),"\n",(0,r.jsx)(s.admonition,{type:"warning",children:(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(s.strong,{children:"DON'T RECOMMEND"})," to use legacy presets because this approach is not flexible to configure Jest configuration.\nThese legacy presets will be removed in the next major release and users are ",(0,r.jsx)(s.strong,{children:"HIGHLY RECOMMENDED"})," to migrate to use the above utility functions."]})}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Preset name"}),(0,r.jsx)(s.th,{children:"Description"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(s.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(s.code,{children:"js"}),", ",(0,r.jsx)(s.code,{children:".ts"}),", ",(0,r.jsx)(s.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(s.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(s.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(s.code,{children:"js"}),", ",(0,r.jsx)(s.code,{children:".ts"}),", ",(0,r.jsx)(s.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(s.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(s.h4,{id:"example-2",children:"Example"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}}}]); \ No newline at end of file diff --git a/assets/js/e59053ae.ff0eafd7.js b/assets/js/e59053ae.ff0eafd7.js new file mode 100644 index 0000000000..636f58f030 --- /dev/null +++ b/assets/js/e59053ae.ff0eafd7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2008],{5500:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>p,contentTitle:()=>c,default:()=>j,frontMatter:()=>d,metadata:()=>n,toc:()=>h});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"In Jest, presets are pre-defined configurations that help streamline and standardize the process of setting up testing environments.","source":"@site/versioned_docs/version-14.4/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/getting-started/presets.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/getting-started/options"}}');var r=t(4848),i=t(8453),o=t(1470),a=t(9365),l=t(4252);const d={id:"presets",title:"Presets"},c=void 0,p={},h=[{value:"Functions",id:"functions",level:2},{value:"<code>createCjsPreset(options)</code>",id:"createcjspresetoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns",level:4},{value:"Example:",id:"example",level:4},{value:"<code>createEsmPreset(options)</code>",id:"createesmpresetoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Example:",id:"example-1",level:4},{value:"Legacy presets",id:"legacy-presets",level:3},{value:"Example",id:"example-2",level:4}];function g(e){const s={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["In Jest, ",(0,r.jsx)(s.strong,{children:"presets"})," are pre-defined configurations that help streamline and standardize the process of setting up testing environments.\nThey allow developers to quickly configure Jest with specific transformers, file extensions, and other options."]}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," provides very opinionated presets and based on what we found to be useful."]}),"\n",(0,r.jsx)(s.admonition,{type:"important",children:(0,r.jsx)(s.p,{children:"The current best practice for using presets is to call one of the utility functions below to create (and optionally extend) presets. Legacy presets are listed at the bottom of the page."})}),"\n",(0,r.jsx)(s.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,r.jsx)(l.A,{toc:h.slice(1)}),"\n",(0,r.jsx)(s.hr,{}),"\n",(0,r.jsx)(s.h3,{id:"createcjspresetoptions",children:(0,r.jsx)(s.code,{children:"createCjsPreset(options)"})}),"\n",(0,r.jsxs)(s.p,{children:["Create a configuration to process JavaScript/TypeScript/HTML/SVG files (",(0,r.jsx)(s.code,{children:"ts|js|mjs|html|svg"}),")."]}),"\n",(0,r.jsx)(s.h4,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"options"})," (",(0,r.jsx)(s.strong,{children:"OPTIONAL"}),")","\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"tsconfig"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/tsconfig",children:"tsconfig options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"isolatedModules"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules",children:"isolatedModules options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"astTransformers"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/astTransformers",children:"astTransformers options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"diagnostics"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/diagnostics",children:"diagnostics options page"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(s.h4,{id:"returns",children:"Returns"}),"\n",(0,r.jsx)(s.p,{children:"An object contains Jest config:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",children:"type CjsPresetTransformerOptions = {\n tsconfig: string;\n stringifyContentPathRegex: string;\n};\n\ntype CjsPresetType = {\n testEnvironment: string;\n moduleFileExtensions: Array<string>;\n snapshotSerializers: Array<string>;\n transformIgnorePatterns: Array<string>;\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': ['jest-preset-angular', CjsPresetTransformerOptions];\n };\n};\n"})}),"\n",(0,r.jsx)(s.h4,{id:"example",children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import presets from 'jest-preset-angular/presets';\nimport type { Config } from 'jest';\n\nconst presetConfig = presets.createCjsPreset({\n //...options\n});\n\nconst jestConfig: Config = {\n ...presetConfig,\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h3,{id:"createesmpresetoptions",children:(0,r.jsx)(s.code,{children:"createEsmPreset(options)"})}),"\n",(0,r.jsxs)(s.p,{children:["Create a configuration to process JavaScript/TypeScript/HTML/SVG files (",(0,r.jsx)(s.code,{children:"ts|js|html|svg"}),")."]}),"\n",(0,r.jsx)(s.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"options"})," (",(0,r.jsx)(s.strong,{children:"OPTIONAL"}),")","\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"tsconfig"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/tsconfig",children:"tsconfig options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"isolatedModules"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules",children:"isolatedModules options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"astTransformers"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/astTransformers",children:"astTransformers options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"diagnostics"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/diagnostics",children:"diagnostics options page"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(s.h4,{id:"returns-1",children:"Returns"}),"\n",(0,r.jsx)(s.p,{children:"An object contains Jest config:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",children:"type EsmPresetTransformerOptions = {\n tsconfig: string;\n stringifyContentPathRegex: string;\n useEsm: true;\n};\n\ntype EsmPresetType = {\n testEnvironment: string;\n moduleFileExtensions: Array<string>;\n snapshotSerializers: Array<string>;\n extensionsToTreatAsEsm: Array;\n transformIgnorePatterns: Array<string>;\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': ['jest-preset-angular', EsmPresetTransformerOptions];\n };\n};\n"})}),"\n",(0,r.jsx)(s.h4,{id:"example-1",children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import presets from 'jest-preset-angular/presets';\nimport type { Config } from 'jest';\n\nconst presetConfig = presets.createEsmPreset({\n //...options\n});\n\nconst jestConfig: Config = {\n ...presetConfig,\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h3,{id:"legacy-presets",children:"Legacy presets"}),"\n",(0,r.jsx)(s.admonition,{type:"warning",children:(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(s.strong,{children:"DON'T RECOMMEND"})," to use legacy presets because this approach is not flexible to configure Jest configuration.\nThese legacy presets will be removed in the next major release and users are ",(0,r.jsx)(s.strong,{children:"HIGHLY RECOMMENDED"})," to migrate to use the above utility functions."]})}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Preset name"}),(0,r.jsx)(s.th,{children:"Description"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(s.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(s.code,{children:"js"}),", ",(0,r.jsx)(s.code,{children:".ts"}),", ",(0,r.jsx)(s.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(s.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(s.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(s.code,{children:"js"}),", ",(0,r.jsx)(s.code,{children:".ts"}),", ",(0,r.jsx)(s.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(s.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(s.h4,{id:"example-2",children:"Example"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}}}]); \ No newline at end of file diff --git a/assets/js/e5a27df7.5fe7eaf0.js b/assets/js/e5a27df7.5fe7eaf0.js new file mode 100644 index 0000000000..7a488d56cb --- /dev/null +++ b/assets/js/e5a27df7.5fe7eaf0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2416],{8159:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-14.4/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/getting-started/options.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/getting-started/test-environment"}}');var r=n(4848),o=n(8453),i=n(1470),a=n(9365);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function p(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(t.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(t.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(t.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(t.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(t.p,{children:["More information about ",(0,r.jsx)(t.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(t.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]})}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),"\n",(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(t.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(t.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(t.code,{children:"esbuild"})," in ",(0,r.jsx)(t.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(t.code,{children:"esbuild"}),", one can do the following:"]}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n snapshotSerializers: [\n 'jest-preset-angular/build/serializers/html-comment',\n 'jest-preset-angular/build/serializers/ng-snapshot',\n 'jest-preset-angular/build/serializers/no-ng-attributes',\n ],\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Jest runs with ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(t.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(t.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["We're using ",(0,r.jsx)(t.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(t.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(t.code,{children:"ts"}),"), HTML (",(0,r.jsx)(t.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(t.code,{children:"js"}),"), JSON (",(0,r.jsx)(t.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(t.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(t.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. See more in ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/guides/snapshot-testing",children:"Snapshot testing"})]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(t.code,{children:".mjs"})," files which come from ",(0,r.jsx)(t.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(t.code,{children:"TS"}),", ",(0,r.jsx)(t.code,{children:"JS"}),", ",(0,r.jsx)(t.code,{children:"MJS"}),", ",(0,r.jsx)(t.code,{children:"HTML"}),", or ",(0,r.jsx)(t.code,{children:"SVG"})," file through so called ",(0,r.jsx)(t.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var o=n(4848);function i(e){let{children:t,hidden:n,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),o=n(3104),i=n(6347),a=n(205),l=n(7485),c=n(1682),d=n(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return u(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,i.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(r.location.search);t.set(o,e),r.replace({...r.location,search:t.toString()})}),[o,r])]}function m(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,o=p(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:o}))),[c,u]=f({queryString:n,groupId:r}),[m,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,o]=(0,d.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:r}),j=(()=>{const e=c??m;return h({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{j&&l(j)}),[j]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),g(e)}),[u,g,o]),tabValues:o}}var g=n(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=n(4848);function b(e){let{className:t,block:n,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const t=e.currentTarget,n=l.indexOf(t),r=a[n].value;r!==s&&(c(t),i(r))},u=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:a.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",j.tabItem,o?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:o}=e;const i=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const r={},o=s.createContext(r);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e5a27df7.b9c2bdee.js b/assets/js/e5a27df7.b9c2bdee.js deleted file mode 100644 index 6b339e356f..0000000000 --- a/assets/js/e5a27df7.b9c2bdee.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2416],{5824:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-14.4/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/getting-started/options.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/getting-started/test-environment"}}');var r=n(4848),o=n(8453),i=n(9489),a=n(7227);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function p(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(t.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(t.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(t.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(t.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(t.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(t.p,{children:["More information about ",(0,r.jsx)(t.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(t.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(t.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]})}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),"\n",(0,r.jsxs)(t.p,{children:["Since ",(0,r.jsx)(t.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(t.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(t.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(t.code,{children:"esbuild"})," in ",(0,r.jsx)(t.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(t.code,{children:"esbuild"}),", one can do the following:"]}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n processWithEsbuild: [<glob_to_files>]\n }\n ]\n }\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n snapshotSerializers: [\n 'jest-preset-angular/build/serializers/html-comment',\n 'jest-preset-angular/build/serializers/ng-snapshot',\n 'jest-preset-angular/build/serializers/no-ng-attributes',\n ],\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["Jest runs with ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(t.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(t.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(t.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["We're using ",(0,r.jsx)(t.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(t.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(t.code,{children:"ts"}),"), HTML (",(0,r.jsx)(t.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(t.code,{children:"js"}),"), JSON (",(0,r.jsx)(t.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(t.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(t.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. See more in ",(0,r.jsx)(t.a,{href:"/jest-preset-angular/docs/guides/snapshot-testing",children:"Snapshot testing"})]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(t.code,{children:".mjs"})," files which come from ",(0,r.jsx)(t.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(t.code,{children:"TS"}),", ",(0,r.jsx)(t.code,{children:"JS"}),", ",(0,r.jsx)(t.code,{children:"MJS"}),", ",(0,r.jsx)(t.code,{children:"HTML"}),", or ",(0,r.jsx)(t.code,{children:"SVG"})," file through so called ",(0,r.jsx)(t.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var o=n(4848);function i(e){let{children:t,hidden:n,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>S});var s=n(6540),r=n(4164),o=n(4245),i=n(6347),a=n(6494),l=n(2814),c=n(5167),d=n(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return u(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,i.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(r.location.search);t.set(o,e),r.replace({...r.location,search:t.toString()})}),[o,r])]}function m(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,o=p(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:o}))),[c,u]=f({queryString:n,groupId:r}),[m,g]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,o]=(0,d.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:r}),j=(()=>{const e=c??m;return h({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{j&&l(j)}),[j]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),g(e)}),[u,g,o]),tabValues:o}}var g=n(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=n(4848);function b(e){let{className:t,block:n,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const t=e.currentTarget,n=l.indexOf(t),r=a[n].value;r!==s&&(c(t),i(r))},u=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:a.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>l.push(e),onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",j.tabItem,o?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:o}=e;const i=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=m(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,x.jsx)(b,{...t,...e}),(0,x.jsx)(v,{...t,...e})]})}function S(e){const t=(0,g.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const r={},o=s.createContext(r);function i(e){const t=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ea131d77.93990663.js b/assets/js/ea131d77.93990663.js deleted file mode 100644 index 5bc4a72d90..0000000000 --- a/assets/js/ea131d77.93990663.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8624],{7138:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-11.1/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/11.1/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/absolute-imports.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/11.1/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/11.1/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ea131d77.d9c6661d.js b/assets/js/ea131d77.d9c6661d.js new file mode 100644 index 0000000000..6ec4da048a --- /dev/null +++ b/assets/js/ea131d77.d9c6661d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8624],{1313:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>u,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the","source":"@site/versioned_docs/version-11.1/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/11.1/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/absolute-imports.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/11.1/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/11.1/guides/troubleshooting"}}');var i=s(4848),n=s(8453);const r={id:"absolute-imports",title:"Absolute Imports"},a=void 0,u={},p=[];function c(e){const t={a:"a",code:"code",p:"p",...(0,n.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["If you wish to use TypeScript path mappings which are defined in ",(0,i.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,i.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config."]}),"\n",(0,i.jsxs)(t.p,{children:["More information see ",(0,i.jsx)(t.code,{children:"ts-jest"})," ",(0,i.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping",children:"paths mapping"})," configuration documentation"]})]})}function d(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>r,x:()=>a});var o=s(6540);const i={},n=o.createContext(i);function r(e){const t=o.useContext(n);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(n.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/eabdbf07.41728050.js b/assets/js/eabdbf07.41728050.js deleted file mode 100644 index 994b9eed51..0000000000 --- a/assets/js/eabdbf07.41728050.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5100],{5990:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/docs/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/next/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/processing.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/next/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/next/getting-started/installation"}}');var o=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,o.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,o.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var n=s(6540);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 c(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)}}}]); \ No newline at end of file diff --git a/assets/js/eabdbf07.959addb9.js b/assets/js/eabdbf07.959addb9.js new file mode 100644 index 0000000000..a729d68afc --- /dev/null +++ b/assets/js/eabdbf07.959addb9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5100],{2997:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/docs/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/next/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/processing.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/next/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/next/getting-started/installation"}}');var o=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,o.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,o.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var n=s(6540);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 c(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)}}}]); \ No newline at end of file diff --git a/assets/js/eae657ee.c98b4b06.js b/assets/js/eae657ee.c98b4b06.js deleted file mode 100644 index 64aa54e04d..0000000000 --- a/assets/js/eae657ee.c98b4b06.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4134],{8075:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>c,contentTitle:()=>d,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>l});const t=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-11.1/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/11.1/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/getting-started/options.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/11.1/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/11.1/getting-started/test-environment"}}');var o=n(4848),r=n(8453);const i={id:"options",title:"Options"},d=void 0,c={},l=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function a(e){const s={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(s.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(s.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(s.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(s.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(s.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(s.p,{children:["More information about ",(0,o.jsx)(s.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsxs)(s.admonition,{type:"important",children:[(0,o.jsxs)(s.p,{children:["Since ",(0,o.jsx)(s.strong,{children:"v9.0.0"}),", ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,o.jsx)(s.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config"]}),(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})]}),"\n",(0,o.jsx)(s.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"const snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})}),"\n",(0,o.jsx)(s.admonition,{type:"important",children:(0,o.jsxs)(s.p,{children:["Jest runs with ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,o.jsx)(s.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,o.jsx)(s.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,o.jsx)(s.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(s.ul,{children:["\n",(0,o.jsxs)(s.li,{children:["we're using some ",(0,o.jsx)(s.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(s.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(s.code,{children:"ts"}),"), HTML (",(0,o.jsx)(s.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(s.code,{children:"js"}),"), JSON (",(0,o.jsx)(s.code,{children:"json"}),") and ESM JavaScript (",(0,o.jsx)(s.code,{children:"mjs"}),") files."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,o.jsx)(s.code,{children:"RegExp"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,o.jsx)(s.code,{children:"package.json"})," definitions."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(s.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(s.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(s.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(s.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(s.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,o.jsx)(s.code,{children:".mjs"})," files which come from ",(0,o.jsx)(s.code,{children:"node_modules"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"transform"'})," \u2013 run every ",(0,o.jsx)(s.code,{children:"TS"}),", ",(0,o.jsx)(s.code,{children:"JS"}),", ",(0,o.jsx)(s.code,{children:"MJS"}),", ",(0,o.jsx)(s.code,{children:"HTML"}),", or ",(0,o.jsx)(s.code,{children:"SVG"})," file through so called ",(0,o.jsx)(s.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>i,x:()=>d});var t=n(6540);const o={},r=t.createContext(o);function i(e){const s=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function d(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/eae657ee.fc74d885.js b/assets/js/eae657ee.fc74d885.js new file mode 100644 index 0000000000..4e55ef80d9 --- /dev/null +++ b/assets/js/eae657ee.fc74d885.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4134],{4880:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>l});const t=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object","source":"@site/versioned_docs/version-11.1/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/11.1/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/getting-started/options.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/11.1/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/11.1/getting-started/test-environment"}}');var o=n(4848),r=n(8453);const i={id:"options",title:"Options"},c=void 0,d={},l=[{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function a(e){const s={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:[(0,o.jsx)(s.code,{children:"jest-preset-angular"})," uses ",(0,o.jsx)(s.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,o.jsx)(s.code,{children:"globals"})," of Jest config object\nin the ",(0,o.jsx)(s.code,{children:"package.json"})," file of your project, or through a ",(0,o.jsx)(s.code,{children:"jest.config.js"}),", or ",(0,o.jsx)(s.code,{children:"jest.config.ts"})," file."]}),"\n",(0,o.jsxs)(s.p,{children:["More information about ",(0,o.jsx)(s.code,{children:"ts-jest"})," options, see ",(0,o.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,o.jsxs)(s.admonition,{type:"important",children:[(0,o.jsxs)(s.p,{children:["Since ",(0,o.jsx)(s.strong,{children:"v9.0.0"}),", ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,o.jsx)(s.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,o.jsx)(s.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config"]}),(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})]}),"\n",(0,o.jsx)(s.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:"const snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n globals: {\n 'ts-jest': {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n },\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',\n },\n};\n"})}),"\n",(0,o.jsx)(s.admonition,{type:"important",children:(0,o.jsxs)(s.p,{children:["Jest runs with ",(0,o.jsx)(s.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,o.jsx)(s.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,o.jsx)(s.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,o.jsx)(s.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,o.jsxs)(s.ul,{children:["\n",(0,o.jsxs)(s.li,{children:["we're using some ",(0,o.jsx)(s.code,{children:'"globals"'})," to pass information about where our tsconfig.json file is that we'd like to be able to transform HTML files through ",(0,o.jsx)(s.code,{children:"ts-jest"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,o.jsx)(s.code,{children:"ts"}),"), HTML (",(0,o.jsx)(s.code,{children:"html"}),"), JavaScript (",(0,o.jsx)(s.code,{children:"js"}),"), JSON (",(0,o.jsx)(s.code,{children:"json"}),") and ESM JavaScript (",(0,o.jsx)(s.code,{children:"mjs"}),") files."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,o.jsx)(s.code,{children:"RegExp"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,o.jsx)(s.code,{children:"package.json"})," definitions."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,o.jsx)(s.code,{children:"ng-reflect-*"}),", ",(0,o.jsx)(s.code,{children:'ng-version="*"'}),", ",(0,o.jsx)(s.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,o.jsx)(s.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,o.jsx)(s.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,o.jsx)(s.code,{children:".mjs"})," files which come from ",(0,o.jsx)(s.code,{children:"node_modules"}),"."]}),"\n",(0,o.jsxs)(s.li,{children:[(0,o.jsx)(s.code,{children:'"transform"'})," \u2013 run every ",(0,o.jsx)(s.code,{children:"TS"}),", ",(0,o.jsx)(s.code,{children:"JS"}),", ",(0,o.jsx)(s.code,{children:"MJS"}),", ",(0,o.jsx)(s.code,{children:"HTML"}),", or ",(0,o.jsx)(s.code,{children:"SVG"})," file through so called ",(0,o.jsx)(s.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function h(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>i,x:()=>c});var t=n(6540);const o={},r=t.createContext(o);function i(e){const s=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function c(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(r.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ebf39289.3821314c.js b/assets/js/ebf39289.3821314c.js deleted file mode 100644 index 8d372db81c..0000000000 --- a/assets/js/ebf39289.3821314c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8715],{670:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-14.0/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/14.0/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/getting-started/options.md","tags":[],"version":"14.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.0/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.0/getting-started/test-environment"}}');var r=t(4848),o=t(8453),i=t(9489),a=t(7227);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function h(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(n.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(n.p,{children:["More information about ",(0,r.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsxs)(n.admonition,{type:"important",children:[(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),(0,r.jsx)(n.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(n.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(n.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(n.code,{children:"esbuild"})," in ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(n.code,{children:"esbuild"}),", one can do the following:"]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n\nexport default jestConfig;\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport snapshotSerializers from 'jest-preset-angular/build/serializers';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["Jest runs with ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["We're using ",(0,r.jsx)(n.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(n.code,{children:"ts"}),"), HTML (",(0,r.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(n.code,{children:"js"}),"), JSON (",(0,r.jsx)(n.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(n.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(n.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,r.jsx)(n.code,{children:"package.json"})," definitions."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,r.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,r.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,r.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(n.code,{children:".mjs"})," files which come from ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(n.code,{children:"TS"}),", ",(0,r.jsx)(n.code,{children:"JS"}),", ",(0,r.jsx)(n.code,{children:"MJS"}),", ",(0,r.jsx)(n.code,{children:"HTML"}),", or ",(0,r.jsx)(n.code,{children:"SVG"})," file through so called ",(0,r.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},7227:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var o=t(4848);function i(e){let{children:n,hidden:t,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),o=t(4245),i=t(6347),a=t(6494),l=t(2814),c=t(5167),d=t(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function j(e){let{queryString:n=!1,groupId:t}=e;const r=(0,i.W6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function f(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=h(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:o}))),[c,u]=j({queryString:t,groupId:r}),[f,m]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=c??f;return p({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{g&&l(g)}),[g]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),m(e)}),[u,m,o]),tabValues:o}}var m=t(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=a[t].value;r!==s&&(c(n),i(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:a.map((e=>{let{value:n,label:t,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>l.push(e),onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:o}=e;const i=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function y(e){const n=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function w(e){const n=(0,m.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var s=t(6540);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ebf39289.8bb0879e.js b/assets/js/ebf39289.8bb0879e.js new file mode 100644 index 0000000000..4d2b792a22 --- /dev/null +++ b/assets/js/ebf39289.8bb0879e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8715],{9546:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-14.0/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/14.0/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.0/getting-started/options.md","tags":[],"version":"14.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.0/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.0/getting-started/test-environment"}}');var r=t(4848),o=t(8453),i=t(1470),a=t(9365);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function h(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(n.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(n.p,{children:["More information about ",(0,r.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsxs)(n.admonition,{type:"important",children:[(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),(0,r.jsx)(n.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(n.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(n.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(n.code,{children:"esbuild"})," in ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(n.code,{children:"esbuild"}),", one can do the following:"]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n\nexport default jestConfig;\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport snapshotSerializers from 'jest-preset-angular/build/serializers';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["Jest runs with ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["We're using ",(0,r.jsx)(n.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(n.code,{children:"ts"}),"), HTML (",(0,r.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(n.code,{children:"js"}),"), JSON (",(0,r.jsx)(n.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(n.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(n.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,r.jsx)(n.code,{children:"package.json"})," definitions."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. Note: by default angular adds\nsome angular-specific attributes to the code (like ",(0,r.jsx)(n.code,{children:"ng-reflect-*"}),", ",(0,r.jsx)(n.code,{children:'ng-version="*"'}),", ",(0,r.jsx)(n.code,{children:"_ngcontent-c*"})," etc).\nThis package provides serializer to remove such attributes. This makes snapshots cleaner and more human-readable.\nTo remove such specific attributes use ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer. You need to add ",(0,r.jsx)(n.code,{children:"no-ng-attributes"})," serializer manually."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(n.code,{children:".mjs"})," files which come from ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(n.code,{children:"TS"}),", ",(0,r.jsx)(n.code,{children:"JS"}),", ",(0,r.jsx)(n.code,{children:"MJS"}),", ",(0,r.jsx)(n.code,{children:"HTML"}),", or ",(0,r.jsx)(n.code,{children:"SVG"})," file through so called ",(0,r.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},9365:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var o=t(4848);function i(e){let{children:n,hidden:t,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),o=t(3104),i=t(6347),a=t(205),l=t(7485),c=t(1682),d=t(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function j(e){let{queryString:n=!1,groupId:t}=e;const r=(0,i.W6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function f(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=h(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:o}))),[c,u]=j({queryString:t,groupId:r}),[f,m]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),g=(()=>{const e=c??f;return p({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{g&&l(g)}),[g]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),m(e)}),[u,m,o]),tabValues:o}}var m=t(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=a[t].value;r!==s&&(c(n),i(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:a.map((e=>{let{value:n,label:t,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:o}=e;const i=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function y(e){const n=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function w(e){const n=(0,m.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var s=t(6540);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ec1d9510.91d9ecd6.js b/assets/js/ec1d9510.91d9ecd6.js new file mode 100644 index 0000000000..427093e702 --- /dev/null +++ b/assets/js/ec1d9510.91d9ecd6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3421],{6418:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-11.0/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/11.0/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/troubleshooting.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/11.0/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ec1d9510.dc9d9713.js b/assets/js/ec1d9510.dc9d9713.js deleted file mode 100644 index 45a8b0a67d..0000000000 --- a/assets/js/ec1d9510.dc9d9713.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3421],{9639:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-11.0/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/11.0/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/guides/troubleshooting.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/11.0/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ec7d5e88.21848047.js b/assets/js/ec7d5e88.21848047.js deleted file mode 100644 index e757ee47df..0000000000 --- a/assets/js/ec7d5e88.21848047.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9896],{7182:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-14.3/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/14.3/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/getting-started/presets.md","tags":[],"version":"14.3","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.3/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/14.3/getting-started/options"}}');var r=n(4848),a=n(8453),o=n(9489),i=n(7227);const l={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"transform"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"transform"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),o=n(6347),i=n(6494),l=n(2814),c=n(5167),u=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:r}),[g,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=l.indexOf(t),r=i[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>l.push(e),onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ec7d5e88.be57bf5b.js b/assets/js/ec7d5e88.be57bf5b.js new file mode 100644 index 0000000000..a56ba7950f --- /dev/null +++ b/assets/js/ec7d5e88.be57bf5b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9896],{7988:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-14.3/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/14.3/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.3/getting-started/presets.md","tags":[],"version":"14.3","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/14.3/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/14.3/getting-started/options"}}');var r=n(4848),a=n(8453),o=n(1470),i=n(9365);const l={id:"presets",title:"Presets"},c=void 0,u={},d=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function p(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"transform"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"transform"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\nimport presets from 'jest-preset-angular/presets';\n\nconst jestConfig: Config = {\n // [...]\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n ...presets.defaultTransformerOptions,\n // [...your overriden options]\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function h(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function o(e){let{children:t,hidden:n,className:o}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,o),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),o=n(6347),i=n(205),l=n(7485),c=n(1682),u=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,c.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function h(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,o.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function g(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[o,l]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!h({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[c,d]=f({queryString:n,groupId:r}),[g,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,u.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),j=(()=>{const e=c??g;return h({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{j&&l(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!h({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var b=n(4848);function x(e){let{className:t,block:n,selectedValue:s,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,a.a_)(),u=e=>{const t=e.currentTarget,n=l.indexOf(t),r=i[n].value;r!==s&&(c(t),o(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,b.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,b.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:u,...a,className:(0,r.A)("tabs__item",j.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,b.jsx)("div",{className:"margin-top--md",children:o.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=g(e);return(0,b.jsxs)("div",{className:(0,r.A)("tabs-container",j.tabList),children:[(0,b.jsx)(x,{...t,...e}),(0,b.jsx)(v,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,b.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ecfacc56.ac9aa5e6.js b/assets/js/ecfacc56.ac9aa5e6.js new file mode 100644 index 0000000000..84f0ff35ab --- /dev/null +++ b/assets/js/ecfacc56.ac9aa5e6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1019],{1811:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-11.0/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/11.0/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/processing.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/11.0/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/11.0/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ecfacc56.c1366c1f.js b/assets/js/ecfacc56.c1366c1f.js deleted file mode 100644 index b642be90fd..0000000000 --- a/assets/js/ecfacc56.c1366c1f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1019],{5746:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-11.0/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/11.0/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/processing.md","tags":[],"version":"11.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/11.0/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/11.0/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ef2f3ccd.1b4146ed.js b/assets/js/ef2f3ccd.1b4146ed.js deleted file mode 100644 index 31ef175a46..0000000000 --- a/assets/js/ef2f3ccd.1b4146ed.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6741],{8761:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-14.2/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/14.2/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/getting-started/options.md","tags":[],"version":"14.2","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.2/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.2/getting-started/test-environment"}}');var r=t(4848),o=t(8453),i=t(9489),a=t(7227);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function h(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(n.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(n.p,{children:["More information about ",(0,r.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsxs)(n.admonition,{type:"important",children:[(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),(0,r.jsx)(n.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(n.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(n.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(n.code,{children:"esbuild"})," in ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(n.code,{children:"esbuild"}),", one can do the following:"]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n\nexport default jestConfig;\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport snapshotSerializers from 'jest-preset-angular/build/serializers';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["Jest runs with ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["We're using ",(0,r.jsx)(n.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(n.code,{children:"ts"}),"), HTML (",(0,r.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(n.code,{children:"js"}),"), JSON (",(0,r.jsx)(n.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(n.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(n.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,r.jsx)(n.code,{children:"package.json"})," definitions."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. See more in ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/14.2/guides/snapshot-testing",children:"Snapshot testing"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(n.code,{children:".mjs"})," files which come from ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(n.code,{children:"TS"}),", ",(0,r.jsx)(n.code,{children:"JS"}),", ",(0,r.jsx)(n.code,{children:"MJS"}),", ",(0,r.jsx)(n.code,{children:"HTML"}),", or ",(0,r.jsx)(n.code,{children:"SVG"})," file through so called ",(0,r.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},7227:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var o=t(4848);function i(e){let{children:n,hidden:t,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:t,children:n})}},9489:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),o=t(4245),i=t(6347),a=t(6494),l=t(2814),c=t(5167),d=t(9900);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function j(e){let{queryString:n=!1,groupId:t}=e;const r=(0,i.W6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function f(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=h(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:o}))),[c,u]=j({queryString:t,groupId:r}),[f,g]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),m=(()=>{const e=c??f;return p({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{m&&l(m)}),[m]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),g(e)}),[u,g,o]),tabValues:o}}var g=t(1062);const m={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=a[t].value;r!==s&&(c(n),i(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:a.map((e=>{let{value:n,label:t,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>l.push(e),onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",m.tabItem,o?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:o}=e;const i=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function y(e){const n=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",m.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function w(e){const n=(0,g.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var s=t(6540);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ef2f3ccd.6a46eb02.js b/assets/js/ef2f3ccd.6a46eb02.js new file mode 100644 index 0000000000..5635b76950 --- /dev/null +++ b/assets/js/ef2f3ccd.6a46eb02.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6741],{6979:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"getting-started/options","title":"Options","description":"jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object","source":"@site/versioned_docs/version-14.2/getting-started/options.md","sourceDirName":"getting-started","slug":"/getting-started/options","permalink":"/jest-preset-angular/docs/14.2/getting-started/options","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.2/getting-started/options.md","tags":[],"version":"14.2","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"options","title":"Options"},"sidebar":"docs","previous":{"title":"Presets","permalink":"/jest-preset-angular/docs/14.2/getting-started/presets"},"next":{"title":"Test environment","permalink":"/jest-preset-angular/docs/14.2/getting-started/test-environment"}}');var r=t(4848),o=t(8453),i=t(1470),a=t(9365);const l={id:"options",title:"Options"},c=void 0,d={},u=[{value:"Processing with esbuild",id:"processing-with-esbuild",level:3},{value:"Exposed configuration",id:"exposed-configuration",level:3},{value:"Brief explanation of config",id:"brief-explanation-of-config",level:3}];function h(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"jest-preset-angular"})," uses ",(0,r.jsx)(n.code,{children:"ts-jest"})," options under the hood, which are located under the ",(0,r.jsx)(n.code,{children:"transform"})," of Jest config object\nin the ",(0,r.jsx)(n.code,{children:"package.json"})," file of your project, or through a ",(0,r.jsx)(n.code,{children:"jest.config.js"}),", or ",(0,r.jsx)(n.code,{children:"jest.config.ts"})," file."]}),"\n",(0,r.jsxs)(n.p,{children:["More information about ",(0,r.jsx)(n.code,{children:"ts-jest"})," options, see ",(0,r.jsx)(n.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options",children:"doc"})]}),"\n",(0,r.jsxs)(n.admonition,{type:"important",children:[(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v9.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," default Jest configuration no longer provides ",(0,r.jsx)(n.code,{children:"moduleNameMapper"}),". If you wish to reuse\nthe old ",(0,r.jsx)(n.code,{children:"moduleNameMapper"})," configuration, you can put this into your Jest config."]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n moduleNameMapper: {\n '^src/(.*)$': '<rootDir>/src/$1',\n '^app/(.*)$': '<rootDir>/src/app/$1',\n '^assets/(.*)$': '<rootDir>/src/assets/$1',\n '^environments/(.*)$': '<rootDir>/src/environments/$1',\n },\n};\n\nexport default jestConfig;\n"})})})]}),(0,r.jsx)(n.h3,{id:"processing-with-esbuild",children:"Processing with esbuild"}),(0,r.jsxs)(n.p,{children:["Since ",(0,r.jsx)(n.strong,{children:"v11.0.0"}),", ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," introduced the usage of ",(0,r.jsx)(n.code,{children:"esbuild"})," to process files besides TypeScript API. By default, all ",(0,r.jsx)(n.code,{children:".mjs"})," files\nwill be processed by ",(0,r.jsx)(n.code,{children:"esbuild"})," in ",(0,r.jsx)(n.code,{children:"jest-preset-angular"}),". To configure extra files to process with ",(0,r.jsx)(n.code,{children:"esbuild"}),", one can do the following:"]}),(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n globals: {\n ngJest: {\n processWithEsbuild: [<glob_to_files>],\n },\n },\n}\n\nexport default jestConfig;\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"exposed-configuration",children:"Exposed configuration"}),"\n",(0,r.jsxs)(i.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"js",label:"JavaScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nconst snapshotSerializers = require('jest-preset-angular/build/serializers');\n\nmodule.exports = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n"})})}),(0,r.jsx)(a.A,{value:"ts",label:"TypeScript",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\nimport snapshotSerializers from 'jest-preset-angular/build/serializers';\n\nconst jestConfig: Config = {\n moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],\n resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',\n snapshotSerializers,\n testEnvironment: 'jsdom',\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:["Jest runs with ",(0,r.jsx)(n.code,{children:"jest-preset-angular"})," neither in browser nor through dev server. It uses ",(0,r.jsx)(n.code,{children:"JSDOM"})," to abstract browser environment hence we depend on\n",(0,r.jsx)(n.code,{children:"JSDOM"})," implementation for real browser features."]})}),"\n",(0,r.jsx)(n.h3,{id:"brief-explanation-of-config",children:"Brief explanation of config"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["We're using ",(0,r.jsx)(n.code,{children:'"transform"'})," to pass information about configuration to use for code compilation with ",(0,r.jsx)(n.code,{children:"ts-jest"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleFileExtensions"'})," \u2013 our modules are TypeScript (",(0,r.jsx)(n.code,{children:"ts"}),"), HTML (",(0,r.jsx)(n.code,{children:"html"}),"), JavaScript (",(0,r.jsx)(n.code,{children:"js"}),"), JSON (",(0,r.jsx)(n.code,{children:"json"}),") and ESM JavaScript (",(0,r.jsx)(n.code,{children:"mjs"}),") files."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"moduleNameMapper"'})," \u2013 if you're using absolute imports here's how to tell Jest where to look for them; uses ",(0,r.jsx)(n.code,{children:"RegExp"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"resolver"'})," - instruct Jest how to resolve entry file based on ",(0,r.jsx)(n.code,{children:"package.json"})," definitions."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"snapshotSerializers"'})," - array of serializers which will be applied to snapshot the code. See more in ",(0,r.jsx)(n.a,{href:"/jest-preset-angular/docs/14.2/guides/snapshot-testing",children:"Snapshot testing"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"testEnvironment"'})," \u2013 the test environment to run on."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transformIgnorePatterns"'}),": instruct Jest to transform any ",(0,r.jsx)(n.code,{children:".mjs"})," files which come from ",(0,r.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'"transform"'})," \u2013 run every ",(0,r.jsx)(n.code,{children:"TS"}),", ",(0,r.jsx)(n.code,{children:"JS"}),", ",(0,r.jsx)(n.code,{children:"MJS"}),", ",(0,r.jsx)(n.code,{children:"HTML"}),", or ",(0,r.jsx)(n.code,{children:"SVG"})," file through so called ",(0,r.jsx)(n.em,{children:"Jest transformer"}),"; this lets Jest understand non-JS syntax."]}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},9365:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(4164);const r={tabItem:"tabItem_Ymn6"};var o=t(4848);function i(e){let{children:n,hidden:t,className:i}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,i),hidden:t,children:n})}},1470:(e,n,t)=>{t.d(n,{A:()=>w});var s=t(6540),r=t(4164),o=t(3104),i=t(6347),a=t(205),l=t(7485),c=t(1682),d=t(679);function u(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.XI)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function j(e){let{queryString:n=!1,groupId:t}=e;const r=(0,i.W6)(),o=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l.aZ)(o),(0,s.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(r.location.search);n.set(o,e),r.replace({...r.location,search:n.toString()})}),[o,r])]}function f(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,o=h(e),[i,l]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:o}))),[c,u]=j({queryString:t,groupId:r}),[f,g]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,o]=(0,d.Dv)(t);return[r,(0,s.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:r}),m=(()=>{const e=c??f;return p({value:e,tabValues:o})?e:null})();(0,a.A)((()=>{m&&l(m)}),[m]);return{selectedValue:i,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),g(e)}),[u,g,o]),tabValues:o}}var g=t(2303);const m={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var x=t(4848);function b(e){let{className:n,block:t,selectedValue:s,selectValue:i,tabValues:a}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,o.a_)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),r=a[t].value;r!==s&&(c(n),i(r))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":t},n),children:a.map((e=>{let{value:n,label:t,attributes:o}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>{l.push(e)},onKeyDown:u,onClick:d,...o,className:(0,r.A)("tabs__item",m.tabItem,o?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:o}=e;const i=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===o));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function y(e){const n=f(e);return(0,x.jsxs)("div",{className:(0,r.A)("tabs-container",m.tabList),children:[(0,x.jsx)(b,{...n,...e}),(0,x.jsx)(v,{...n,...e})]})}function w(e){const n=(0,g.A)();return(0,x.jsx)(y,{...e,children:u(e.children)},String(n))}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var s=t(6540);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f0447160.334fdac1.js b/assets/js/f0447160.334fdac1.js new file mode 100644 index 0000000000..5e4bff59fa --- /dev/null +++ b/assets/js/f0447160.334fdac1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[499],{7727:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-8.x/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/8.x/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/jsdom-version.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/8.x/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/8.x/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f0447160.3ca4f473.js b/assets/js/f0447160.3ca4f473.js deleted file mode 100644 index fcee19c02b..0000000000 --- a/assets/js/f0447160.3ca4f473.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[499],{7482:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-8.x/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/8.x/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/jsdom-version.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/8.x/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/8.x/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f14ecac0.20b5ab59.js b/assets/js/f14ecac0.20b5ab59.js deleted file mode 100644 index 2b5b75b0f6..0000000000 --- a/assets/js/f14ecac0.20b5ab59.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8704],{1073:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-12.0/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/12.0/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/introduction.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/12.0/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f14ecac0.d868567d.js b/assets/js/f14ecac0.d868567d.js new file mode 100644 index 0000000000..b750099210 --- /dev/null +++ b/assets/js/f14ecac0.d868567d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8704],{9088:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","source":"@site/versioned_docs/version-12.0/introduction.md","sourceDirName":".","slug":"/","permalink":"/jest-preset-angular/docs/12.0/","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/introduction.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"introduction","title":"Introduction","description":"Jest preset configuration for Angular projects.","slug":"/"},"sidebar":"docs","next":{"title":"Processing flow","permalink":"/jest-preset-angular/docs/12.0/processing"}}');var o=n(4848),r=n(8453);const i={id:"introduction",title:"Introduction",description:"Jest preset configuration for Angular projects.",slug:"/"},c=void 0,a={},d=[];function l(e){const t={a:"a",admonition:"admonition",code:"code",p:"p",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"jest-preset-angular"})," is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects."]}),"\n",(0,o.jsxs)(t.p,{children:["This is a part of the article: ",(0,o.jsx)(t.a,{href:"https://www.xfive.co/blog/testing-angular-faster-jest/",children:"Testing Angular faster with Jest"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["Starting from ",(0,o.jsx)(t.strong,{children:"v9.0.0"}),", we follow closely native ",(0,o.jsx)(t.code,{children:"Karma + Jasmine"})," implementation which is default provided by\n",(0,o.jsx)(t.code,{children:"@angular/cli"}),". This will make the testing experience with Jest more inline native with Angular testing experience."]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>c});var s=n(6540);const o={},r=s.createContext(o);function i(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f3212b1e.2634897e.js b/assets/js/f3212b1e.2634897e.js deleted file mode 100644 index 5f3beb58a1..0000000000 --- a/assets/js/f3212b1e.2634897e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7511],{8174:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-10.x/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/10.x/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/jsdom-version.md","tags":[],"version":"10.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/10.x/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/10.x/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(9489),i=n(7227);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(4245),a=n(6347),i=n(6494),l=n(2814),u=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>l.push(e),onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f3212b1e.60888de7.js b/assets/js/f3212b1e.60888de7.js new file mode 100644 index 0000000000..9f828c9006 --- /dev/null +++ b/assets/js/f3212b1e.60888de7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7511],{5496:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/jsdom-version","title":"Configure other JSDOM versions","description":"Jest v26+ by default uses JSDOM 16 to support Node 10+.","source":"@site/versioned_docs/version-10.x/guides/jsdom-version.md","sourceDirName":"guides","slug":"/guides/jsdom-version","permalink":"/jest-preset-angular/docs/10.x/guides/jsdom-version","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-10.x/guides/jsdom-version.md","tags":[],"version":"10.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"jsdom-version","title":"Configure other JSDOM versions"},"sidebar":"docs","previous":{"title":"ESM Support","permalink":"/jest-preset-angular/docs/10.x/guides/esm-support"},"next":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/10.x/guides/using-with-babel"}}');var s=n(4848),o=n(8453),a=n(1470),i=n(9365);const l={id:"jsdom-version",title:"Configure other JSDOM versions"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",p:"p",pre:"pre",strong:"strong",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Jest"})," v26+ by default uses ",(0,s.jsx)(t.strong,{children:"JSDOM"})," 16 to support Node 10+."]}),"\n",(0,s.jsxs)(t.p,{children:["If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment\npackage, e.g. ",(0,s.jsx)(t.code,{children:"jest-environment-jsdom-sixteen"})," and edit your Jest config like so:"]}),"\n",(0,s.jsxs)(a.A,{groupId:"code-examples",children:[(0,s.jsx)(i.A,{value:"js",label:"JavaScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n"})})}),(0,s.jsx)(i.A,{value:"ts",label:"TypeScript",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest';\n\nconst jestConfig: Config = {\n testEnvironment: 'jest-environment-jsdom-sixteen',\n};\n\nexport default jestConfig;\n"})})})]}),"\n",(0,s.jsxs)(t.p,{children:["If you use JSDOM v11 or lower, you might have to mock ",(0,s.jsx)(t.code,{children:"localStorage"})," or ",(0,s.jsx)(t.code,{children:"sessionStorage"})," on your own or using some third-party library by loading it in ",(0,s.jsx)(t.code,{children:"setupFilesAfterEnv"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Reference: ",(0,s.jsx)(t.a,{href:"https://jestjs.io/docs/en/configuration.html#testenvironment-string",children:"https://jestjs.io/docs/en/configuration.html#testenvironment-string"}),", ",(0,s.jsx)(t.a,{href:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200",children:"https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200"})]})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var r=n(4164);const s={tabItem:"tabItem_Ymn6"};var o=n(4848);function a(e){let{children:t,hidden:n,className:a}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.A)(s.tabItem,a),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),s=n(4164),o=n(3104),a=n(6347),i=n(205),l=n(7485),u=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:s}}=e;return{value:t,label:n,attributes:r,default:s}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const s=(0,a.W6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,l.aZ)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(s.location.search);t.set(o,e),s.replace({...s.location,search:t.toString()})}),[o,s])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:s}=e,o=p(e),[a,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[u,d]=h({queryString:n,groupId:s}),[f,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[s,o]=(0,c.Dv)(n);return[s,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:s}),g=(()=>{const e=u??f;return m({value:e,tabValues:o})?e:null})();(0,i.A)((()=>{g&&l(g)}),[g]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),d(e),b(e)}),[d,b,o]),tabValues:o}}var b=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:a,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),c=e=>{const t=e.currentTarget,n=l.indexOf(t),s=i[n].value;s!==r&&(u(t),a(s))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=l.indexOf(e.currentTarget)+1;t=l[n]??l[0];break}case"ArrowLeft":{const n=l.indexOf(e.currentTarget)-1;t=l[n]??l[l.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:o}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{l.push(e)},onKeyDown:d,onClick:c,...o,className:(0,s.A)("tabs__item",g.tabItem,o?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:o}=e;const a=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=a.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:(0,s.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:a.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==o})))})}function y(e){const t=f(e);return(0,v.jsxs)("div",{className:(0,s.A)("tabs-container",g.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(x,{...t,...e})]})}function w(e){const t=(0,b.A)();return(0,v.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>i});var r=n(6540);const s={},o=r.createContext(s);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f43def45.0f79f52e.js b/assets/js/f43def45.0f79f52e.js deleted file mode 100644 index 5c2b82c731..0000000000 --- a/assets/js/f43def45.0f79f52e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2656],{340:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>g,frontMatter:()=>u,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-11.1/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/11.1/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/angular-ivy.md","tags":[],"version":"11.1","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/11.1/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/11.1/guides/angular-13+"}}');var a=n(4848),s=n(8453),l=n(9489),o=n(7227);const u={id:"angular-ivy",title:"Angular Ivy"},i=void 0,c={},d=[];function p(e){const t={code:"code",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.p,{children:["Starting from ",(0,a.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,a.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,a.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,a.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest ",(0,a.jsx)(t.code,{children:"global-setup.js"})," file to help you to run ",(0,a.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,a.jsxs)(l.A,{groupId:"code-examples",children:[(0,a.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // [...]\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,a.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest-config';\n\nconst jestConfig: Config = {\n // [...]\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const a={tabItem:"tabItem_Ymn6"};var s=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,s.jsx)("div",{role:"tabpanel",className:(0,r.A)(a.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),a=n(4164),s=n(4245),l=n(6347),o=n(6494),u=n(2814),i=n(5167),c=n(9900);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:a}}=e;return{value:t,label:n,attributes:r,default:a}}))}(n);return function(e){const t=(0,i.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.W6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,u.aZ)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=p(e),[l,u]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:s}))),[i,d]=f({queryString:n,groupId:a}),[h,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Dv)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),b=(()=>{const e=i??h;return g({value:e,tabValues:s})?e:null})();(0,o.A)((()=>{b&&u(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);u(e),d(e),m(e)}),[d,m,s]),tabValues:s}}var m=n(1062);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const u=[],{blockElementScrollPositionUntilNextRender:i}=(0,s.a_)(),c=e=>{const t=e.currentTarget,n=u.indexOf(t),a=o[n].value;a!==r&&(i(t),l(a))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=u.indexOf(e.currentTarget)+1;t=u[n]??u[0];break}case"ArrowLeft":{const n=u.indexOf(e.currentTarget)-1;t=u[n]??u[u.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,a.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:s}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>u.push(e),onKeyDown:d,onClick:c,...s,className:(0,a.A)("tabs__item",b.tabItem,s?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function y(e){let{lazy:t,children:n,selectedValue:s}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===s));return e?(0,r.cloneElement)(e,{className:(0,a.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==s})))})}function x(e){const t=h(e);return(0,v.jsxs)("div",{className:(0,a.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(y,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,v.jsx)(x,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const a={},s=r.createContext(a);function l(e){const t=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:l(e.components),r.createElement(s.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f43def45.6a04eee8.js b/assets/js/f43def45.6a04eee8.js new file mode 100644 index 0000000000..7e1173da88 --- /dev/null +++ b/assets/js/f43def45.6a04eee8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2656],{1524:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>g,frontMatter:()=>u,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/angular-ivy","title":"Angular Ivy","description":"Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the","source":"@site/versioned_docs/version-11.1/guides/angular-ivy.md","sourceDirName":"guides","slug":"/guides/angular-ivy","permalink":"/jest-preset-angular/docs/11.1/guides/angular-ivy","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.1/guides/angular-ivy.md","tags":[],"version":"11.1","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"angular-ivy","title":"Angular Ivy"},"sidebar":"docs","previous":{"title":"Test environment","permalink":"/jest-preset-angular/docs/11.1/getting-started/test-environment"},"next":{"title":"Angular >=13","permalink":"/jest-preset-angular/docs/11.1/guides/angular-13+"}}');var a=n(4848),s=n(8453),l=n(1470),o=n(9365);const u={id:"angular-ivy",title:"Angular Ivy"},i=void 0,c={},d=[];function p(e){const t={code:"code",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.p,{children:["Starting from ",(0,a.jsx)(t.strong,{children:"v9.0.0+"}),", ",(0,a.jsx)(t.code,{children:"jest-preset-angular"})," is fully compatible with Angular Ivy. To make sure that Jest uses the\nAngular Ivy, you must run ",(0,a.jsx)(t.code,{children:"ngcc"})," before running tests. ",(0,a.jsx)(t.code,{children:"ngcc"})," will transform all Angular-format packages to be compatible\nwith Ivy compiler."]}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.code,{children:"jest-preset-angular"})," also provides a Jest ",(0,a.jsx)(t.code,{children:"global-setup.js"})," file to help you to run ",(0,a.jsx)(t.code,{children:"ngcc"})," with Jest. Add to the following section:"]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"to your root Jest config"}),"\n"]}),"\n",(0,a.jsxs)(l.A,{groupId:"code-examples",children:[(0,a.jsx)(o.A,{value:"js",label:"JavaScript",children:(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{className:"language-js",metastring:"tab",children:"// jest.config.js\nmodule.exports = {\n // [...]\n globalSetup: 'jest-preset-angular/global-setup',\n};\n"})})}),(0,a.jsx)(o.A,{value:"ts",label:"TypeScript",children:(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{className:"language-ts",metastring:"tab",children:"// jest.config.ts\nimport type { Config } from 'jest-config';\n\nconst jestConfig: Config = {\n // [...]\n globalSetup: 'jest-preset-angular/global-setup',\n};\n\nexport default jestConfig;\n"})})})]})]})}function g(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var r=n(4164);const a={tabItem:"tabItem_Ymn6"};var s=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,s.jsx)("div",{role:"tabpanel",className:(0,r.A)(a.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var r=n(6540),a=n(4164),s=n(3104),l=n(6347),o=n(205),u=n(7485),i=n(1682),c=n(679);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:a}}=e;return{value:t,label:n,attributes:r,default:a}}))}(n);return function(e){const t=(0,i.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function g(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.W6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,u.aZ)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=p(e),[l,u]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!g({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:s}))),[i,d]=f({queryString:n,groupId:a}),[h,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Dv)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),b=(()=>{const e=i??h;return g({value:e,tabValues:s})?e:null})();(0,o.A)((()=>{b&&u(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!g({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);u(e),d(e),m(e)}),[d,m,s]),tabValues:s}}var m=n(2303);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=n(4848);function j(e){let{className:t,block:n,selectedValue:r,selectValue:l,tabValues:o}=e;const u=[],{blockElementScrollPositionUntilNextRender:i}=(0,s.a_)(),c=e=>{const t=e.currentTarget,n=u.indexOf(t),a=o[n].value;a!==r&&(i(t),l(a))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=u.indexOf(e.currentTarget)+1;t=u[n]??u[0];break}case"ArrowLeft":{const n=u.indexOf(e.currentTarget)-1;t=u[n]??u[u.length-1];break}}t?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,a.A)("tabs",{"tabs--block":n},t),children:o.map((e=>{let{value:t,label:n,attributes:s}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===t?0:-1,"aria-selected":r===t,ref:e=>{u.push(e)},onKeyDown:d,onClick:c,...s,className:(0,a.A)("tabs__item",b.tabItem,s?.className,{"tabs__item--active":r===t}),children:n??t},t)}))})}function y(e){let{lazy:t,children:n,selectedValue:s}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===s));return e?(0,r.cloneElement)(e,{className:(0,a.A)("margin-top--md",e.props.className)}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==s})))})}function x(e){const t=h(e);return(0,v.jsxs)("div",{className:(0,a.A)("tabs-container",b.tabList),children:[(0,v.jsx)(j,{...t,...e}),(0,v.jsx)(y,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,v.jsx)(x,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>o});var r=n(6540);const a={},s=r.createContext(a);function l(e){const t=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:l(e.components),r.createElement(s.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f546eb96.0b4fe835.js b/assets/js/f546eb96.0b4fe835.js new file mode 100644 index 0000000000..738a1333a4 --- /dev/null +++ b/assets/js/f546eb96.0b4fe835.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6370],{8115:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-9.x/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/9.x/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/processing.md","tags":[],"version":"9.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/9.x/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/9.x/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function p(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f546eb96.51277a34.js b/assets/js/f546eb96.51277a34.js deleted file mode 100644 index 40e128babc..0000000000 --- a/assets/js/f546eb96.51277a34.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6370],{3981:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"processing","title":"Processing flow","description":"jest-preset-angular follows the processing flow of ts-jest, see more at https://kulshekhar.github.io/ts-jest/docs/processing","source":"@site/versioned_docs/version-9.x/processing.md","sourceDirName":".","slug":"/processing","permalink":"/jest-preset-angular/docs/9.x/processing","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-9.x/processing.md","tags":[],"version":"9.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"processing","title":"Processing flow"},"sidebar":"docs","previous":{"title":"Introduction","permalink":"/jest-preset-angular/docs/9.x/"},"next":{"title":"Installation","permalink":"/jest-preset-angular/docs/9.x/getting-started/installation"}}');var n=s(4848),r=s(8453);const i={id:"processing",title:"Processing flow"},c=void 0,a={},l=[];function d(e){const t={a:"a",code:"code",p:"p",...(0,r.R)(),...e.components};return(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"jest-preset-angular"})," follows the processing flow of ",(0,n.jsx)(t.code,{children:"ts-jest"}),", see more at ",(0,n.jsx)(t.a,{href:"https://kulshekhar.github.io/ts-jest/docs/processing",children:"https://kulshekhar.github.io/ts-jest/docs/processing"})]})}function p(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var o=s(6540);const n={},r=o.createContext(n);function i(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:i(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/f97daad0.563a1806.js b/assets/js/f97daad0.563a1806.js deleted file mode 100644 index 1cdfb04706..0000000000 --- a/assets/js/f97daad0.563a1806.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5243],{639:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>p});const n=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"TypeScript supports absolute imports. The preset (starting from v3.0.0) by default understands absolute imports referring to src, app, assets and environments directory, so instead:","source":"@site/versioned_docs/version-8.x/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/8.x/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/absolute-imports.md","tags":[],"version":"8.x","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/8.x/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/8.x/guides/troubleshooting"}}');var o=s(4848),r=s(8453);const i={id:"absolute-imports",title:"Absolute Imports"},a=void 0,d={},p=[];function c(e){const t={admonition:"admonition",code:"code",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:["TypeScript supports absolute imports. The preset (starting from v3.0.0) by default understands absolute imports referring to ",(0,o.jsx)(t.code,{children:"src"}),", ",(0,o.jsx)(t.code,{children:"app"}),", ",(0,o.jsx)(t.code,{children:"assets"})," and ",(0,o.jsx)(t.code,{children:"environments"})," directory, so instead:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"import MyComponent from '../../src/app/my.component';\nimport MyStuff from '../../src/testing/my.stuff';\n"})}),"\n",(0,o.jsx)(t.p,{children:"you can use:"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"import MyComponent from 'app/my.component';\nimport MyStuff from 'src/testing/my.stuff';\n"})}),"\n",(0,o.jsxs)(t.p,{children:["However, if your directory structure differ from that provided by ",(0,o.jsx)(t.code,{children:"angular-cli"})," you can adjust ",(0,o.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-json5",children:"{\n jest: {\n moduleNameMapper: {\n 'app/(.*)': '<rootDir>/src/to/app/$1', // override default, why not\n 'testing/(.*)': '<rootDir>/app/testing/$1', // add new mapping\n },\n },\n}\n"})}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["If you wish to use any absolute import paths which are defined in ",(0,o.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,o.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config"]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>a});var n=s(6540);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 a(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)}}}]); \ No newline at end of file diff --git a/assets/js/f97daad0.bdabcf59.js b/assets/js/f97daad0.bdabcf59.js new file mode 100644 index 0000000000..aa44070eff --- /dev/null +++ b/assets/js/f97daad0.bdabcf59.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5243],{560:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>p});const n=JSON.parse('{"id":"guides/absolute-imports","title":"Absolute Imports","description":"TypeScript supports absolute imports. The preset (starting from v3.0.0) by default understands absolute imports referring to src, app, assets and environments directory, so instead:","source":"@site/versioned_docs/version-8.x/guides/absolute-imports.md","sourceDirName":"guides","slug":"/guides/absolute-imports","permalink":"/jest-preset-angular/docs/8.x/guides/absolute-imports","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-8.x/guides/absolute-imports.md","tags":[],"version":"8.x","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"absolute-imports","title":"Absolute Imports"},"sidebar":"docs","previous":{"title":"Using with Babel","permalink":"/jest-preset-angular/docs/8.x/guides/using-with-babel"},"next":{"title":"Troubleshooting","permalink":"/jest-preset-angular/docs/8.x/guides/troubleshooting"}}');var o=s(4848),r=s(8453);const i={id:"absolute-imports",title:"Absolute Imports"},a=void 0,d={},p=[];function c(e){const t={admonition:"admonition",code:"code",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:["TypeScript supports absolute imports. The preset (starting from v3.0.0) by default understands absolute imports referring to ",(0,o.jsx)(t.code,{children:"src"}),", ",(0,o.jsx)(t.code,{children:"app"}),", ",(0,o.jsx)(t.code,{children:"assets"})," and ",(0,o.jsx)(t.code,{children:"environments"})," directory, so instead:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"import MyComponent from '../../src/app/my.component';\nimport MyStuff from '../../src/testing/my.stuff';\n"})}),"\n",(0,o.jsx)(t.p,{children:"you can use:"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"import MyComponent from 'app/my.component';\nimport MyStuff from 'src/testing/my.stuff';\n"})}),"\n",(0,o.jsxs)(t.p,{children:["However, if your directory structure differ from that provided by ",(0,o.jsx)(t.code,{children:"angular-cli"})," you can adjust ",(0,o.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-json5",children:"{\n jest: {\n moduleNameMapper: {\n 'app/(.*)': '<rootDir>/src/to/app/$1', // override default, why not\n 'testing/(.*)': '<rootDir>/app/testing/$1', // add new mapping\n },\n },\n}\n"})}),"\n",(0,o.jsx)(t.admonition,{type:"important",children:(0,o.jsxs)(t.p,{children:["If you wish to use any absolute import paths which are defined in ",(0,o.jsx)(t.code,{children:"paths"})," of your tsconfig, make sure that you create the\nsimilar mapping for ",(0,o.jsx)(t.code,{children:"moduleNameMapper"})," in Jest config"]})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>a});var n=s(6540);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 a(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)}}}]); \ No newline at end of file diff --git a/assets/js/fa17a3e5.80c989de.js b/assets/js/fa17a3e5.f3f22079.js similarity index 94% rename from assets/js/fa17a3e5.80c989de.js rename to assets/js/fa17a3e5.f3f22079.js index 6a5c08c544..68d6448957 100644 --- a/assets/js/fa17a3e5.80c989de.js +++ b/assets/js/fa17a3e5.f3f22079.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8054],{8350:(e,s,t)=>{t.r(s),t.d(s,{default:()=>d});var n=t(4783),i=t(7639),r=t(7784);t(6540);const l=JSON.parse('["14.4","14.3","14.2","14.0","13.0","12.0","11.1","11.0","10.x","9.x","8.x"]');var a=t(4848);const d=function(){const{siteConfig:e}=(0,i.A)(),s={label:l[0],path:"https://thymikee.github.io/jest-preset-angular/docs"},t=l.slice(1).map((e=>({label:e,path:`https://thymikee.github.io/jest-preset-angular/docs/${e}`}))),d="Next",o="https://thymikee.github.io/jest-preset-angular/docs/next",c=`https://github.com/${e.organizationName}/${e.projectName}`;return(0,a.jsx)(r.A,{title:"Versions",description:"jest-preset-angular Versions page listing all documented site versions",children:(0,a.jsxs)("main",{className:"container margin-vert--lg",children:[(0,a.jsx)("h1",{children:"jest-preset-angular documentation versions"}),(0,a.jsxs)("div",{className:"margin-bottom--lg",children:[(0,a.jsx)("h3",{id:"next",children:"Next version (Unreleased)"}),(0,a.jsx)("p",{children:"Here you can find the documentation for work-in-process unreleased version."}),(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:d}),(0,a.jsx)("td",{children:(0,a.jsx)(n.A,{to:o,children:"Documentation"})}),(0,a.jsx)("td",{children:(0,a.jsx)("a",{href:`${c}/blob/main/CHANGELOG.md`,children:"Release Notes"})})]})})})]}),(0,a.jsxs)("div",{className:"margin-bottom--lg",children:[(0,a.jsx)("h3",{id:"latest",children:"Latest version (Stable)"}),(0,a.jsx)("p",{children:"Here you can find the documentation for current released version."}),(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:s.label}),(0,a.jsx)("td",{children:(0,a.jsx)(n.A,{to:s.path,children:"Documentation"})}),(0,a.jsx)("td",{children:(0,a.jsx)("a",{href:`${c}/blob/main/CHANGELOG.md`,children:"Release Notes"})})]})})})]}),t.length&&(0,a.jsxs)("div",{className:"margin-bottom--lg",children:[(0,a.jsx)("h3",{id:"archive",children:"Past versions (Not maintained anymore)"}),(0,a.jsx)("p",{children:"Here you can find documentation for previous versions of Docusaurus."}),(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:t.map((e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:e.label}),(0,a.jsx)("td",{children:(0,a.jsx)(n.A,{to:e.path,children:"Documentation"})}),(0,a.jsx)("td",{children:(0,a.jsx)("a",{href:`${c}/blob/main/CHANGELOG.md`,children:"Release Notes"})})]},e.label)))})})]})]})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8054],{3303:(e,s,t)=>{t.r(s),t.d(s,{default:()=>d});var n=t(8774),i=t(4586),r=t(1957);t(6540);const l=JSON.parse('["14.4","14.3","14.2","14.0","13.0","12.0","11.1","11.0","10.x","9.x","8.x"]');var a=t(4848);const d=function(){const{siteConfig:e}=(0,i.A)(),s={label:l[0],path:"https://thymikee.github.io/jest-preset-angular/docs"},t=l.slice(1).map((e=>({label:e,path:`https://thymikee.github.io/jest-preset-angular/docs/${e}`}))),d="Next",o="https://thymikee.github.io/jest-preset-angular/docs/next",c=`https://github.com/${e.organizationName}/${e.projectName}`;return(0,a.jsx)(r.A,{title:"Versions",description:"jest-preset-angular Versions page listing all documented site versions",children:(0,a.jsxs)("main",{className:"container margin-vert--lg",children:[(0,a.jsx)("h1",{children:"jest-preset-angular documentation versions"}),(0,a.jsxs)("div",{className:"margin-bottom--lg",children:[(0,a.jsx)("h3",{id:"next",children:"Next version (Unreleased)"}),(0,a.jsx)("p",{children:"Here you can find the documentation for work-in-process unreleased version."}),(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:d}),(0,a.jsx)("td",{children:(0,a.jsx)(n.A,{to:o,children:"Documentation"})}),(0,a.jsx)("td",{children:(0,a.jsx)("a",{href:`${c}/blob/main/CHANGELOG.md`,children:"Release Notes"})})]})})})]}),(0,a.jsxs)("div",{className:"margin-bottom--lg",children:[(0,a.jsx)("h3",{id:"latest",children:"Latest version (Stable)"}),(0,a.jsx)("p",{children:"Here you can find the documentation for current released version."}),(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:s.label}),(0,a.jsx)("td",{children:(0,a.jsx)(n.A,{to:s.path,children:"Documentation"})}),(0,a.jsx)("td",{children:(0,a.jsx)("a",{href:`${c}/blob/main/CHANGELOG.md`,children:"Release Notes"})})]})})})]}),t.length&&(0,a.jsxs)("div",{className:"margin-bottom--lg",children:[(0,a.jsx)("h3",{id:"archive",children:"Past versions (Not maintained anymore)"}),(0,a.jsx)("p",{children:"Here you can find documentation for previous versions of Docusaurus."}),(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:t.map((e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:e.label}),(0,a.jsx)("td",{children:(0,a.jsx)(n.A,{to:e.path,children:"Documentation"})}),(0,a.jsx)("td",{children:(0,a.jsx)("a",{href:`${c}/blob/main/CHANGELOG.md`,children:"Release Notes"})})]},e.label)))})})]})]})})}}}]); \ No newline at end of file diff --git a/assets/js/fa9f2ace.edfa5c22.js b/assets/js/fa9f2ace.edfa5c22.js new file mode 100644 index 0000000000..655df081c5 --- /dev/null +++ b/assets/js/fa9f2ace.edfa5c22.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[742],{5034:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"The presets","source":"@site/versioned_docs/version-11.0/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/11.0/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-11.0/getting-started/presets.md","tags":[],"version":"11.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/11.0/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/11.0/getting-started/options"}}');var r=s(4848),o=s(8453);const i={id:"presets",title:"Presets"},d=void 0,a={},l=[{value:"The presets",id:"the-presets",level:3},{value:"Basic usage",id:"basic-usage",level:3},{value:"Advanced",id:"advanced",level:3}];function c(e){const t={admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h3,{id:"the-presets",children:"The presets"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular"})," comes with 2 presets, covering most of the project's base configuration:"]}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Preset name"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(t.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(t.code,{children:"js"}),", ",(0,r.jsx)(t.code,{children:".ts"}),", ",(0,r.jsx)(t.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(t.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"basic-usage",children:"Basic usage"}),"\n",(0,r.jsxs)(t.p,{children:["In most cases, simply setting the ",(0,r.jsx)(t.code,{children:"preset"})," key to the desired preset name in your Jest config should be enough to start\nusing TypeScript with Jest (assuming you added ",(0,r.jsx)(t.code,{children:"jest-preset-angular"})," to your ",(0,r.jsx)(t.code,{children:"devDependencies"})," of course):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // [...]\n // Replace `jest-preset-angular` with the preset you want to use\n // from the above list\n preset: 'jest-preset-angular',\n};\n"})}),"\n",(0,r.jsx)(t.h3,{id:"advanced",children:"Advanced"}),"\n",(0,r.jsxs)(t.p,{children:["All presets come with default ",(0,r.jsx)(t.code,{children:"ts-jest"})," config options.\nIf you want to override any of the options, you'll need to use the JavaScript version of Jest config,\ncopy the original options and override the options you need:"]}),"\n",(0,r.jsx)(t.admonition,{type:"important",children:(0,r.jsxs)(t.p,{children:["If you choose to override ",(0,r.jsx)(t.code,{children:"globals"})," in order to point at a specific tsconfig, you will need to make sure that original ",(0,r.jsx)(t.code,{children:"ts-jest"}),"\noptions provided through the default preset are defined to the ",(0,r.jsx)(t.code,{children:"globals.ts-jest"})," section too, otherwise you will get\nerrors."]})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"// jest.config.js\nconst { defaults: jestNgPreset } = require('jest-preset-angular/presets');\n// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')\n\nmodule.exports = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:["Or through TypeScript (if ",(0,r.jsx)(t.code,{children:"ts-node"})," is installed):"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"// jest.config.ts\nimport type { InitialOptionsTsJest } from 'ts-jest/dist/types';\nimport { defaults as jestNgPreset } from 'jest-preset-angular/presets';\n// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'\n\nconst config: InitialOptionsTsJest = {\n // [...]\n globals: {\n 'ts-jest': {\n ...jestNgPreset.globals['ts-jest'],\n // [...your overriden options]\n },\n },\n};\n\nexport default config;\n"})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>d});var n=s(6540);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/fbd32610.10da846f.js b/assets/js/fbd32610.10da846f.js deleted file mode 100644 index 0e3cabd80b..0000000000 --- a/assets/js/fbd32610.10da846f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6543],{406:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>b,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-14.4/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/using-with-babel.md","tags":[],"version":"14.4","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/guides/snapshot-testing"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(9489),i=n(7227);const o={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:'title="babel.config.js"',children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function b(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},9489:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(4245),l=n(6347),i=n(6494),o=n(2814),u=n(5167),c=n(9900);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function b(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!b({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return b({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{g&&o(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!b({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(1062);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>o.push(e),onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/fbd32610.d9f43b70.js b/assets/js/fbd32610.d9f43b70.js new file mode 100644 index 0000000000..bb5e3ec333 --- /dev/null +++ b/assets/js/fbd32610.d9f43b70.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6543],{9570:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>b,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"guides/using-with-babel","title":"Using with Babel","description":"If you wish to use Babel, you need to say jest to transpile such files manually.","source":"@site/versioned_docs/version-14.4/guides/using-with-babel.md","sourceDirName":"guides","slug":"/guides/using-with-babel","permalink":"/jest-preset-angular/docs/guides/using-with-babel","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-14.4/guides/using-with-babel.md","tags":[],"version":"14.4","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"using-with-babel","title":"Using with Babel"},"sidebar":"docs","previous":{"title":"Snapshot testing","permalink":"/jest-preset-angular/docs/guides/snapshot-testing"},"next":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/guides/absolute-imports"}}');var r=n(4848),a=n(8453),l=n(1470),i=n(9365);const o={id:"using-with-babel",title:"Using with Babel"},u=void 0,c={},d=[];function p(e){const t={a:"a",code:"code",em:"em",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(t.p,{children:["If you wish to use ",(0,r.jsx)(t.code,{children:"Babel"}),", you need to say jest to transpile such files manually."]}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install dependencies required by the official Jest documentation for ",(0,r.jsx)(t.a,{href:"https://jest-bot.github.io/jest/docs/babel.html",children:"Babel integration"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Install ",(0,r.jsx)(t.code,{children:"@babel/preset-env"})," and add ",(0,r.jsx)(t.code,{children:"babel.config.js"})," (or modify existing if needed) with the following content:"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:'title="babel.config.js"',children:"module.exports = function (api) {\n api.cache(true);\n\n const presets = ['@babel/preset-env'];\n const plugins = [];\n\n return {\n presets,\n plugins,\n };\n};\n"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsxs)(t.em,{children:["Note: do not use a ",(0,r.jsx)(t.code,{children:".babelrc"})," file otherwise the packages that you specify in the next step will not be picked up. CF ",(0,r.jsx)(t.a,{href:"https://babeljs.io/docs/en/configuration#what-s-your-use-case",children:"Babel documentation"})," and the comment ",(0,r.jsx)(t.code,{children:"You want to compile node_modules? babel.config.js is for you!"})]}),"."]}),"\n",(0,r.jsxs)(t.ol,{start:"3",children:["\n",(0,r.jsx)(t.li,{children:"Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):"}),"\n"]}),"\n",(0,r.jsxs)(l.A,{groupId:"code-examples",children:[(0,r.jsx)(i.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(i.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n //...\n transform: {\n '^.+\\\\.(ts|html)$': 'jest-preset-angular',\n '^.+\\\\.js$': 'babel-jest',\n },\n};\n\nexport default jestConfig;\n"})})})]})]})}function b(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},9365:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var s=n(4164);const r={tabItem:"tabItem_Ymn6"};var a=n(4848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,a.jsx)("div",{role:"tabpanel",className:(0,s.A)(r.tabItem,l),hidden:n,children:t})}},1470:(e,t,n)=>{n.d(t,{A:()=>w});var s=n(6540),r=n(4164),a=n(3104),l=n(6347),i=n(205),o=n(7485),u=n(1682),c=n(679);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function p(e){const{values:t,children:n}=e;return(0,s.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:s,default:r}}=e;return{value:t,label:n,attributes:s,default:r}}))}(n);return function(e){const t=(0,u.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function b(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),a=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,o.aZ)(a),(0,s.useCallback)((e=>{if(!a)return;const t=new URLSearchParams(r.location.search);t.set(a,e),r.replace({...r.location,search:t.toString()})}),[a,r])]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,a=p(e),[l,o]=(0,s.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!b({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const s=n.find((e=>e.default))??n[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:t,tabValues:a}))),[u,d]=h({queryString:n,groupId:r}),[f,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,a]=(0,c.Dv)(n);return[r,(0,s.useCallback)((e=>{n&&a.set(e)}),[n,a])]}({groupId:r}),g=(()=>{const e=u??f;return b({value:e,tabValues:a})?e:null})();(0,i.A)((()=>{g&&o(g)}),[g]);return{selectedValue:l,selectValue:(0,s.useCallback)((e=>{if(!b({value:e,tabValues:a}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),m(e)}),[d,m,a]),tabValues:a}}var m=n(2303);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=n(4848);function v(e){let{className:t,block:n,selectedValue:s,selectValue:l,tabValues:i}=e;const o=[],{blockElementScrollPositionUntilNextRender:u}=(0,a.a_)(),c=e=>{const t=e.currentTarget,n=o.indexOf(t),r=i[n].value;r!==s&&(u(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=o.indexOf(e.currentTarget)+1;t=o[n]??o[0];break}case"ArrowLeft":{const n=o.indexOf(e.currentTarget)-1;t=o[n]??o[o.length-1];break}}t?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:a}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,ref:e=>{o.push(e)},onKeyDown:d,onClick:c,...a,className:(0,r.A)("tabs__item",g.tabItem,a?.className,{"tabs__item--active":s===t}),children:n??t},t)}))})}function x(e){let{lazy:t,children:n,selectedValue:a}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,s.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,s.cloneElement)(e,{key:t,hidden:e.props.value!==a})))})}function y(e){const t=f(e);return(0,j.jsxs)("div",{className:(0,r.A)("tabs-container",g.tabList),children:[(0,j.jsx)(v,{...t,...e}),(0,j.jsx)(x,{...t,...e})]})}function w(e){const t=(0,m.A)();return(0,j.jsx)(y,{...e,children:d(e.children)},String(t))}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var s=n(6540);const r={},a=s.createContext(r);function l(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/fc80686b.26ca8247.js b/assets/js/fc80686b.26ca8247.js deleted file mode 100644 index 885b3adbcc..0000000000 --- a/assets/js/fc80686b.26ca8247.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2440],{6105:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>p,contentTitle:()=>c,default:()=>j,frontMatter:()=>d,metadata:()=>n,toc:()=>h});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"In Jest, presets are pre-defined configurations that help streamline and standardize the process of setting up testing environments.","source":"@site/docs/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/next/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/getting-started/presets.md","tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/next/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/next/getting-started/options"}}');var r=t(4848),i=t(8453),o=t(9489),a=t(7227),l=t(1574);const d={id:"presets",title:"Presets"},c=void 0,p={},h=[{value:"Functions",id:"functions",level:2},{value:"<code>createCjsPreset(options)</code>",id:"createcjspresetoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns",level:4},{value:"Example:",id:"example",level:4},{value:"<code>createEsmPreset(options)</code>",id:"createesmpresetoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Example:",id:"example-1",level:4},{value:"Legacy presets",id:"legacy-presets",level:3},{value:"Example",id:"example-2",level:4}];function g(e){const s={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["In Jest, ",(0,r.jsx)(s.strong,{children:"presets"})," are pre-defined configurations that help streamline and standardize the process of setting up testing environments.\nThey allow developers to quickly configure Jest with specific transformers, file extensions, and other options."]}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," provides very opinionated presets and based on what we found to be useful."]}),"\n",(0,r.jsx)(s.admonition,{type:"important",children:(0,r.jsx)(s.p,{children:"The current best practice for using presets is to call one of the utility functions below to create (and optionally extend) presets. Legacy presets are listed at the bottom of the page."})}),"\n",(0,r.jsx)(s.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,r.jsx)(l.A,{toc:h.slice(1)}),"\n",(0,r.jsx)(s.hr,{}),"\n",(0,r.jsx)(s.h3,{id:"createcjspresetoptions",children:(0,r.jsx)(s.code,{children:"createCjsPreset(options)"})}),"\n",(0,r.jsxs)(s.p,{children:["Create a configuration to process JavaScript/TypeScript/HTML/SVG files (",(0,r.jsx)(s.code,{children:"ts|js|mjs|html|svg"}),")."]}),"\n",(0,r.jsx)(s.h4,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"options"})," (",(0,r.jsx)(s.strong,{children:"OPTIONAL"}),")","\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"tsconfig"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/tsconfig",children:"tsconfig options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"isolatedModules"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules",children:"isolatedModules options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"astTransformers"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/astTransformers",children:"astTransformers options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"diagnostics"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/diagnostics",children:"diagnostics options page"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(s.h4,{id:"returns",children:"Returns"}),"\n",(0,r.jsx)(s.p,{children:"An object contains Jest config:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",children:"type CjsPresetTransformerOptions = {\n tsconfig: string;\n stringifyContentPathRegex: string;\n};\n\ntype CjsPresetType = {\n testEnvironment: string;\n moduleFileExtensions: Array<string>;\n snapshotSerializers: Array<string>;\n transformIgnorePatterns: Array<string>;\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': ['jest-preset-angular', CjsPresetTransformerOptions];\n };\n};\n"})}),"\n",(0,r.jsx)(s.h4,{id:"example",children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import presets from 'jest-preset-angular/presets';\nimport type { Config } from 'jest';\n\nconst presetConfig = presets.createCjsPreset({\n //...options\n});\n\nconst jestConfig: Config = {\n ...presetConfig,\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h3,{id:"createesmpresetoptions",children:(0,r.jsx)(s.code,{children:"createEsmPreset(options)"})}),"\n",(0,r.jsxs)(s.p,{children:["Create a configuration to process JavaScript/TypeScript/HTML/SVG files (",(0,r.jsx)(s.code,{children:"ts|js|html|svg"}),")."]}),"\n",(0,r.jsx)(s.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"options"})," (",(0,r.jsx)(s.strong,{children:"OPTIONAL"}),")","\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"tsconfig"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/tsconfig",children:"tsconfig options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"isolatedModules"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules",children:"isolatedModules options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"astTransformers"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/astTransformers",children:"astTransformers options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"diagnostics"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/diagnostics",children:"diagnostics options page"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(s.h4,{id:"returns-1",children:"Returns"}),"\n",(0,r.jsx)(s.p,{children:"An object contains Jest config:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",children:"type EsmPresetTransformerOptions = {\n tsconfig: string;\n stringifyContentPathRegex: string;\n useEsm: true;\n};\n\ntype EsmPresetType = {\n testEnvironment: string;\n moduleFileExtensions: Array<string>;\n snapshotSerializers: Array<string>;\n extensionsToTreatAsEsm: Array;\n transformIgnorePatterns: Array<string>;\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': ['jest-preset-angular', EsmPresetTransformerOptions];\n };\n};\n"})}),"\n",(0,r.jsx)(s.h4,{id:"example-1",children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import presets from 'jest-preset-angular/presets';\nimport type { Config } from 'jest';\n\nconst presetConfig = presets.createEsmPreset({\n //...options\n});\n\nconst jestConfig: Config = {\n ...presetConfig,\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h3,{id:"legacy-presets",children:"Legacy presets"}),"\n",(0,r.jsx)(s.admonition,{type:"warning",children:(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(s.strong,{children:"DON'T RECOMMEND"})," to use legacy presets because this approach is not flexible to configure Jest configuration.\nThese legacy presets will be removed in the next major release and users are ",(0,r.jsx)(s.strong,{children:"HIGHLY RECOMMENDED"})," to migrate to use the above utility functions."]})}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Preset name"}),(0,r.jsx)(s.th,{children:"Description"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(s.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(s.code,{children:"js"}),", ",(0,r.jsx)(s.code,{children:".ts"}),", ",(0,r.jsx)(s.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(s.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(s.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(s.code,{children:"js"}),", ",(0,r.jsx)(s.code,{children:".ts"}),", ",(0,r.jsx)(s.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(s.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(s.h4,{id:"example-2",children:"Example"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}}}]); \ No newline at end of file diff --git a/assets/js/fc80686b.49156ad8.js b/assets/js/fc80686b.49156ad8.js new file mode 100644 index 0000000000..f30e5ebf77 --- /dev/null +++ b/assets/js/fc80686b.49156ad8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2440],{4160:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>p,contentTitle:()=>c,default:()=>j,frontMatter:()=>d,metadata:()=>n,toc:()=>h});const n=JSON.parse('{"id":"getting-started/presets","title":"Presets","description":"In Jest, presets are pre-defined configurations that help streamline and standardize the process of setting up testing environments.","source":"@site/docs/getting-started/presets.md","sourceDirName":"getting-started","slug":"/getting-started/presets","permalink":"/jest-preset-angular/docs/next/getting-started/presets","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/docs/getting-started/presets.md","tags":[],"version":"current","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"presets","title":"Presets"},"sidebar":"docs","previous":{"title":"Installation","permalink":"/jest-preset-angular/docs/next/getting-started/installation"},"next":{"title":"Options","permalink":"/jest-preset-angular/docs/next/getting-started/options"}}');var r=t(4848),i=t(8453),o=t(1470),a=t(9365),l=t(4252);const d={id:"presets",title:"Presets"},c=void 0,p={},h=[{value:"Functions",id:"functions",level:2},{value:"<code>createCjsPreset(options)</code>",id:"createcjspresetoptions",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns",level:4},{value:"Example:",id:"example",level:4},{value:"<code>createEsmPreset(options)</code>",id:"createesmpresetoptions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Example:",id:"example-1",level:4},{value:"Legacy presets",id:"legacy-presets",level:3},{value:"Example",id:"example-2",level:4}];function g(e){const s={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["In Jest, ",(0,r.jsx)(s.strong,{children:"presets"})," are pre-defined configurations that help streamline and standardize the process of setting up testing environments.\nThey allow developers to quickly configure Jest with specific transformers, file extensions, and other options."]}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," provides very opinionated presets and based on what we found to be useful."]}),"\n",(0,r.jsx)(s.admonition,{type:"important",children:(0,r.jsx)(s.p,{children:"The current best practice for using presets is to call one of the utility functions below to create (and optionally extend) presets. Legacy presets are listed at the bottom of the page."})}),"\n",(0,r.jsx)(s.h2,{id:"functions",children:"Functions"}),"\n","\n",(0,r.jsx)(l.A,{toc:h.slice(1)}),"\n",(0,r.jsx)(s.hr,{}),"\n",(0,r.jsx)(s.h3,{id:"createcjspresetoptions",children:(0,r.jsx)(s.code,{children:"createCjsPreset(options)"})}),"\n",(0,r.jsxs)(s.p,{children:["Create a configuration to process JavaScript/TypeScript/HTML/SVG files (",(0,r.jsx)(s.code,{children:"ts|js|mjs|html|svg"}),")."]}),"\n",(0,r.jsx)(s.h4,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"options"})," (",(0,r.jsx)(s.strong,{children:"OPTIONAL"}),")","\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"tsconfig"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/tsconfig",children:"tsconfig options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"isolatedModules"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules",children:"isolatedModules options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"astTransformers"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/astTransformers",children:"astTransformers options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"diagnostics"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/diagnostics",children:"diagnostics options page"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(s.h4,{id:"returns",children:"Returns"}),"\n",(0,r.jsx)(s.p,{children:"An object contains Jest config:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",children:"type CjsPresetTransformerOptions = {\n tsconfig: string;\n stringifyContentPathRegex: string;\n};\n\ntype CjsPresetType = {\n testEnvironment: string;\n moduleFileExtensions: Array<string>;\n snapshotSerializers: Array<string>;\n transformIgnorePatterns: Array<string>;\n transform: {\n '^.+\\\\.(ts|js|mjs|html|svg)$': ['jest-preset-angular', CjsPresetTransformerOptions];\n };\n};\n"})}),"\n",(0,r.jsx)(s.h4,{id:"example",children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.ts"',children:"import presets from 'jest-preset-angular/presets';\nimport type { Config } from 'jest';\n\nconst presetConfig = presets.createCjsPreset({\n //...options\n});\n\nconst jestConfig: Config = {\n ...presetConfig,\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h3,{id:"createesmpresetoptions",children:(0,r.jsx)(s.code,{children:"createEsmPreset(options)"})}),"\n",(0,r.jsxs)(s.p,{children:["Create a configuration to process JavaScript/TypeScript/HTML/SVG files (",(0,r.jsx)(s.code,{children:"ts|js|html|svg"}),")."]}),"\n",(0,r.jsx)(s.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"options"})," (",(0,r.jsx)(s.strong,{children:"OPTIONAL"}),")","\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"tsconfig"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/tsconfig",children:"tsconfig options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"isolatedModules"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules",children:"isolatedModules options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"astTransformers"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/astTransformers",children:"astTransformers options page"})]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.code,{children:"diagnostics"}),": see more at ",(0,r.jsx)(s.a,{href:"https://kulshekhar.github.io/ts-jest/docs/getting-started/options/diagnostics",children:"diagnostics options page"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(s.h4,{id:"returns-1",children:"Returns"}),"\n",(0,r.jsx)(s.p,{children:"An object contains Jest config:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",children:"type EsmPresetTransformerOptions = {\n tsconfig: string;\n stringifyContentPathRegex: string;\n useEsm: true;\n};\n\ntype EsmPresetType = {\n testEnvironment: string;\n moduleFileExtensions: Array<string>;\n snapshotSerializers: Array<string>;\n extensionsToTreatAsEsm: Array;\n transformIgnorePatterns: Array<string>;\n transform: {\n '^.+\\\\.(ts|js|html|svg)$': ['jest-preset-angular', EsmPresetTransformerOptions];\n };\n};\n"})}),"\n",(0,r.jsx)(s.h4,{id:"example-1",children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts"',children:"import presets from 'jest-preset-angular/presets';\nimport type { Config } from 'jest';\n\nconst presetConfig = presets.createEsmPreset({\n //...options\n});\n\nconst jestConfig: Config = {\n ...presetConfig,\n};\n\nexport default jestConfig;\n"})}),"\n",(0,r.jsx)(s.h3,{id:"legacy-presets",children:"Legacy presets"}),"\n",(0,r.jsx)(s.admonition,{type:"warning",children:(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular"})," ",(0,r.jsx)(s.strong,{children:"DON'T RECOMMEND"})," to use legacy presets because this approach is not flexible to configure Jest configuration.\nThese legacy presets will be removed in the next major release and users are ",(0,r.jsx)(s.strong,{children:"HIGHLY RECOMMENDED"})," to migrate to use the above utility functions."]})}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Preset name"}),(0,r.jsx)(s.th,{children:"Description"})]})}),(0,r.jsxs)(s.tbody,{children:[(0,r.jsxs)(s.tr,{children:[(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular/presets/default"}),(0,r.jsx)("br",{}),"or ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})]}),(0,r.jsxs)(s.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(s.code,{children:"js"}),", ",(0,r.jsx)(s.code,{children:".ts"}),", ",(0,r.jsx)(s.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(s.strong,{children:"CommonJS"})," syntax."]})]}),(0,r.jsxs)(s.tr,{children:[(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.code,{children:"jest-preset-angular/presets/defaults-esm"}),(0,r.jsx)("br",{})]}),(0,r.jsxs)(s.td,{children:["TypeScript, JavaScript and HTML files (",(0,r.jsx)(s.code,{children:"js"}),", ",(0,r.jsx)(s.code,{children:".ts"}),", ",(0,r.jsx)(s.code,{children:".html"}),") will be transformed by ",(0,r.jsx)(s.code,{children:"jest-preset-angular"})," to ",(0,r.jsx)(s.strong,{children:"ESM"})," syntax."]})]})]})]}),"\n",(0,r.jsx)(s.h4,{id:"example-2",children:"Example"}),"\n",(0,r.jsxs)(o.A,{groupId:"code-examples",children:[(0,r.jsx)(a.A,{value:"typescript-cjs",label:"TypeScript CJS",children:(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.ts" tab={"label": "TypeScript CJS"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular',\n};\n\nexport default jestConfig;\n"})})}),(0,r.jsx)(a.A,{value:"typescript-esm",label:"TypeScript ESM",children:(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-ts",metastring:'title="jest.config.mts" tab={"label": "TypeScript ESM"}',children:"import type { Config } from 'jest';\n\nconst jestConfig: Config = {\n preset: 'jest-preset-angular/presets/defaults-esm',\n};\n\nexport default jestConfig;\n"})})})]})]})}function j(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}}}]); \ No newline at end of file diff --git a/assets/js/fea96f18.715bd36c.js b/assets/js/fea96f18.715bd36c.js deleted file mode 100644 index a8d969b73b..0000000000 --- a/assets/js/fea96f18.715bd36c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3309],{500:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-12.0/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/12.0/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/troubleshooting.md","tags":[],"version":"12.0","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1733918475000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/12.0/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/fea96f18.e8c94212.js b/assets/js/fea96f18.e8c94212.js new file mode 100644 index 0000000000..3b04011e4c --- /dev/null +++ b/assets/js/fea96f18.e8c94212.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3309],{7125:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"guides/troubleshooting","title":"Troubleshooting","description":"You can check Jest troubleshooting guide","source":"@site/versioned_docs/version-12.0/guides/troubleshooting.md","sourceDirName":"guides","slug":"/guides/troubleshooting","permalink":"/jest-preset-angular/docs/12.0/guides/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/thymikee/jest-preset-angular/edit/main/website/versioned_docs/version-12.0/guides/troubleshooting.md","tags":[],"version":"12.0","lastUpdatedBy":"renovate[bot]","lastUpdatedAt":1733918489000,"frontMatter":{"id":"troubleshooting","title":"Troubleshooting"},"sidebar":"docs","previous":{"title":"Absolute Imports","permalink":"/jest-preset-angular/docs/12.0/guides/absolute-imports"}}');var t=s(4848),o=s(8453);const i={id:"troubleshooting",title:"Troubleshooting"},a=void 0,l={},d=[{value:"Common issues",id:"common-issues",level:2},{value:"Can't resolve all parameters for SomeClass(?)",id:"cant-resolve-all-parameters-for-someclass",level:3},{value:"@Input() bindings are not reflected into fixture when <code>ChangeDetectionStrategy.OnPush</code> is used",id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",level:3},{value:"The animation trigger "transformMenu" has failed",id:"the-animation-trigger-transformmenu-has-failed",level:3},{value:"Unexpected token [import|export|other]",id:"unexpected-token-importexportother",level:3},{value:"Allow vendor libraries like jQuery, etc...",id:"allow-vendor-libraries-like-jquery-etc",level:3},{value:"Coverage fail but tests pass",id:"coverage-fail-but-tests-pass",level:3},{value:"Resolver needed for some javascript library or nested dependencies",id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",level:3},{value:"Javascript library",id:"javascript-library",level:4},{value:"Nested dependency (<code>node_modules</code> package within another package <code>node_nodules</code>)",id:"nested-dependency-node_modules-package-within-another-package-node_nodules",level:4},{value:"Resolution",id:"resolution",level:4}];function c(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["You can check Jest ",(0,t.jsx)(n.a,{href:"https://jestjs.io/docs/en/troubleshooting",children:"troubleshooting guide"})]}),"\n",(0,t.jsx)(n.h2,{id:"common-issues",children:"Common issues"}),"\n",(0,t.jsxs)(n.p,{children:["Problems may arise if you're using custom builds (this preset is tailored for ",(0,t.jsx)(n.code,{children:"angular-cli"})," as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs."]}),"\n",(0,t.jsx)(n.h3,{id:"cant-resolve-all-parameters-for-someclass",children:"Can't resolve all parameters for SomeClass(?)"}),"\n",(0,t.jsxs)(n.p,{children:["With Angular 8 and higher, a ",(0,t.jsx)(n.a,{href:"https://github.com/thymikee/jest-preset-angular/issues/288",children:"change to the way the Angular CLI works"})," may be causing your metadata to be lost. You can update your ",(0,t.jsx)(n.code,{children:"tsconfig.spec.json"})," to include the ",(0,t.jsx)(n.code,{children:"emitDecoratorMetadata"})," compiler option:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:' "compilerOptions": {\n "emitDecoratorMetadata": true\n'})}),"\n",(0,t.jsxs)(n.p,{children:["In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in ",(0,t.jsx)(n.code,{children:"core-js"}),". We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install ",(0,t.jsx)(n.code,{children:"core-js"})," and import the reflection library in your ",(0,t.jsx)(n.code,{children:"setup-jest.ts"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"require('core-js/es/reflect');\nrequire('core-js/proposals/reflect-metadata');\n"})}),"\n",(0,t.jsx)(n.p,{children:"Note that this might also be related to other issues with the dependency injection and parameter type reflection."}),"\n",(0,t.jsxs)(n.h3,{id:"input-bindings-are-not-reflected-into-fixture-when-changedetectionstrategyonpush-is-used",children:["@Input() bindings are not reflected into fixture when ",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.OnPush"})," is used"]}),"\n",(0,t.jsxs)(n.p,{children:["This issue is not related to Jest, ",(0,t.jsx)(n.a,{href:"https://github.com/angular/angular/issues/12313",children:"it's a known Angular bug"})]}),"\n",(0,t.jsxs)(n.p,{children:["To mitigate this, you need to wrap your component under test, into some container component with default change detection strategy (",(0,t.jsx)(n.code,{children:"ChangeDetectionStrategy.Default"}),") and pass props through it, or overwrite change detection strategy within ",(0,t.jsx)(n.code,{children:"TestBed"})," setup, if it's not critical for the test."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"// override change detection strategy\nbeforeEach(async(() => {\n TestBed.configureTestingModule({ declarations: [PizzaItemComponent] })\n .overrideComponent(PizzaItemComponent, {\n set: { changeDetection: ChangeDetectionStrategy.Default },\n })\n .compileComponents();\n}));\n"})}),"\n",(0,t.jsx)(n.h3,{id:"the-animation-trigger-transformmenu-has-failed",children:'The animation trigger "transformMenu" has failed'}),"\n",(0,t.jsx)(n.p,{children:"The currently used JSDOM version handles this, but older versions used before v7 of this preset was missing transform property. To patch it for Angular Material, use this workaround."}),"\n",(0,t.jsxs)(n.p,{children:["Add this to your ",(0,t.jsx)(n.code,{children:"jestGlobalMocks"})," file"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"Object.defineProperty(document.body.style, 'transform', {\n value: () => {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/angular/material2/issues/7101",children:"https://github.com/angular/material2/issues/7101"})]}),"\n",(0,t.jsx)(n.h3,{id:"unexpected-token-importexportother",children:"Unexpected token [import|export|other]"}),"\n",(0,t.jsxs)(n.p,{children:["This means, that a file is not transformed through ",(0,t.jsx)(n.code,{children:"TypeScript"})," compiler, e.g. because it is a ",(0,t.jsx)(n.code,{children:"JS"})," file with ",(0,t.jsx)(n.code,{children:"TS"})," syntax, or\nit is published to npm as uncompiled source files. Here's what you can do. A typical Jest error is like this:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,jest){import * as i0 from '@angular/core';\n ^^^^^^\n SyntaxError: Cannot use import statement outside a module\n"})}),"\n",(0,t.jsxs)(n.p,{children:["To fix the issue, one needs to adjust ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelist:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\nmodule.exports = {\n // ...other options\n transformIgnorePatterns: ['node_modules/(?!@angular|@ngrx)'],\n};\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, Jest doesn't transform ",(0,t.jsx)(n.code,{children:"node_modules"}),", because they should be valid JavaScript files. However, it happens that\nlibrary authors assume that you'll compile their sources. So you have to tell this to Jest explicitly.\nAbove snippet means that ",(0,t.jsx)(n.code,{children:"@angular"}),", ",(0,t.jsx)(n.code,{children:"@ngrx"})," will be transformed, even though they're ",(0,t.jsx)(n.code,{children:"node_modules"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["If the dependency causing the issue is a sub dependency of a ",(0,t.jsx)(n.code,{children:"node_modules"})," packages or a module designed to be used with nodeJS, a custom resolver could be required to fix the issue. ",(0,t.jsx)(n.a,{href:"#resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"See below"})," for more information."]}),"\n",(0,t.jsx)(n.h3,{id:"allow-vendor-libraries-like-jquery-etc",children:"Allow vendor libraries like jQuery, etc..."}),"\n",(0,t.jsxs)(n.p,{children:["The same like normal Jest configuration, you can load jQuery in your Jest setup file. For example your Jest setup file is ",(0,t.jsx)(n.code,{children:"setup-jest.ts"})," you can declare jQuery:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"window.$ = require('path/to/jquery');\n"})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import $ from 'jquery';\nglobal.$ = global.jQuery = $;\n"})}),"\n",(0,t.jsx)(n.p,{children:"The same declaration can be applied to other vendor libraries."}),"\n",(0,t.jsxs)(n.p,{children:["Reference: ",(0,t.jsx)(n.a,{href:"https://github.com/facebook/jest/issues/708",children:"https://github.com/facebook/jest/issues/708"})]}),"\n",(0,t.jsx)(n.h3,{id:"coverage-fail-but-tests-pass",children:"Coverage fail but tests pass"}),"\n",(0,t.jsxs)(n.p,{children:["This issue happens because Jest uses ",(0,t.jsx)(n.code,{children:"Babel"})," behind the screen to create coverage reporter. To fix this issue, one can do the following:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Install ",(0,t.jsx)(n.code,{children:"babel-jest"}),", ",(0,t.jsx)(n.code,{children:"@babel/core"})," and ",(0,t.jsx)(n.code,{children:"@babel/preset-env"})]}),"\n",(0,t.jsxs)(n.li,{children:["Create a ",(0,t.jsx)(n.code,{children:".babelrc"})," at the same place where Jest config file locates and define the necessary ",(0,t.jsx)(n.code,{children:"Babel"})," plugins.\nFor example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'{\n // this plugin will fix issue with class inheritance\n "plugins": ["@babel/plugin-transform-classes"]\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Define the usage of ",(0,t.jsx)(n.code,{children:"Babel"})," in Jest config via ",(0,t.jsx)(n.code,{children:"ts-jest"})," option, for example"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"// jest.config.js\nmodule.exports = {\n globals: {\n 'ts-jest': {\n //...\n babelConfig: true\n }\n }\n}\n"})}),"\n",(0,t.jsx)(n.h3,{id:"resolver-needed-for-some-javascript-library-or-nested-dependencies",children:"Resolver needed for some javascript library or nested dependencies"}),"\n",(0,t.jsx)(n.p,{children:"This can happen in two identified cases."}),"\n",(0,t.jsx)(n.h4,{id:"javascript-library",children:"Javascript library"}),"\n",(0,t.jsxs)(n.p,{children:["When using a javascript SDK/Library in Angular, some javascript methods could fail to be properly rendered in tests. Some examples are the ",(0,t.jsx)(n.code,{children:"firebase"})," and ",(0,t.jsx)(n.code,{children:"firebase/compat"})," SDK."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"TypeError: Cannot read properties of undefined (reading 'FacebookAuthProvider')\n import firebase from 'firebase/compat/app';\n\n > export const facebookAuthProvider = new firebase.auth.FacebookAuthProvider();\n"})}),"\n",(0,t.jsxs)(n.h4,{id:"nested-dependency-node_modules-package-within-another-package-node_nodules",children:["Nested dependency (",(0,t.jsx)(n.code,{children:"node_modules"})," package within another package ",(0,t.jsx)(n.code,{children:"node_nodules"}),")"]}),"\n",(0,t.jsxs)(n.p,{children:["Some nested dependency tree could trigger some errors while running the tests because some bundles (especially ESM ones) could be somehow errored. An example is the ",(0,t.jsx)(n.code,{children:"@angular/fire"})," package which uses the ",(0,t.jsx)(n.code,{children:"@firebase/firestore"})," package."]}),"\n",(0,t.jsx)(n.p,{children:"A typical error could appear as:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"node_modules\\@angular\\fire\\node_modules\\@firebase\\firestore\\dist\\index.esm2017.js:12705\n function (t, e) {\n ^^^^^^^^\n\n SyntaxError: Function statements require a function name\n"})}),"\n",(0,t.jsx)(n.h4,{id:"resolution",children:"Resolution"}),"\n",(0,t.jsxs)(n.p,{children:["In these cases, a ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting could not fix the issue. The solution here is to use a custom ",(0,t.jsx)(n.code,{children:"resolver"}),". You may or may not need to remove entries from ",(0,t.jsx)(n.code,{children:"transformIgnorePatterns"})," whitelisting."]}),"\n",(0,t.jsxs)(n.p,{children:["Here is an example of a resolver which would fix ",(0,t.jsx)(n.code,{children:"firebase"})," related packages."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.resolver.js\nmodule.exports = (path, options) => {\n // Call the defaultResolver, so we leverage its cache, error handling, etc.\n return options.defaultResolver(path, {\n ...options,\n // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)\n packageFilter: (pkg) => {\n const pkgNamesToTarget = new Set([\n 'rxjs',\n '@firebase/auth',\n '@firebase/storage',\n '@firebase/functions',\n '@firebase/database',\n '@firebase/auth-compat',\n '@firebase/database-compat',\n '@firebase/app-compat',\n '@firebase/firestore',\n '@firebase/firestore-compat',\n '@firebase/messaging',\n '@firebase/util',\n 'firebase',\n ]);\n\n if (pkgNamesToTarget.has(pkg.name)) {\n // console.log('>>>', pkg.name)\n delete pkg['exports'];\n delete pkg['module'];\n }\n\n return pkg;\n },\n });\n};\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// jest.config.js\n...\nresolver: '<rootDir>/src/jest.resolver.js',\n...\n"})})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>a});var r=s(6540);const t={},o=r.createContext(t);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/main.7bd9ef8c.js b/assets/js/main.7bd9ef8c.js deleted file mode 100644 index 9545e5ceae..0000000000 --- a/assets/js/main.7bd9ef8c.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see main.7bd9ef8c.js.LICENSE.txt */ -(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8792],{9188:(e,t,n)=>{"use strict";n.d(t,{W:()=>a});var r=n(6540);function a(){return r.createElement("svg",{width:"20",height:"20",className:"DocSearch-Search-Icon",viewBox:"0 0 20 20"},r.createElement("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",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}},2413:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});n(6540);var r=n(3259),a=n.n(r),o=n(4054);const s={"029bedf1":[()=>n.e(1180).then(n.bind(n,4908)),"@site/versioned_docs/version-11.1/guides/using-with-babel.md",4908],"02a1e558":[()=>Promise.all([n.e(1869),n.e(4026)]).then(n.bind(n,4288)),"@site/versioned_docs/version-8.x/getting-started/installation.md",4288],"03be7dae":[()=>Promise.all([n.e(1869),n.e(4768)]).then(n.bind(n,2699)),"@site/docs/guides/troubleshooting.md",2699],"04ae74d1":[()=>Promise.all([n.e(1869),n.e(8889)]).then(n.bind(n,564)),"@site/versioned_docs/version-12.0/getting-started/presets.md",564],"04b3fc6c":[()=>n.e(8582).then(n.bind(n,8243)),"@site/versioned_docs/version-10.x/getting-started/presets.md",8243],"05916282":[()=>n.e(2502).then(n.bind(n,6861)),"@site/versioned_docs/version-14.0/guides/absolute-imports.md",6861],"08804573":[()=>Promise.all([n.e(1869),n.e(108)]).then(n.bind(n,7234)),"@site/versioned_docs/version-14.3/guides/troubleshooting.md",7234],"097bb47a":[()=>n.e(3803).then(n.bind(n,5301)),"@site/versioned_docs/version-14.3/processing.md",5301],"09df063d":[()=>Promise.all([n.e(1869),n.e(5027)]).then(n.bind(n,450)),"@site/versioned_docs/version-14.4/getting-started/installation.md",450],"0d71a3f1":[()=>n.e(3316).then(n.bind(n,4912)),"@site/versioned_docs/version-9.x/getting-started/test-environment.md",4912],"0dc350cc":[()=>Promise.all([n.e(1869),n.e(9800)]).then(n.bind(n,8134)),"@site/versioned_docs/version-14.0/guides/jsdom-version.md",8134],"0e35f71d":[()=>Promise.all([n.e(1869),n.e(1672)]).then(n.bind(n,2610)),"@site/versioned_docs/version-12.0/guides/using-with-babel.md",2610],"13973f06":[()=>n.e(1446).then(n.bind(n,2709)),"@site/versioned_docs/version-12.0/processing.md",2709],"1438ea8f":[()=>Promise.all([n.e(1869),n.e(853)]).then(n.bind(n,572)),"@site/versioned_docs/version-14.2/guides/jsdom-version.md",572],"14b133ce":[()=>Promise.all([n.e(1869),n.e(1653)]).then(n.bind(n,6124)),"@site/docs/guides/angular-ivy.md",6124],"151633a5":[()=>n.e(4528).then(n.bind(n,238)),"@site/versioned_docs/version-11.0/introduction.md",238],"15a051c9":[()=>Promise.all([n.e(1869),n.e(1116)]).then(n.bind(n,9966)),"@site/versioned_docs/version-14.3/guides/using-with-babel.md",9966],"164a8de7":[()=>Promise.all([n.e(1869),n.e(1795)]).then(n.bind(n,7007)),"@site/versioned_docs/version-14.3/guides/jsdom-version.md",7007],17896441:[()=>Promise.all([n.e(1869),n.e(8401)]).then(n.bind(n,4687)),"@theme/DocItem",4687],"1a421168":[()=>Promise.all([n.e(1869),n.e(6368),n.e(9631)]).then(n.bind(n,4807)),"@site/docs/getting-started/test-environment.md",4807],"1a4e3797":[()=>Promise.all([n.e(1869),n.e(2138)]).then(n.bind(n,4267)),"@theme/SearchPage",4267],"1a5572f6":[()=>Promise.all([n.e(1869),n.e(3676)]).then(n.bind(n,2315)),"@site/versioned_docs/version-14.0/guides/angular-ivy.md",2315],"1d8e39f8":[()=>Promise.all([n.e(1869),n.e(4611)]).then(n.bind(n,840)),"@site/versioned_docs/version-14.4/guides/jsdom-version.md",840],"1df93b7f":[()=>Promise.all([n.e(1869),n.e(4583)]).then(n.bind(n,7521)),"@site/src/pages/index.tsx",7521],"1e388ac9":[()=>Promise.all([n.e(1869),n.e(6969)]).then(n.bind(n,8286)),"@site/versioned_docs/version-14.2/getting-started/presets.md",8286],"203fc93e":[()=>Promise.all([n.e(1869),n.e(6038)]).then(n.bind(n,9121)),"@site/versioned_docs/version-14.2/guides/angular-ivy.md",9121],"22e4d634":[()=>n.e(5559).then(n.bind(n,4314)),"@site/versioned_docs/version-10.x/guides/troubleshooting.md",4314],"252e2b80":[()=>n.e(8955).then(n.bind(n,4014)),"@site/versioned_docs/version-10.x/getting-started/options.md",4014],"25e9e857":[()=>n.e(4393).then(n.t.bind(n,3809,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-next-3ad.json",3809],"26cb42b7":[()=>Promise.all([n.e(1869),n.e(179)]).then(n.bind(n,9300)),"@site/versioned_docs/version-14.0/guides/esm-support.md",9300],"27299a3b":[()=>Promise.all([n.e(1869),n.e(7036)]).then(n.bind(n,3661)),"@site/versioned_docs/version-9.x/getting-started/installation.md",3661],"27af8d7b":[()=>n.e(4868).then(n.bind(n,4119)),"@site/versioned_docs/version-14.3/guides/esm-support.md",4119],"29d26392":[()=>n.e(8626).then(n.bind(n,5152)),"@site/versioned_docs/version-11.1/getting-started/presets.md",5152],"2a474b18":[()=>Promise.all([n.e(1869),n.e(6368),n.e(2822)]).then(n.bind(n,2853)),"@site/versioned_docs/version-14.3/getting-started/test-environment.md",2853],"2ab18ce5":[()=>n.e(6530).then(n.bind(n,530)),"@site/versioned_docs/version-14.2/introduction.md",530],"2ae17008":[()=>n.e(1635).then(n.bind(n,5144)),"@site/versioned_docs/version-8.x/guides/esm-support.md",5144],"2e81e74f":[()=>Promise.all([n.e(1869),n.e(647)]).then(n.bind(n,9308)),"@site/versioned_docs/version-13.0/guides/angular-ivy.md",9308],30388853:[()=>n.e(9075).then(n.bind(n,8226)),"@site/versioned_docs/version-13.0/processing.md",8226],"327b6d8e":[()=>n.e(6968).then(n.bind(n,7055)),"@site/versioned_docs/version-14.3/introduction.md",7055],"33a5adb4":[()=>Promise.all([n.e(1869),n.e(6368),n.e(2758)]).then(n.bind(n,6682)),"@site/versioned_docs/version-14.2/guides/snapshot-testing.md",6682],"357d33d4":[()=>n.e(5492).then(n.bind(n,5141)),"@site/versioned_docs/version-14.4/guides/esm-support.md",5141],"388d3430":[()=>Promise.all([n.e(1869),n.e(9762)]).then(n.bind(n,3787)),"@site/versioned_docs/version-14.0/guides/angular-13+.md",3787],"3b270bcb":[()=>Promise.all([n.e(1869),n.e(8388)]).then(n.bind(n,982)),"@site/versioned_docs/version-14.4/guides/angular-ivy.md",982],"3c7caf67":[()=>Promise.all([n.e(1869),n.e(7375)]).then(n.bind(n,9827)),"@site/versioned_docs/version-14.2/getting-started/installation.md",9827],"407f8801":[()=>Promise.all([n.e(1869),n.e(6261)]).then(n.bind(n,9374)),"@site/versioned_docs/version-9.x/guides/jsdom-version.md",9374],"433cefd8":[()=>Promise.all([n.e(1869),n.e(403)]).then(n.bind(n,7923)),"@site/versioned_docs/version-12.0/guides/angular-ivy.md",7923],"4351d34b":[()=>Promise.all([n.e(1869),n.e(3095)]).then(n.bind(n,8499)),"@site/docs/guides/jsdom-version.md",8499],44821296:[()=>Promise.all([n.e(1869),n.e(6368),n.e(509)]).then(n.bind(n,2620)),"@site/versioned_docs/version-14.3/guides/snapshot-testing.md",2620],"44b4d73b":[()=>Promise.all([n.e(1869),n.e(9829)]).then(n.bind(n,4229)),"@site/versioned_docs/version-13.0/guides/angular-13+.md",4229],"47c825a2":[()=>Promise.all([n.e(1869),n.e(8879)]).then(n.bind(n,6532)),"@site/docs/guides/using-with-babel.md",6532],"47cccd8d":[()=>n.e(6323).then(n.bind(n,3630)),"@site/versioned_docs/version-12.0/guides/absolute-imports.md",3630],"48dd39e2":[()=>Promise.all([n.e(1869),n.e(2442)]).then(n.bind(n,8977)),"@site/versioned_docs/version-12.0/getting-started/options.md",8977],"4941928a":[()=>Promise.all([n.e(1869),n.e(2703)]).then(n.bind(n,34)),"@site/versioned_docs/version-14.3/guides/angular-13+.md",34],"494f4f5e":[()=>n.e(8108).then(n.bind(n,5540)),"@site/versioned_docs/version-10.x/guides/angular-ivy.md",5540],"4b3f866b":[()=>Promise.all([n.e(1869),n.e(7400)]).then(n.bind(n,4151)),"@site/versioned_docs/version-14.2/guides/esm-support.md",4151],"4e0c07c5":[()=>Promise.all([n.e(1869),n.e(5250)]).then(n.bind(n,4422)),"@site/docs/getting-started/options.md",4422],"51d67042":[()=>n.e(6060).then(n.bind(n,7121)),"@site/versioned_docs/version-11.0/guides/using-with-babel.md",7121],"5253afba":[()=>Promise.all([n.e(1869),n.e(7832)]).then(n.bind(n,9649)),"@site/versioned_docs/version-14.3/guides/angular-ivy.md",9649],54071611:[()=>Promise.all([n.e(1869),n.e(6448)]).then(n.bind(n,80)),"@site/versioned_docs/version-10.x/getting-started/installation.md",80],"5465ebbc":[()=>n.e(6883).then(n.bind(n,3989)),"@site/versioned_docs/version-14.3/guides/absolute-imports.md",3989],"54f44165":[()=>Promise.all([n.e(1869),n.e(7924)]).then(n.bind(n,1226)),"@site/docs/getting-started/installation.md",1226],"5635425a":[()=>n.e(9806).then(n.bind(n,1844)),"@site/versioned_docs/version-9.x/guides/esm-support.md",1844],"56acf0ae":[()=>Promise.all([n.e(1869),n.e(1694)]).then(n.bind(n,168)),"@site/versioned_docs/version-13.0/guides/jsdom-version.md",168],"58f4fbf7":[()=>n.e(4787).then(n.t.bind(n,4985,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-8-x-495.json",4985],"5ae6b2db":[()=>n.e(6358).then(n.bind(n,9091)),"@site/versioned_docs/version-11.1/introduction.md",9091],"5b125e0e":[()=>Promise.all([n.e(1869),n.e(8904)]).then(n.bind(n,3466)),"@site/docs/guides/angular-13+.md",3466],"5b1cb890":[()=>Promise.all([n.e(1869),n.e(4827)]).then(n.bind(n,7534)),"@site/versioned_docs/version-13.0/getting-started/presets.md",7534],"5d23d50c":[()=>n.e(7168).then(n.t.bind(n,7896,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-12-0-4a9.json",7896],"5e95c892":[()=>n.e(9647).then(n.bind(n,3124)),"@theme/DocsRoot",3124],"5e9f5e1a":[()=>Promise.resolve().then(n.bind(n,4784)),"@generated/docusaurus.config",4784],"5ee9d842":[()=>n.e(6917).then(n.bind(n,4971)),"@site/versioned_docs/version-11.1/getting-started/test-environment.md",4971],"5f85402d":[()=>Promise.all([n.e(1869),n.e(3489)]).then(n.bind(n,9096)),"@site/versioned_docs/version-12.0/getting-started/installation.md",9096],"6059e070":[()=>Promise.all([n.e(1869),n.e(8649)]).then(n.bind(n,6279)),"@site/versioned_docs/version-13.0/getting-started/installation.md",6279],"6266f1ba":[()=>n.e(5883).then(n.bind(n,3298)),"@site/versioned_docs/version-8.x/getting-started/options.md",3298],"63150b11":[()=>n.e(3596).then(n.bind(n,1408)),"@site/versioned_docs/version-9.x/getting-started/options.md",1408],"651850eb":[()=>n.e(9461).then(n.bind(n,7440)),"@site/versioned_docs/version-8.x/introduction.md",7440],"6608151e":[()=>n.e(2891).then(n.bind(n,3593)),"@site/versioned_docs/version-10.x/introduction.md",3593],68240572:[()=>Promise.all([n.e(1869),n.e(6368),n.e(689)]).then(n.bind(n,8255)),"@site/docs/guides/snapshot-testing.md",8255],"68e3f1d5":[()=>Promise.all([n.e(1869),n.e(7367)]).then(n.bind(n,38)),"@site/versioned_docs/version-12.0/guides/angular-13+.md",38],"6916680a":[()=>Promise.all([n.e(1869),n.e(3818)]).then(n.bind(n,9163)),"@site/versioned_docs/version-11.0/getting-started/installation.md",9163],"6a6dcee7":[()=>n.e(7466).then(n.bind(n,2249)),"@site/versioned_docs/version-14.2/getting-started/test-environment.md",2249],"6d1ddfa7":[()=>n.e(4240).then(n.bind(n,7067)),"@site/versioned_docs/version-13.0/guides/absolute-imports.md",7067],"6f809103":[()=>Promise.all([n.e(1869),n.e(646)]).then(n.bind(n,7277)),"@site/versioned_docs/version-14.0/guides/using-with-babel.md",7277],"710ad8a9":[()=>Promise.all([n.e(1869),n.e(8828)]).then(n.bind(n,2377)),"@site/versioned_docs/version-11.0/guides/jsdom-version.md",2377],"72f058d3":[()=>n.e(7330).then(n.bind(n,1335)),"@site/versioned_docs/version-8.x/guides/troubleshooting.md",1335],"732c3ce9":[()=>n.e(4340).then(n.bind(n,7791)),"@site/versioned_docs/version-13.0/getting-started/test-environment.md",7791],"79ea3e73":[()=>n.e(795).then(n.bind(n,8029)),"@site/versioned_docs/version-9.x/getting-started/presets.md",8029],"7aeeadd4":[()=>n.e(8654).then(n.bind(n,9941)),"@site/versioned_docs/version-8.x/getting-started/test-environment.md",9941],"7d7dbec2":[()=>n.e(1315).then(n.t.bind(n,3925,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-9-x-465.json",3925],"80b4c599":[()=>n.e(131).then(n.bind(n,7825)),"@site/versioned_docs/version-12.0/getting-started/test-environment.md",7825],"85e14910":[()=>Promise.all([n.e(1869),n.e(3170)]).then(n.bind(n,7744)),"@site/versioned_docs/version-14.0/getting-started/installation.md",7744],"8665e647":[()=>Promise.all([n.e(1869),n.e(5700)]).then(n.bind(n,303)),"@site/versioned_docs/version-11.1/getting-started/installation.md",303],"8afa1348":[()=>n.e(2341).then(n.bind(n,3027)),"@site/versioned_docs/version-10.x/processing.md",3027],"8b263414":[()=>n.e(347).then(n.bind(n,4142)),"@site/versioned_docs/version-11.0/guides/angular-ivy.md",4142],"8e1736e0":[()=>n.e(4394).then(n.t.bind(n,5833,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-14-3-a8a.json",5833],"8f3baa16":[()=>Promise.all([n.e(1869),n.e(217)]).then(n.bind(n,3108)),"@site/versioned_docs/version-14.3/getting-started/options.md",3108],"915eea02":[()=>n.e(1263).then(n.bind(n,2958)),"@site/versioned_docs/version-14.4/introduction.md",2958],"9251a350":[()=>n.e(5075).then(n.bind(n,3566)),"@site/versioned_docs/version-11.0/guides/esm-support.md",3566],"93f0793d":[()=>n.e(1352).then(n.bind(n,9518)),"@site/versioned_docs/version-9.x/guides/using-with-babel.md",9518],"95451dd5":[()=>n.e(6201).then(n.bind(n,6174)),"@site/versioned_docs/version-14.4/processing.md",6174],"9798ce17":[()=>Promise.all([n.e(1869),n.e(6224)]).then(n.bind(n,4668)),"@site/versioned_docs/version-14.0/getting-started/presets.md",4668],"9903dc99":[()=>n.e(5487).then(n.bind(n,1098)),"@site/versioned_docs/version-8.x/guides/angular-ivy.md",1098],"9a2fa73a":[()=>Promise.all([n.e(1869),n.e(8937)]).then(n.bind(n,9465)),"@site/versioned_docs/version-13.0/guides/using-with-babel.md",9465],"9bc9e25c":[()=>n.e(223).then(n.bind(n,6551)),"@site/versioned_docs/version-13.0/introduction.md",6551],"9d48492b":[()=>n.e(3737).then(n.bind(n,4243)),"@site/versioned_docs/version-14.0/getting-started/test-environment.md",4243],"9fc1d339":[()=>n.e(8201).then(n.bind(n,4772)),"@site/versioned_docs/version-11.1/guides/troubleshooting.md",4772],a05464cd:[()=>Promise.all([n.e(1869),n.e(6368),n.e(1832)]).then(n.bind(n,94)),"@site/versioned_docs/version-14.4/guides/snapshot-testing.md",94],a09c2993:[()=>n.e(5899).then(n.bind(n,4778)),"@site/docs/introduction.md",4778],a389e28e:[()=>Promise.all([n.e(1869),n.e(7554)]).then(n.bind(n,7585)),"@site/versioned_docs/version-12.0/guides/esm-support.md",7585],a7456010:[()=>n.e(1235).then(n.t.bind(n,8552,19)),"@generated/docusaurus-plugin-content-pages/default/__plugin.json",8552],a74b641e:[()=>n.e(1841).then(n.bind(n,8721)),"@site/versioned_docs/version-9.x/guides/absolute-imports.md",8721],a7bd4aaa:[()=>n.e(7098).then(n.bind(n,2881)),"@theme/DocVersionRoot",2881],a7d04da7:[()=>Promise.all([n.e(1869),n.e(2363)]).then(n.bind(n,6932)),"@site/versioned_docs/version-14.4/guides/troubleshooting.md",6932],a7d61b99:[()=>Promise.all([n.e(1869),n.e(2766)]).then(n.bind(n,9776)),"@site/versioned_docs/version-12.0/guides/jsdom-version.md",9776],a89007e0:[()=>Promise.all([n.e(1869),n.e(3767)]).then(n.bind(n,4918)),"@site/versioned_docs/version-14.2/guides/angular-13+.md",4918],a94703ab:[()=>Promise.all([n.e(1869),n.e(9048)]).then(n.bind(n,8001)),"@theme/DocRoot",8001],a9789633:[()=>n.e(3543).then(n.bind(n,9893)),"@site/versioned_docs/version-9.x/guides/troubleshooting.md",9893],aa079c8b:[()=>Promise.all([n.e(1869),n.e(2772)]).then(n.bind(n,2201)),"@site/versioned_docs/version-13.0/getting-started/options.md",2201],aad144a3:[()=>n.e(9104).then(n.bind(n,9785)),"@site/versioned_docs/version-11.1/guides/angular-13+.md",9785],aba21aa0:[()=>n.e(5742).then(n.t.bind(n,7093,19)),"@generated/docusaurus-plugin-content-docs/default/__plugin.json",7093],adb64ee2:[()=>n.e(8480).then(n.bind(n,7794)),"@site/versioned_docs/version-8.x/processing.md",7794],af572879:[()=>Promise.all([n.e(1869),n.e(6308)]).then(n.bind(n,1551)),"@site/versioned_docs/version-14.3/getting-started/installation.md",1551],afba4106:[()=>n.e(1942).then(n.bind(n,9415)),"@site/versioned_docs/version-11.0/getting-started/test-environment.md",9415],b2161dc5:[()=>n.e(709).then(n.bind(n,6468)),"@site/versioned_docs/version-14.0/processing.md",6468],b4c5bdfe:[()=>n.e(4344).then(n.bind(n,7496)),"@site/versioned_docs/version-14.2/processing.md",7496],b647df5a:[()=>n.e(2624).then(n.bind(n,7921)),"@site/versioned_docs/version-8.x/guides/using-with-babel.md",7921],b83f237d:[()=>n.e(8930).then(n.bind(n,3350)),"@site/versioned_docs/version-14.2/guides/absolute-imports.md",3350],bb70b9c8:[()=>n.e(9760).then(n.t.bind(n,5673,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-3da.json",5673],c00c612c:[()=>n.e(5603).then(n.bind(n,3828)),"@site/versioned_docs/version-10.x/getting-started/test-environment.md",3828],c141421f:[()=>n.e(957).then(n.t.bind(n,936,19)),"@generated/docusaurus-theme-search-algolia/default/__plugin.json",936],c1865e7c:[()=>n.e(1049).then(n.t.bind(n,9636,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-14-0-33f.json",9636],c1bdbc58:[()=>n.e(9467).then(n.bind(n,8945)),"@site/versioned_docs/version-14.0/introduction.md",8945],c44fa306:[()=>n.e(2274).then(n.bind(n,8070)),"@site/versioned_docs/version-8.x/getting-started/presets.md",8070],c49413db:[()=>n.e(1767).then(n.bind(n,1334)),"@site/versioned_docs/version-10.x/guides/esm-support.md",1334],c4ba122c:[()=>Promise.all([n.e(1869),n.e(4769)]).then(n.bind(n,8324)),"@site/versioned_docs/version-14.2/guides/using-with-babel.md",8324],c62dfc48:[()=>n.e(51).then(n.bind(n,4880)),"@site/versioned_docs/version-14.0/guides/troubleshooting.md",4880],c7279284:[()=>n.e(1605).then(n.bind(n,598)),"@site/versioned_docs/version-11.0/getting-started/options.md",598],c9f7f11b:[()=>n.e(2052).then(n.t.bind(n,8454,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-10-x-ab5.json",8454],cd9c57cb:[()=>n.e(5297).then(n.bind(n,2803)),"@site/versioned_docs/version-10.x/guides/absolute-imports.md",2803],d069ae84:[()=>n.e(1454).then(n.bind(n,7175)),"@site/versioned_docs/version-11.0/guides/angular-13+.md",7175],d19b9e8a:[()=>n.e(5240).then(n.bind(n,475)),"@site/docs/guides/absolute-imports.md",475],d1b207fe:[()=>n.e(1090).then(n.bind(n,4351)),"@site/versioned_docs/version-13.0/guides/troubleshooting.md",4351],d2df711a:[()=>n.e(2601).then(n.bind(n,9350)),"@site/versioned_docs/version-11.0/guides/absolute-imports.md",9350],d30d9744:[()=>n.e(3344).then(n.t.bind(n,9560,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-13-0-e91.json",9560],d4836a8e:[()=>n.e(106).then(n.bind(n,3191)),"@site/docs/guides/esm-support.md",3191],d720bb60:[()=>n.e(5596).then(n.bind(n,2758)),"@site/versioned_docs/version-9.x/guides/angular-ivy.md",2758],d9330f66:[()=>Promise.all([n.e(1869),n.e(8678)]).then(n.bind(n,3344)),"@site/versioned_docs/version-13.0/guides/esm-support.md",3344],d957c22b:[()=>Promise.all([n.e(1869),n.e(9353)]).then(n.bind(n,6833)),"@site/versioned_docs/version-14.4/guides/angular-13+.md",6833],daab97c5:[()=>n.e(1555).then(n.bind(n,1132)),"@site/versioned_docs/version-11.1/processing.md",1132],dc033a20:[()=>n.e(949).then(n.t.bind(n,9466,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-11-0-0a4.json",9466],dd1da75d:[()=>Promise.all([n.e(1869),n.e(6368),n.e(7951)]).then(n.bind(n,2877)),"@site/versioned_docs/version-14.4/getting-started/test-environment.md",2877],dd8b0175:[()=>Promise.all([n.e(1869),n.e(2972)]).then(n.bind(n,2248)),"@site/versioned_docs/version-11.1/guides/jsdom-version.md",2248],df70a34a:[()=>n.e(9197).then(n.bind(n,736)),"@site/versioned_docs/version-10.x/guides/using-with-babel.md",736],dff5aaca:[()=>n.e(744).then(n.bind(n,5730)),"@site/versioned_docs/version-14.2/guides/troubleshooting.md",5730],e0a3f9c8:[()=>n.e(46).then(n.bind(n,5509)),"@site/versioned_docs/version-11.1/guides/esm-support.md",5509],e1715838:[()=>n.e(6603).then(n.bind(n,8343)),"@site/versioned_docs/version-9.x/introduction.md",8343],e36b815f:[()=>n.e(2659).then(n.bind(n,7957)),"@site/versioned_docs/version-14.4/guides/absolute-imports.md",7957],e59053ae:[()=>Promise.all([n.e(1869),n.e(6368),n.e(2008)]).then(n.bind(n,9998)),"@site/versioned_docs/version-14.4/getting-started/presets.md",9998],e5a27df7:[()=>Promise.all([n.e(1869),n.e(2416)]).then(n.bind(n,5824)),"@site/versioned_docs/version-14.4/getting-started/options.md",5824],ea131d77:[()=>n.e(8624).then(n.bind(n,7138)),"@site/versioned_docs/version-11.1/guides/absolute-imports.md",7138],eabdbf07:[()=>n.e(5100).then(n.bind(n,5990)),"@site/docs/processing.md",5990],eae657ee:[()=>n.e(4134).then(n.bind(n,8075)),"@site/versioned_docs/version-11.1/getting-started/options.md",8075],ebf39289:[()=>Promise.all([n.e(1869),n.e(8715)]).then(n.bind(n,670)),"@site/versioned_docs/version-14.0/getting-started/options.md",670],ec1d9510:[()=>n.e(3421).then(n.bind(n,9639)),"@site/versioned_docs/version-11.0/guides/troubleshooting.md",9639],ec7d5e88:[()=>Promise.all([n.e(1869),n.e(9896)]).then(n.bind(n,7182)),"@site/versioned_docs/version-14.3/getting-started/presets.md",7182],ecfacc56:[()=>n.e(1019).then(n.bind(n,5746)),"@site/versioned_docs/version-11.0/processing.md",5746],ef2f3ccd:[()=>Promise.all([n.e(1869),n.e(6741)]).then(n.bind(n,8761)),"@site/versioned_docs/version-14.2/getting-started/options.md",8761],f0447160:[()=>Promise.all([n.e(1869),n.e(499)]).then(n.bind(n,7482)),"@site/versioned_docs/version-8.x/guides/jsdom-version.md",7482],f14ecac0:[()=>n.e(8704).then(n.bind(n,1073)),"@site/versioned_docs/version-12.0/introduction.md",1073],f2ed1a27:[()=>n.e(667).then(n.t.bind(n,6011,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-14-2-238.json",6011],f3212b1e:[()=>Promise.all([n.e(1869),n.e(7511)]).then(n.bind(n,8174)),"@site/versioned_docs/version-10.x/guides/jsdom-version.md",8174],f43def45:[()=>Promise.all([n.e(1869),n.e(2656)]).then(n.bind(n,340)),"@site/versioned_docs/version-11.1/guides/angular-ivy.md",340],f546eb96:[()=>n.e(6370).then(n.bind(n,3981)),"@site/versioned_docs/version-9.x/processing.md",3981],f67ebb5d:[()=>n.e(5416).then(n.t.bind(n,5200,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-11-1-cd3.json",5200],f97daad0:[()=>n.e(5243).then(n.bind(n,639)),"@site/versioned_docs/version-8.x/guides/absolute-imports.md",639],fa17a3e5:[()=>n.e(8054).then(n.bind(n,8350)),"@site/src/pages/versions.tsx",8350],fa9f2ace:[()=>n.e(742).then(n.bind(n,800)),"@site/versioned_docs/version-11.0/getting-started/presets.md",800],fbd32610:[()=>Promise.all([n.e(1869),n.e(6543)]).then(n.bind(n,406)),"@site/versioned_docs/version-14.4/guides/using-with-babel.md",406],fc80686b:[()=>Promise.all([n.e(1869),n.e(6368),n.e(2440)]).then(n.bind(n,6105)),"@site/docs/getting-started/presets.md",6105],fea96f18:[()=>n.e(3309).then(n.bind(n,500)),"@site/versioned_docs/version-12.0/guides/troubleshooting.md",500]};var i=n(4848);function l(e){let{error:t,retry:n,pastDelay:r}=e;return t?(0,i.jsxs)("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"},children:[(0,i.jsx)("p",{children:String(t)}),(0,i.jsx)("div",{children:(0,i.jsx)("button",{type:"button",onClick:n,children:"Retry"})})]}):r?(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,i.jsx)("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb",children:(0,i.jsxs)("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2",children:[(0,i.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,i.jsx)("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,i.jsx)("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,i.jsx)("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,i.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,i.jsx)("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,i.jsx)("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,i.jsx)("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,i.jsx)("circle",{cx:"22",cy:"22",r:"8",children:(0,i.jsx)("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"})})]})})}):null}var c=n(1604),u=n(3363);function d(e,t){if("*"===e)return a()({loading:l,loader:()=>n.e(2560).then(n.bind(n,2560)),modules:["@theme/NotFound"],webpack:()=>[2560],render(e,t){const n=e.default;return(0,i.jsx)(u.W,{value:{plugin:{name:"native",id:"default"}},children:(0,i.jsx)(n,{...t})})}});const r=o[`${e}-${t}`],d={},p=[],g=[],f=(0,c.A)(r);return Object.entries(f).forEach((e=>{let[t,n]=e;const r=s[n];r&&(d[t]=r[0],p.push(r[1]),g.push(r[2]))})),a().Map({loading:l,loader:d,modules:p,webpack:()=>g,render(t,n){const a=JSON.parse(JSON.stringify(r));Object.entries(t).forEach((t=>{let[n,r]=t;const o=r.default;if(!o)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof o&&"function"!=typeof o||Object.keys(r).filter((e=>"default"!==e)).forEach((e=>{o[e]=r[e]}));let s=a;const i=n.split(".");i.slice(0,-1).forEach((e=>{s=s[e]})),s[i[i.length-1]]=o}));const o=a.__comp;delete a.__comp;const s=a.__context;delete a.__context;const l=a.__props;return delete a.__props,(0,i.jsx)(u.W,{value:s,children:(0,i.jsx)(o,{...a,...l,...n})})}})}const p=[{path:"/jest-preset-angular/search",component:d("/jest-preset-angular/search","948"),exact:!0},{path:"/jest-preset-angular/versions",component:d("/jest-preset-angular/versions","4c3"),exact:!0},{path:"/jest-preset-angular/docs",component:d("/jest-preset-angular/docs","fe4"),routes:[{path:"/jest-preset-angular/docs/10.x",component:d("/jest-preset-angular/docs/10.x","c5a"),routes:[{path:"/jest-preset-angular/docs/10.x",component:d("/jest-preset-angular/docs/10.x","33a"),routes:[{path:"/jest-preset-angular/docs/10.x/",component:d("/jest-preset-angular/docs/10.x/","b2c"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/getting-started/installation",component:d("/jest-preset-angular/docs/10.x/getting-started/installation","60d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/getting-started/options",component:d("/jest-preset-angular/docs/10.x/getting-started/options","309"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/getting-started/presets",component:d("/jest-preset-angular/docs/10.x/getting-started/presets","df8"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/getting-started/test-environment",component:d("/jest-preset-angular/docs/10.x/getting-started/test-environment","f83"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/absolute-imports",component:d("/jest-preset-angular/docs/10.x/guides/absolute-imports","9ce"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/angular-ivy",component:d("/jest-preset-angular/docs/10.x/guides/angular-ivy","2ca"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/esm-support",component:d("/jest-preset-angular/docs/10.x/guides/esm-support","c9e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/jsdom-version",component:d("/jest-preset-angular/docs/10.x/guides/jsdom-version","d6d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/troubleshooting",component:d("/jest-preset-angular/docs/10.x/guides/troubleshooting","8eb"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/using-with-babel",component:d("/jest-preset-angular/docs/10.x/guides/using-with-babel","e67"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/processing",component:d("/jest-preset-angular/docs/10.x/processing","800"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/11.0",component:d("/jest-preset-angular/docs/11.0","0f1"),routes:[{path:"/jest-preset-angular/docs/11.0",component:d("/jest-preset-angular/docs/11.0","d0d"),routes:[{path:"/jest-preset-angular/docs/11.0/",component:d("/jest-preset-angular/docs/11.0/","92b"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/getting-started/installation",component:d("/jest-preset-angular/docs/11.0/getting-started/installation","6f7"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/getting-started/options",component:d("/jest-preset-angular/docs/11.0/getting-started/options","a09"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/getting-started/presets",component:d("/jest-preset-angular/docs/11.0/getting-started/presets","1f3"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/getting-started/test-environment",component:d("/jest-preset-angular/docs/11.0/getting-started/test-environment","e4e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/absolute-imports",component:d("/jest-preset-angular/docs/11.0/guides/absolute-imports","6d4"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/angular-13+",component:d("/jest-preset-angular/docs/11.0/guides/angular-13+","dfe"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/angular-ivy",component:d("/jest-preset-angular/docs/11.0/guides/angular-ivy","345"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/esm-support",component:d("/jest-preset-angular/docs/11.0/guides/esm-support","da9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/jsdom-version",component:d("/jest-preset-angular/docs/11.0/guides/jsdom-version","133"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/troubleshooting",component:d("/jest-preset-angular/docs/11.0/guides/troubleshooting","3c7"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/using-with-babel",component:d("/jest-preset-angular/docs/11.0/guides/using-with-babel","635"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/processing",component:d("/jest-preset-angular/docs/11.0/processing","df5"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/11.1",component:d("/jest-preset-angular/docs/11.1","d95"),routes:[{path:"/jest-preset-angular/docs/11.1",component:d("/jest-preset-angular/docs/11.1","d6c"),routes:[{path:"/jest-preset-angular/docs/11.1/",component:d("/jest-preset-angular/docs/11.1/","92d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/getting-started/installation",component:d("/jest-preset-angular/docs/11.1/getting-started/installation","120"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/getting-started/options",component:d("/jest-preset-angular/docs/11.1/getting-started/options","aea"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/getting-started/presets",component:d("/jest-preset-angular/docs/11.1/getting-started/presets","950"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/getting-started/test-environment",component:d("/jest-preset-angular/docs/11.1/getting-started/test-environment","bcf"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/absolute-imports",component:d("/jest-preset-angular/docs/11.1/guides/absolute-imports","b70"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/angular-13+",component:d("/jest-preset-angular/docs/11.1/guides/angular-13+","911"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/angular-ivy",component:d("/jest-preset-angular/docs/11.1/guides/angular-ivy","5fe"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/esm-support",component:d("/jest-preset-angular/docs/11.1/guides/esm-support","bd0"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/jsdom-version",component:d("/jest-preset-angular/docs/11.1/guides/jsdom-version","66e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/troubleshooting",component:d("/jest-preset-angular/docs/11.1/guides/troubleshooting","9ba"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/using-with-babel",component:d("/jest-preset-angular/docs/11.1/guides/using-with-babel","ebf"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/processing",component:d("/jest-preset-angular/docs/11.1/processing","213"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/12.0",component:d("/jest-preset-angular/docs/12.0","47d"),routes:[{path:"/jest-preset-angular/docs/12.0",component:d("/jest-preset-angular/docs/12.0","fc1"),routes:[{path:"/jest-preset-angular/docs/12.0/",component:d("/jest-preset-angular/docs/12.0/","f02"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/getting-started/installation",component:d("/jest-preset-angular/docs/12.0/getting-started/installation","bc2"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/getting-started/options",component:d("/jest-preset-angular/docs/12.0/getting-started/options","e20"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/getting-started/presets",component:d("/jest-preset-angular/docs/12.0/getting-started/presets","1b2"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/getting-started/test-environment",component:d("/jest-preset-angular/docs/12.0/getting-started/test-environment","728"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/absolute-imports",component:d("/jest-preset-angular/docs/12.0/guides/absolute-imports","cf8"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/angular-13+",component:d("/jest-preset-angular/docs/12.0/guides/angular-13+","50a"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/angular-ivy",component:d("/jest-preset-angular/docs/12.0/guides/angular-ivy","299"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/esm-support",component:d("/jest-preset-angular/docs/12.0/guides/esm-support","9d0"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/jsdom-version",component:d("/jest-preset-angular/docs/12.0/guides/jsdom-version","c29"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/troubleshooting",component:d("/jest-preset-angular/docs/12.0/guides/troubleshooting","f19"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/using-with-babel",component:d("/jest-preset-angular/docs/12.0/guides/using-with-babel","55f"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/processing",component:d("/jest-preset-angular/docs/12.0/processing","f76"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/13.0",component:d("/jest-preset-angular/docs/13.0","6aa"),routes:[{path:"/jest-preset-angular/docs/13.0",component:d("/jest-preset-angular/docs/13.0","c9d"),routes:[{path:"/jest-preset-angular/docs/13.0/",component:d("/jest-preset-angular/docs/13.0/","e71"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/getting-started/installation",component:d("/jest-preset-angular/docs/13.0/getting-started/installation","caa"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/getting-started/options",component:d("/jest-preset-angular/docs/13.0/getting-started/options","8b9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/getting-started/presets",component:d("/jest-preset-angular/docs/13.0/getting-started/presets","857"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/getting-started/test-environment",component:d("/jest-preset-angular/docs/13.0/getting-started/test-environment","955"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/absolute-imports",component:d("/jest-preset-angular/docs/13.0/guides/absolute-imports","64f"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/angular-13+",component:d("/jest-preset-angular/docs/13.0/guides/angular-13+","66d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/angular-ivy",component:d("/jest-preset-angular/docs/13.0/guides/angular-ivy","a5c"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/esm-support",component:d("/jest-preset-angular/docs/13.0/guides/esm-support","a12"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/jsdom-version",component:d("/jest-preset-angular/docs/13.0/guides/jsdom-version","a9b"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/troubleshooting",component:d("/jest-preset-angular/docs/13.0/guides/troubleshooting","5d8"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/using-with-babel",component:d("/jest-preset-angular/docs/13.0/guides/using-with-babel","d5e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/processing",component:d("/jest-preset-angular/docs/13.0/processing","01b"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/14.0",component:d("/jest-preset-angular/docs/14.0","c74"),routes:[{path:"/jest-preset-angular/docs/14.0",component:d("/jest-preset-angular/docs/14.0","95f"),routes:[{path:"/jest-preset-angular/docs/14.0/",component:d("/jest-preset-angular/docs/14.0/","ee9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/getting-started/installation",component:d("/jest-preset-angular/docs/14.0/getting-started/installation","43c"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/getting-started/options",component:d("/jest-preset-angular/docs/14.0/getting-started/options","417"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/getting-started/presets",component:d("/jest-preset-angular/docs/14.0/getting-started/presets","eae"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/getting-started/test-environment",component:d("/jest-preset-angular/docs/14.0/getting-started/test-environment","99d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/absolute-imports",component:d("/jest-preset-angular/docs/14.0/guides/absolute-imports","23b"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/angular-13+",component:d("/jest-preset-angular/docs/14.0/guides/angular-13+","b8a"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/angular-ivy",component:d("/jest-preset-angular/docs/14.0/guides/angular-ivy","dc9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/esm-support",component:d("/jest-preset-angular/docs/14.0/guides/esm-support","11f"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/jsdom-version",component:d("/jest-preset-angular/docs/14.0/guides/jsdom-version","0e5"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/troubleshooting",component:d("/jest-preset-angular/docs/14.0/guides/troubleshooting","bc2"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/using-with-babel",component:d("/jest-preset-angular/docs/14.0/guides/using-with-babel","37f"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/processing",component:d("/jest-preset-angular/docs/14.0/processing","886"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/14.2",component:d("/jest-preset-angular/docs/14.2","bba"),routes:[{path:"/jest-preset-angular/docs/14.2",component:d("/jest-preset-angular/docs/14.2","3b9"),routes:[{path:"/jest-preset-angular/docs/14.2/",component:d("/jest-preset-angular/docs/14.2/","933"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/getting-started/installation",component:d("/jest-preset-angular/docs/14.2/getting-started/installation","e1d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/getting-started/options",component:d("/jest-preset-angular/docs/14.2/getting-started/options","366"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/getting-started/presets",component:d("/jest-preset-angular/docs/14.2/getting-started/presets","cfc"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/getting-started/test-environment",component:d("/jest-preset-angular/docs/14.2/getting-started/test-environment","94e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/absolute-imports",component:d("/jest-preset-angular/docs/14.2/guides/absolute-imports","8dc"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/angular-13+",component:d("/jest-preset-angular/docs/14.2/guides/angular-13+","b38"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/angular-ivy",component:d("/jest-preset-angular/docs/14.2/guides/angular-ivy","803"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/esm-support",component:d("/jest-preset-angular/docs/14.2/guides/esm-support","c59"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/jsdom-version",component:d("/jest-preset-angular/docs/14.2/guides/jsdom-version","823"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/snapshot-testing",component:d("/jest-preset-angular/docs/14.2/guides/snapshot-testing","61d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/troubleshooting",component:d("/jest-preset-angular/docs/14.2/guides/troubleshooting","83d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/using-with-babel",component:d("/jest-preset-angular/docs/14.2/guides/using-with-babel","b29"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/processing",component:d("/jest-preset-angular/docs/14.2/processing","178"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/14.3",component:d("/jest-preset-angular/docs/14.3","6c0"),routes:[{path:"/jest-preset-angular/docs/14.3",component:d("/jest-preset-angular/docs/14.3","ab5"),routes:[{path:"/jest-preset-angular/docs/14.3/",component:d("/jest-preset-angular/docs/14.3/","338"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/getting-started/installation",component:d("/jest-preset-angular/docs/14.3/getting-started/installation","501"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/getting-started/options",component:d("/jest-preset-angular/docs/14.3/getting-started/options","cb7"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/getting-started/presets",component:d("/jest-preset-angular/docs/14.3/getting-started/presets","c5d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/getting-started/test-environment",component:d("/jest-preset-angular/docs/14.3/getting-started/test-environment","bc7"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/absolute-imports",component:d("/jest-preset-angular/docs/14.3/guides/absolute-imports","7e9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/angular-13+",component:d("/jest-preset-angular/docs/14.3/guides/angular-13+","0bc"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/angular-ivy",component:d("/jest-preset-angular/docs/14.3/guides/angular-ivy","e84"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/esm-support",component:d("/jest-preset-angular/docs/14.3/guides/esm-support","23e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/jsdom-version",component:d("/jest-preset-angular/docs/14.3/guides/jsdom-version","c45"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/snapshot-testing",component:d("/jest-preset-angular/docs/14.3/guides/snapshot-testing","179"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/troubleshooting",component:d("/jest-preset-angular/docs/14.3/guides/troubleshooting","ada"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/using-with-babel",component:d("/jest-preset-angular/docs/14.3/guides/using-with-babel","54a"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/processing",component:d("/jest-preset-angular/docs/14.3/processing","a28"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/8.x",component:d("/jest-preset-angular/docs/8.x","8a9"),routes:[{path:"/jest-preset-angular/docs/8.x",component:d("/jest-preset-angular/docs/8.x","4af"),routes:[{path:"/jest-preset-angular/docs/8.x/",component:d("/jest-preset-angular/docs/8.x/","0b7"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/getting-started/installation",component:d("/jest-preset-angular/docs/8.x/getting-started/installation","def"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/getting-started/options",component:d("/jest-preset-angular/docs/8.x/getting-started/options","157"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/getting-started/presets",component:d("/jest-preset-angular/docs/8.x/getting-started/presets","ed1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/getting-started/test-environment",component:d("/jest-preset-angular/docs/8.x/getting-started/test-environment","e7a"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/absolute-imports",component:d("/jest-preset-angular/docs/8.x/guides/absolute-imports","1be"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/angular-ivy",component:d("/jest-preset-angular/docs/8.x/guides/angular-ivy","2a9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/esm-support",component:d("/jest-preset-angular/docs/8.x/guides/esm-support","307"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/jsdom-version",component:d("/jest-preset-angular/docs/8.x/guides/jsdom-version","665"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/troubleshooting",component:d("/jest-preset-angular/docs/8.x/guides/troubleshooting","431"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/using-with-babel",component:d("/jest-preset-angular/docs/8.x/guides/using-with-babel","67d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/processing",component:d("/jest-preset-angular/docs/8.x/processing","4b6"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/9.x",component:d("/jest-preset-angular/docs/9.x","da2"),routes:[{path:"/jest-preset-angular/docs/9.x",component:d("/jest-preset-angular/docs/9.x","94d"),routes:[{path:"/jest-preset-angular/docs/9.x/",component:d("/jest-preset-angular/docs/9.x/","b80"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/getting-started/installation",component:d("/jest-preset-angular/docs/9.x/getting-started/installation","c83"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/getting-started/options",component:d("/jest-preset-angular/docs/9.x/getting-started/options","278"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/getting-started/presets",component:d("/jest-preset-angular/docs/9.x/getting-started/presets","7e4"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/getting-started/test-environment",component:d("/jest-preset-angular/docs/9.x/getting-started/test-environment","470"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/absolute-imports",component:d("/jest-preset-angular/docs/9.x/guides/absolute-imports","f80"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/angular-ivy",component:d("/jest-preset-angular/docs/9.x/guides/angular-ivy","6a2"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/esm-support",component:d("/jest-preset-angular/docs/9.x/guides/esm-support","b35"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/jsdom-version",component:d("/jest-preset-angular/docs/9.x/guides/jsdom-version","3c3"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/troubleshooting",component:d("/jest-preset-angular/docs/9.x/guides/troubleshooting","fcc"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/using-with-babel",component:d("/jest-preset-angular/docs/9.x/guides/using-with-babel","bef"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/processing",component:d("/jest-preset-angular/docs/9.x/processing","e78"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/next",component:d("/jest-preset-angular/docs/next","d93"),routes:[{path:"/jest-preset-angular/docs/next",component:d("/jest-preset-angular/docs/next","16c"),routes:[{path:"/jest-preset-angular/docs/next/",component:d("/jest-preset-angular/docs/next/","dcf"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/getting-started/installation",component:d("/jest-preset-angular/docs/next/getting-started/installation","444"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/getting-started/options",component:d("/jest-preset-angular/docs/next/getting-started/options","542"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/getting-started/presets",component:d("/jest-preset-angular/docs/next/getting-started/presets","567"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/getting-started/test-environment",component:d("/jest-preset-angular/docs/next/getting-started/test-environment","3d5"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/absolute-imports",component:d("/jest-preset-angular/docs/next/guides/absolute-imports","b3d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/angular-13+",component:d("/jest-preset-angular/docs/next/guides/angular-13+","e37"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/angular-ivy",component:d("/jest-preset-angular/docs/next/guides/angular-ivy","476"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/esm-support",component:d("/jest-preset-angular/docs/next/guides/esm-support","c82"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/jsdom-version",component:d("/jest-preset-angular/docs/next/guides/jsdom-version","ad1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/snapshot-testing",component:d("/jest-preset-angular/docs/next/guides/snapshot-testing","760"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/troubleshooting",component:d("/jest-preset-angular/docs/next/guides/troubleshooting","241"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/using-with-babel",component:d("/jest-preset-angular/docs/next/guides/using-with-babel","15c"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/processing",component:d("/jest-preset-angular/docs/next/processing","87c"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs",component:d("/jest-preset-angular/docs","93b"),routes:[{path:"/jest-preset-angular/docs",component:d("/jest-preset-angular/docs","317"),routes:[{path:"/jest-preset-angular/docs/",component:d("/jest-preset-angular/docs/","ad3"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/getting-started/installation",component:d("/jest-preset-angular/docs/getting-started/installation","8ea"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/getting-started/options",component:d("/jest-preset-angular/docs/getting-started/options","124"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/getting-started/presets",component:d("/jest-preset-angular/docs/getting-started/presets","257"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/getting-started/test-environment",component:d("/jest-preset-angular/docs/getting-started/test-environment","f40"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/absolute-imports",component:d("/jest-preset-angular/docs/guides/absolute-imports","9aa"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/angular-13+",component:d("/jest-preset-angular/docs/guides/angular-13+","921"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/angular-ivy",component:d("/jest-preset-angular/docs/guides/angular-ivy","79f"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/esm-support",component:d("/jest-preset-angular/docs/guides/esm-support","91e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/jsdom-version",component:d("/jest-preset-angular/docs/guides/jsdom-version","0db"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/snapshot-testing",component:d("/jest-preset-angular/docs/guides/snapshot-testing","067"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/troubleshooting",component:d("/jest-preset-angular/docs/guides/troubleshooting","adf"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/using-with-babel",component:d("/jest-preset-angular/docs/guides/using-with-babel","7e1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/processing",component:d("/jest-preset-angular/docs/processing","585"),exact:!0,sidebar:"docs"}]}]}]},{path:"/jest-preset-angular/",component:d("/jest-preset-angular/","c4f"),exact:!0},{path:"*",component:d("*")}]},8848:(e,t,n)=>{"use strict";n.d(t,{o:()=>o,x:()=>s});var r=n(6540),a=n(4848);const o=r.createContext(!1);function s(e){let{children:t}=e;const[n,s]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{s(!0)}),[]),(0,a.jsx)(o.Provider,{value:n,children:t})}},5022:(e,t,n)=>{"use strict";var r=n(6540),a=n(5338),o=n(545),s=n(4625),i=n(4784),l=n(1712);const c=[n(5300),n(4753),n(5729),n(8252),n(8155)];var u=n(2413),d=n(6347),p=n(2831),g=n(4848);function f(e){let{children:t}=e;return(0,g.jsx)(g.Fragment,{children:t})}var m=n(1141),h=n(7639),b=n(8180),v=n(6957),y=n(4239),w=n(2098),x=n(9503),k=n(1482),j=n(4609),_=n(1210);function S(){const{i18n:{currentLocale:e,defaultLocale:t,localeConfigs:n}}=(0,h.A)(),r=(0,w.o)(),a=n[e].htmlLang,o=e=>e.replace("-","_");return(0,g.jsxs)(m.A,{children:[Object.entries(n).map((e=>{let[t,{htmlLang:n}]=e;return(0,g.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:n},t)})),(0,g.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:"x-default"}),(0,g.jsx)("meta",{property:"og:locale",content:o(a)}),Object.values(n).filter((e=>a!==e.htmlLang)).map((e=>(0,g.jsx)("meta",{property:"og:locale:alternate",content:o(e.htmlLang)},`meta-og-${e.htmlLang}`)))]})}function E(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,h.A)(),r=function(){const{siteConfig:{url:e,baseUrl:t,trailingSlash:n}}=(0,h.A)(),{pathname:r}=(0,d.zy)();return e+(0,j.Ks)((0,b.Ay)(r),{trailingSlash:n,baseUrl:t})}(),a=t?`${n}${t}`:r;return(0,g.jsxs)(m.A,{children:[(0,g.jsx)("meta",{property:"og:url",content:a}),(0,g.jsx)("link",{rel:"canonical",href:a})]})}function C(){const{i18n:{currentLocale:e}}=(0,h.A)(),{metadata:t,image:n}=(0,v.p)();return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(m.A,{children:[(0,g.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,g.jsx)("body",{className:x.w})]}),n&&(0,g.jsx)(y.be,{image:n}),(0,g.jsx)(E,{}),(0,g.jsx)(S,{}),(0,g.jsx)(_.A,{tag:k.C,locale:e}),(0,g.jsx)(m.A,{children:t.map(((e,t)=>(0,g.jsx)("meta",{...e},t)))})]})}const T=new Map;var A=n(8848),P=n(3366),R=n(6494);function L(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const a=c.map((t=>{const r=t.default?.[e]??t[e];return r?.(...n)}));return()=>a.forEach((e=>e?.()))}const N=function(e){let{children:t,location:n,previousLocation:r}=e;return(0,R.A)((()=>{r!==n&&(!function(e){let{location:t,previousLocation:n}=e;if(!n)return;const r=t.pathname===n.pathname,a=t.hash===n.hash,o=t.search===n.search;if(r&&a&&!o)return;const{hash:s}=t;if(s){const e=decodeURIComponent(s.substring(1)),t=document.getElementById(e);t?.scrollIntoView()}else window.scrollTo(0,0)}({location:n,previousLocation:r}),L("onRouteDidUpdate",{previousLocation:r,location:n}))}),[r,n]),t};function O(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,p.u)(u.A,e))).flat();return Promise.all(t.map((e=>e.route.component.preload?.())))}class D extends r.Component{previousLocation;routeUpdateCleanupCb;constructor(e){super(e),this.previousLocation=null,this.routeUpdateCleanupCb=l.A.canUseDOM?L("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const n=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=L("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),O(n.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:t}=this.props;return(0,g.jsx)(N,{previousLocation:this.previousLocation,location:t,children:(0,g.jsx)(d.qh,{location:t,render:()=>e})})}}const I=D,M="__docusaurus-base-url-issue-banner-container",F="__docusaurus-base-url-issue-banner",B="__docusaurus-base-url-issue-banner-suggestion-container";function z(e){return`\ndocument.addEventListener('DOMContentLoaded', function maybeInsertBanner() {\n var shouldInsert = typeof window['docusaurus'] === 'undefined';\n shouldInsert && insertBanner();\n});\n\nfunction insertBanner() {\n var bannerContainer = document.createElement('div');\n bannerContainer.id = '${M}';\n var bannerHtml = ${JSON.stringify(function(e){return`\n<div id="${F}" 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;">${e}</span> ${"/"===e?" (default value)":""}</p>\n <p>We suggest trying baseUrl = <span id="${B}" style="font-weight: bold; color: green;"></span></p>\n</div>\n`}(e)).replace(/</g,"\\<")};\n bannerContainer.innerHTML = bannerHtml;\n document.body.prepend(bannerContainer);\n var suggestionContainer = document.getElementById('${B}');\n var actualHomePagePath = window.location.pathname;\n var suggestedBaseUrl = actualHomePagePath.substr(-1) === '/'\n ? actualHomePagePath\n : actualHomePagePath + '/';\n suggestionContainer.innerHTML = suggestedBaseUrl;\n}\n`}function $(){const{siteConfig:{baseUrl:e}}=(0,h.A)();return(0,g.jsx)(g.Fragment,{children:!l.A.canUseDOM&&(0,g.jsx)(m.A,{children:(0,g.jsx)("script",{children:z(e)})})})}function U(){const{siteConfig:{baseUrl:e,baseUrlIssueBanner:t}}=(0,h.A)(),{pathname:n}=(0,d.zy)();return t&&n===e?(0,g.jsx)($,{}):null}function q(){const{siteConfig:{favicon:e,title:t,noIndex:n},i18n:{currentLocale:r,localeConfigs:a}}=(0,h.A)(),o=(0,b.Ay)(e),{htmlLang:s,direction:i}=a[r];return(0,g.jsxs)(m.A,{children:[(0,g.jsx)("html",{lang:s,dir:i}),(0,g.jsx)("title",{children:t}),(0,g.jsx)("meta",{property:"og:title",content:t}),(0,g.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),n&&(0,g.jsx)("meta",{name:"robots",content:"noindex, nofollow"}),e&&(0,g.jsx)("link",{rel:"icon",href:o})]})}var H=n(3832),G=n(1062);function W(){const e=(0,G.A)();return(0,g.jsx)(m.A,{children:(0,g.jsx)("html",{"data-has-hydrated":e})})}const V=(0,p.v)(u.A);function K(){const e=function(e){if(T.has(e.pathname))return{...e,pathname:T.get(e.pathname)};if((0,p.u)(u.A,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return T.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return T.set(e.pathname,t),{...e,pathname:t}}((0,d.zy)());return(0,g.jsx)(I,{location:e,children:V})}function Q(){return(0,g.jsx)(H.A,{children:(0,g.jsx)(P.l,{children:(0,g.jsxs)(A.x,{children:[(0,g.jsxs)(f,{children:[(0,g.jsx)(q,{}),(0,g.jsx)(C,{}),(0,g.jsx)(U,{}),(0,g.jsx)(K,{})]}),(0,g.jsx)(W,{})]})})})}var Y=n(4054);const Z=function(e){try{return document.createElement("link").relList.supports(e)}catch{return!1}}("prefetch")?function(e){return new Promise(((t,n)=>{if("undefined"==typeof document)return void n();const r=document.createElement("link");r.setAttribute("rel","prefetch"),r.setAttribute("href",e),r.onload=()=>t(),r.onerror=()=>n();const a=document.getElementsByTagName("head")[0]??document.getElementsByName("script")[0]?.parentNode;a?.appendChild(r)}))}:function(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),r.withCredentials=!0,r.onload=()=>{200===r.status?t():n()},r.send(null)}))};var X=n(1604);const J=new Set,ee=new Set,te=()=>navigator.connection?.effectiveType.includes("2g")||navigator.connection?.saveData,ne={prefetch:e=>{if(!(e=>!te()&&!ee.has(e)&&!J.has(e))(e))return!1;J.add(e);const t=(0,p.u)(u.A,e).flatMap((e=>{return t=e.route.path,Object.entries(Y).filter((e=>{let[n]=e;return n.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,X.A)(t))}));var t}));return Promise.all(t.map((e=>{const t=n.gca(e);return t&&!t.includes("undefined")?Z(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!te()&&!ee.has(e))(e)&&(ee.add(e),O(e))},re=Object.freeze(ne);function ae(e){let{children:t}=e;return"hash"===i.default.future.experimental_router?(0,g.jsx)(s.I9,{children:t}):(0,g.jsx)(s.Kd,{children:t})}const oe=Boolean(!0);if(l.A.canUseDOM){window.docusaurus=re;const e=document.getElementById("__docusaurus"),t=(0,g.jsx)(o.vd,{children:(0,g.jsx)(ae,{children:(0,g.jsx)(Q,{})})}),n=(e,t)=>{console.error("Docusaurus React Root onRecoverableError:",e,t)},s=()=>{if(window.docusaurusRoot)window.docusaurusRoot.render(t);else if(oe)window.docusaurusRoot=a.hydrateRoot(e,t,{onRecoverableError:n});else{const r=a.createRoot(e,{onRecoverableError:n});r.render(t),window.docusaurusRoot=r}};O(window.location.pathname).then((()=>{(0,r.startTransition)(s)}))}},3366:(e,t,n)=>{"use strict";n.d(t,{o:()=>d,l:()=>p});var r=n(6540),a=n(4784);const o=JSON.parse('{"docusaurus-plugin-content-docs":{"default":{"path":"/jest-preset-angular/docs","versions":[{"name":"current","label":"Next","isLast":false,"path":"/jest-preset-angular/docs/next","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/next/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/next/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/next/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/next/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/next/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/next/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/next/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/next/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/next/guides/jsdom-version","sidebar":"docs"},{"id":"guides/snapshot-testing","path":"/jest-preset-angular/docs/next/guides/snapshot-testing","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/next/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/next/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/next/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/next/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/next/","label":"introduction"}}}},{"name":"14.4","label":"14.4","isLast":true,"path":"/jest-preset-angular/docs","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/guides/jsdom-version","sidebar":"docs"},{"id":"guides/snapshot-testing","path":"/jest-preset-angular/docs/guides/snapshot-testing","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/","label":"introduction"}}}},{"name":"14.3","label":"14.3","isLast":false,"path":"/jest-preset-angular/docs/14.3","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/14.3/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/14.3/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/14.3/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/14.3/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/14.3/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/14.3/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/14.3/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/14.3/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/14.3/guides/jsdom-version","sidebar":"docs"},{"id":"guides/snapshot-testing","path":"/jest-preset-angular/docs/14.3/guides/snapshot-testing","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/14.3/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/14.3/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/14.3/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/14.3/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/14.3/","label":"introduction"}}}},{"name":"14.2","label":"14.2","isLast":false,"path":"/jest-preset-angular/docs/14.2","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/14.2/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/14.2/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/14.2/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/14.2/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/14.2/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/14.2/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/14.2/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/14.2/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/14.2/guides/jsdom-version","sidebar":"docs"},{"id":"guides/snapshot-testing","path":"/jest-preset-angular/docs/14.2/guides/snapshot-testing","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/14.2/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/14.2/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/14.2/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/14.2/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/14.2/","label":"introduction"}}}},{"name":"14.0","label":"14.0","isLast":false,"path":"/jest-preset-angular/docs/14.0","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/14.0/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/14.0/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/14.0/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/14.0/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/14.0/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/14.0/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/14.0/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/14.0/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/14.0/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/14.0/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/14.0/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/14.0/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/14.0/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/14.0/","label":"introduction"}}}},{"name":"13.0","label":"13.0","isLast":false,"path":"/jest-preset-angular/docs/13.0","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/13.0/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/13.0/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/13.0/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/13.0/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/13.0/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/13.0/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/13.0/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/13.0/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/13.0/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/13.0/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/13.0/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/13.0/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/13.0/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/13.0/","label":"introduction"}}}},{"name":"12.0","label":"12.0","isLast":false,"path":"/jest-preset-angular/docs/12.0","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/12.0/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/12.0/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/12.0/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/12.0/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/12.0/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/12.0/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/12.0/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/12.0/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/12.0/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/12.0/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/12.0/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/12.0/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/12.0/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/12.0/","label":"introduction"}}}},{"name":"11.1","label":"11.1","isLast":false,"path":"/jest-preset-angular/docs/11.1","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/11.1/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/11.1/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/11.1/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/11.1/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/11.1/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/11.1/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/11.1/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/11.1/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/11.1/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/11.1/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/11.1/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/11.1/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/11.1/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/11.1/","label":"introduction"}}}},{"name":"11.0","label":"11.0","isLast":false,"path":"/jest-preset-angular/docs/11.0","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/11.0/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/11.0/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/11.0/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/11.0/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/11.0/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/11.0/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/11.0/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/11.0/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/11.0/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/11.0/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/11.0/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/11.0/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/11.0/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/11.0/","label":"introduction"}}}},{"name":"10.x","label":"10.x","isLast":false,"path":"/jest-preset-angular/docs/10.x","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/10.x/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/10.x/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/10.x/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/10.x/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/10.x/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/10.x/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/10.x/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/10.x/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/10.x/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/10.x/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/10.x/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/10.x/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/10.x/","label":"introduction"}}}},{"name":"9.x","label":"9.x","isLast":false,"path":"/jest-preset-angular/docs/9.x","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/9.x/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/9.x/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/9.x/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/9.x/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/9.x/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/9.x/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/9.x/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/9.x/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/9.x/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/9.x/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/9.x/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/9.x/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/9.x/","label":"introduction"}}}},{"name":"8.x","label":"8.x","isLast":false,"path":"/jest-preset-angular/docs/8.x","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/8.x/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/8.x/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/8.x/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/8.x/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/8.x/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/8.x/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/8.x/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/8.x/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/8.x/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/8.x/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/8.x/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/8.x/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/8.x/","label":"introduction"}}}}],"breadcrumbs":true}}}'),s=JSON.parse('{"defaultLocale":"en","locales":["en"],"path":"i18n","currentLocale":"en","localeConfigs":{"en":{"label":"English","direction":"ltr","htmlLang":"en","calendar":"gregory","path":"en"}}}');var i=n(2654);const l=JSON.parse('{"docusaurusVersion":"3.6.3","siteVersion":"0.0.0","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"3.6.3"},"docusaurus-plugin-content-blog":{"type":"package","name":"@docusaurus/plugin-content-blog","version":"3.6.3"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"3.6.3"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"3.6.3"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"3.6.3"},"docusaurus-theme-search-algolia":{"type":"package","name":"@docusaurus/theme-search-algolia","version":"3.6.3"},"docusaurus-plugin-ideal-image":{"type":"package","name":"@docusaurus/plugin-ideal-image","version":"3.6.3"},"docusaurus-plugin-pwa":{"type":"package","name":"@docusaurus/plugin-pwa","version":"3.6.3"}}}');var c=n(4848);const u={siteConfig:a.default,siteMetadata:l,globalData:o,i18n:s,codeTranslations:i},d=r.createContext(u);function p(e){let{children:t}=e;return(0,c.jsx)(d.Provider,{value:u,children:t})}},3832:(e,t,n)=>{"use strict";n.d(t,{A:()=>m});var r=n(6540),a=n(1712),o=n(1141),s=n(4609),i=n(7784),l=n(3363),c=n(4848);function u(e){let{error:t,tryAgain:n}=e;return(0,c.jsxs)("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",minHeight:"100vh",width:"100%",maxWidth:"80ch",fontSize:"20px",margin:"0 auto",padding:"1rem"},children:[(0,c.jsx)("h1",{style:{fontSize:"3rem"},children:"This page crashed"}),(0,c.jsx)("button",{type:"button",onClick:n,style:{margin:"1rem 0",fontSize:"2rem",cursor:"pointer",borderRadius:20,padding:"1rem"},children:"Try again"}),(0,c.jsx)(d,{error:t})]})}function d(e){let{error:t}=e;const n=(0,s.rA)(t).map((e=>e.message)).join("\n\nCause:\n");return(0,c.jsx)("p",{style:{whiteSpace:"pre-wrap"},children:n})}function p(e){let{children:t}=e;return(0,c.jsx)(l.W,{value:{plugin:{name:"docusaurus-core-error-boundary",id:"default"}},children:t})}function g(e){let{error:t,tryAgain:n}=e;return(0,c.jsx)(p,{children:(0,c.jsxs)(m,{fallback:()=>(0,c.jsx)(u,{error:t,tryAgain:n}),children:[(0,c.jsx)(o.A,{children:(0,c.jsx)("title",{children:"Page Error"})}),(0,c.jsx)(i.A,{children:(0,c.jsx)(u,{error:t,tryAgain:n})})]})})}const f=e=>(0,c.jsx)(g,{...e});class m extends r.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){a.A.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:t}=this.state;if(t){const e={error:t,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??f)(e)}return e??null}}},1712:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});const r="undefined"!=typeof window&&"document"in window&&"createElement"in window.document,a={canUseDOM:r,canUseEventListeners:r&&("addEventListener"in window||"attachEvent"in window),canUseIntersectionObserver:r&&"IntersectionObserver"in window,canUseViewport:r&&"screen"in window}},1141:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});n(6540);var r=n(545),a=n(4848);function o(e){return(0,a.jsx)(r.mg,{...e})}},4783:(e,t,n)=>{"use strict";n.d(t,{A:()=>g});var r=n(6540),a=n(4625),o=n(4609),s=n(7639),i=n(877),l=n(1712),c=n(7344),u=n(8180),d=n(4848);function p(e,t){let{isNavLink:n,to:p,href:g,activeClassName:f,isActive:m,"data-noBrokenLinkCheck":h,autoAddBaseUrl:b=!0,...v}=e;const{siteConfig:y}=(0,s.A)(),{trailingSlash:w,baseUrl:x}=y,k=y.future.experimental_router,{withBaseUrl:j}=(0,u.hH)(),_=(0,c.A)(),S=(0,r.useRef)(null);(0,r.useImperativeHandle)(t,(()=>S.current));const E=p||g;const C=(0,i.A)(E),T=E?.replace("pathname://","");let A=void 0!==T?(P=T,b&&(e=>e.startsWith("/"))(P)?j(P):P):void 0;var P;"hash"===k&&A?.startsWith("./")&&(A=A?.slice(1)),A&&C&&(A=(0,o.Ks)(A,{trailingSlash:w,baseUrl:x}));const R=(0,r.useRef)(!1),L=n?a.k2:a.N_,N=l.A.canUseIntersectionObserver,O=(0,r.useRef)(),D=()=>{R.current||null==A||(window.docusaurus.preload(A),R.current=!0)};(0,r.useEffect)((()=>(!N&&C&&l.A.canUseDOM&&null!=A&&window.docusaurus.prefetch(A),()=>{N&&O.current&&O.current.disconnect()})),[O,A,N,C]);const I=A?.startsWith("#")??!1,M=!v.target||"_self"===v.target,F=!A||!C||!M||I&&"hash"!==k;h||!I&&F||_.collectLink(A),v.id&&_.collectAnchor(v.id);const B={};return F?(0,d.jsx)("a",{ref:S,href:A,...E&&!C&&{target:"_blank",rel:"noopener noreferrer"},...v,...B}):(0,d.jsx)(L,{...v,onMouseEnter:D,onTouchStart:D,innerRef:e=>{S.current=e,N&&e&&C&&(O.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(O.current.unobserve(e),O.current.disconnect(),null!=A&&window.docusaurus.prefetch(A))}))})),O.current.observe(e))},to:A,...n&&{isActive:m,activeClassName:f},...B})}const g=r.forwardRef(p)},3230:(e,t,n)=>{"use strict";n.d(t,{A:()=>c,T:()=>l});var r=n(6540),a=n(4848);function o(e,t){const n=e.split(/(\{\w+\})/).map(((e,n)=>{if(n%2==1){const n=t?.[e.slice(1,-1)];if(void 0!==n)return n}return e}));return n.some((e=>(0,r.isValidElement)(e)))?n.map(((e,t)=>(0,r.isValidElement)(e)?r.cloneElement(e,{key:t}):e)).filter((e=>""!==e)):n.join("")}var s=n(2654);function i(e){let{id:t,message:n}=e;if(void 0===t&&void 0===n)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return s[t??n]??n??t}function l(e,t){let{message:n,id:r}=e;return o(i({message:n,id:r}),t)}function c(e){let{children:t,id:n,values:r}=e;if(t&&"string"!=typeof t)throw console.warn("Illegal <Translate> children",t),new Error("The Docusaurus <Translate> component only accept simple string values");const s=i({message:t,id:n});return(0,a.jsx)(a.Fragment,{children:o(s,r)})}},4598:(e,t,n)=>{"use strict";n.d(t,{W:()=>r});const r="default"},877:(e,t,n)=>{"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,{A:()=>a,z:()=>r})},8180:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>i,hH:()=>s});var r=n(6540),a=n(7639),o=n(877);function s(){const{siteConfig:e}=(0,a.A)(),{baseUrl:t,url:n}=e,s=e.future.experimental_router,i=(0,r.useCallback)(((e,r)=>function(e){let{siteUrl:t,baseUrl:n,url:r,options:{forcePrependBaseUrl:a=!1,absolute:s=!1}={},router:i}=e;if(!r||r.startsWith("#")||(0,o.z)(r))return r;if("hash"===i)return r.startsWith("/")?`.${r}`:`./${r}`;if(a)return n+r.replace(/^\//,"");if(r===n.replace(/\/$/,""))return n;const l=r.startsWith(n)?r:n+r.replace(/^\//,"");return s?t+l:l}({siteUrl:n,baseUrl:t,url:e,options:r,router:s})),[n,t,s]);return{withBaseUrl:i}}function i(e,t){void 0===t&&(t={});const{withBaseUrl:n}=s();return n(e,t)}},7344:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(6540);n(4848);const a=r.createContext({collectAnchor:()=>{},collectLink:()=>{}}),o=()=>(0,r.useContext)(a);function s(){return o()}},7639:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540),a=n(3366);function o(){return(0,r.useContext)(a.o)}},1062:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540),a=n(8848);function o(){return(0,r.useContext)(a.o)}},6494:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(6540);const a=n(1712).A.canUseDOM?r.useLayoutEffect:r.useEffect},1604:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});const r=e=>"object"==typeof e&&!!e&&Object.keys(e).length>0;function a(e){const t={};return function e(n,a){Object.entries(n).forEach((n=>{let[o,s]=n;const i=a?`${a}.${o}`:o;r(s)?e(s,i):t[i]=s}))}(e),t}},3363:(e,t,n)=>{"use strict";n.d(t,{W:()=>s,o:()=>o});var r=n(6540),a=n(4848);const o=r.createContext(null);function s(e){let{children:t,value:n}=e;const s=r.useContext(o),i=(0,r.useMemo)((()=>function(e){let{parent:t,value:n}=e;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}const r={...t.data,...n?.data};return{plugin:t.plugin,data:r}}({parent:s,value:n})),[s,n]);return(0,a.jsx)(o.Provider,{value:i,children:t})}},6457:(e,t,n)=>{"use strict";n.d(t,{VQ:()=>h,XK:()=>y,g1:()=>v});var r=n(6540),a=n(4721),o=n(4598),s=n(6957),i=n(9900),l=n(4799),c=n(4848);const u=e=>`docs-preferred-version-${e}`,d={save:(e,t,n)=>{(0,i.Wf)(u(e),{persistence:t}).set(n)},read:(e,t)=>(0,i.Wf)(u(e),{persistence:t}).get(),clear:(e,t)=>{(0,i.Wf)(u(e),{persistence:t}).del()}},p=e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}])));const g=r.createContext(null);function f(){const e=(0,a.Gy)(),t=(0,s.p)().docs.versionPersistence,n=(0,r.useMemo)((()=>Object.keys(e)),[e]),[o,i]=(0,r.useState)((()=>p(n)));(0,r.useEffect)((()=>{i(function(e){let{pluginIds:t,versionPersistence:n,allDocsData:r}=e;function a(e){const t=d.read(e,n);return r[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(d.clear(e,n),{preferredVersionName:null})}return Object.fromEntries(t.map((e=>[e,a(e)])))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]);return[o,(0,r.useMemo)((()=>({savePreferredVersion:function(e,n){d.save(e,t,n),i((t=>({...t,[e]:{preferredVersionName:n}})))}})),[t])]}function m(e){let{children:t}=e;const n=f();return(0,c.jsx)(g.Provider,{value:n,children:t})}function h(e){let{children:t}=e;return(0,c.jsx)(m,{children:t})}function b(){const e=(0,r.useContext)(g);if(!e)throw new l.dV("DocsPreferredVersionContextProvider");return e}function v(e){void 0===e&&(e=o.W);const t=(0,a.ht)(e),[n,s]=b(),{preferredVersionName:i}=n[e];return{preferredVersion:t.versions.find((e=>e.name===i))??null,savePreferredVersionName:(0,r.useCallback)((t=>{s.savePreferredVersion(e,t)}),[s,e])}}function y(){const e=(0,a.Gy)(),[t]=b();function n(n){const r=e[n],{preferredVersionName:a}=t[n];return r.versions.find((e=>e.name===a))??null}const r=Object.keys(e);return Object.fromEntries(r.map((e=>[e,n(e)])))}},3718:(e,t,n)=>{"use strict";n.d(t,{k:()=>o,v:()=>s});var r=n(4721),a=n(6457);function o(e,t){return`docs-${e}-${t}`}function s(){const e=(0,r.Gy)(),t=(0,r.gk)(),n=(0,a.XK)();return[...Object.keys(e).map((function(r){const a=t?.activePlugin.pluginId===r?t.activeVersion:void 0,s=n[r],i=e[r].versions.find((e=>e.isLast));return o(r,(a??s??i).name)}))]}},40:(e,t,n)=>{"use strict";n.d(t,{V:()=>l,t:()=>c});var r=n(6540),a=n(4799),o=n(4848);const s=Symbol("EmptyContext"),i=r.createContext(s);function l(e){let{children:t,name:n,items:a}=e;const s=(0,r.useMemo)((()=>n&&a?{name:n,items:a}:null),[n,a]);return(0,o.jsx)(i.Provider,{value:s,children:t})}function c(){const e=(0,r.useContext)(i);if(e===s)throw new a.dV("DocsSidebarProvider");return e}},5357:(e,t,n)=>{"use strict";n.d(t,{B5:()=>j,Nr:()=>p,OF:()=>y,QB:()=>k,Vd:()=>w,Y:()=>b,fW:()=>x,w8:()=>m});var r=n(6540),a=n(6347),o=n(2831),s=n(4721),i=n(260),l=n(5167),c=n(6457),u=n(1704),d=n(40);function p(e){return"link"!==e.type||e.unlisted?"category"===e.type?function(e){if(e.href&&!e.linkUnlisted)return e.href;for(const t of e.items){const e=p(t);if(e)return e}}(e):void 0:e.href}const g=(e,t)=>void 0!==e&&(0,i.ys)(e,t),f=(e,t)=>e.some((e=>m(e,t)));function m(e,t){return"link"===e.type?g(e.href,t):"category"===e.type&&(g(e.href,t)||f(e.items,t))}function h(e,t){switch(e.type){case"category":return m(e,t)||e.items.some((e=>h(e,t)));case"link":return!e.unlisted||m(e,t);default:return!0}}function b(e,t){return(0,r.useMemo)((()=>e.filter((e=>h(e,t)))),[e,t])}function v(e){let{sidebarItems:t,pathname:n,onlyCategories:r=!1}=e;const a=[];return function e(t){for(const o of t)if("category"===o.type&&((0,i.ys)(o.href,n)||e(o.items))||"link"===o.type&&(0,i.ys)(o.href,n)){return r&&"category"!==o.type||a.unshift(o),!0}return!1}(t),a}function y(){const e=(0,d.t)(),{pathname:t}=(0,a.zy)(),n=(0,s.vT)()?.pluginData.breadcrumbs;return!1!==n&&e?v({sidebarItems:e.items,pathname:t}):null}function w(e){const{activeVersion:t}=(0,s.zK)(e),{preferredVersion:n}=(0,c.g1)(e),a=(0,s.r7)(e);return(0,r.useMemo)((()=>(0,l.sb)([t,n,a].filter(Boolean))),[t,n,a])}function x(e,t){const n=w(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),r=t.find((t=>t[0]===e));if(!r)throw new Error(`Can't find any sidebar with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\nAvailable sidebar ids are:\n- ${t.map((e=>e[0])).join("\n- ")}`);return r[1]}),[e,n])}function k(e,t){const n=w(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.docs)),r=t.find((t=>t.id===e));if(!r){if(n.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`Couldn't find any doc with id "${e}" in version${n.length>1?"s":""} "${n.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${(0,l.sb)(t.map((e=>e.id))).join("\n- ")}`)}return r}),[e,n])}function j(e){let{route:t}=e;const n=(0,a.zy)(),r=(0,u.r)(),s=t.routes,i=s.find((e=>(0,a.B6)(n.pathname,e)));if(!i)return null;const l=i.sidebar,c=l?r.docsSidebars[l]:void 0;return{docElement:(0,o.v)(s),sidebarName:l,sidebarItems:c}}},1704:(e,t,n)=>{"use strict";n.d(t,{n:()=>i,r:()=>l});var r=n(6540),a=n(4799),o=n(4848);const s=r.createContext(null);function i(e){let{children:t,version:n}=e;return(0,o.jsx)(s.Provider,{value:n,children:t})}function l(){const e=(0,r.useContext)(s);if(null===e)throw new a.dV("DocsVersionProvider");return e}},4721:(e,t,n)=>{"use strict";n.d(t,{zK:()=>b,vT:()=>g,gk:()=>f,Gy:()=>d,HW:()=>v,ht:()=>p,r7:()=>h,jh:()=>m});var r=n(6347),a=n(7639),o=n(4598);function s(e,t){void 0===t&&(t={});const n=function(){const{globalData:e}=(0,a.A)();return e}()[e];if(!n&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return n}const i=e=>e.versions.find((e=>e.isLast));function l(e,t){return[...e.versions].sort(((e,t)=>e.path===t.path?0:e.path.includes(t.path)?-1:t.path.includes(e.path)?1:0)).find((e=>!!(0,r.B6)(t,{path:e.path,exact:!1,strict:!1})))}function c(e,t){const n=l(e,t),a=n?.docs.find((e=>!!(0,r.B6)(t,{path:e.path,exact:!0,strict:!1})));return{activeVersion:n,activeDoc:a,alternateDocVersions:a?function(t){const n={};return e.versions.forEach((e=>{e.docs.forEach((r=>{r.id===t&&(n[e.name]=r)}))})),n}(a.id):{}}}const u={},d=()=>s("docusaurus-plugin-content-docs")??u,p=e=>{try{return function(e,t,n){void 0===t&&(t=o.W),void 0===n&&(n={});const r=s(e),a=r?.[t];if(!a&&n.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${t}".`);return a}("docusaurus-plugin-content-docs",e,{failfast:!0})}catch(t){throw new Error("You are using a feature of the Docusaurus docs plugin, but this plugin does not seem to be enabled"+("Default"===e?"":` (pluginId=${e}`),{cause:t})}};function g(e){void 0===e&&(e={});const t=d(),{pathname:n}=(0,r.zy)();return function(e,t,n){void 0===n&&(n={});const a=Object.entries(e).sort(((e,t)=>t[1].path.localeCompare(e[1].path))).find((e=>{let[,n]=e;return!!(0,r.B6)(t,{path:n.path,exact:!1,strict:!1})})),o=a?{pluginId:a[0],pluginData:a[1]}:void 0;if(!o&&n.failfast)throw new Error(`Can't find active docs plugin for "${t}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return o}(t,n,e)}function f(e){void 0===e&&(e={});const t=g(e),{pathname:n}=(0,r.zy)();if(!t)return;return{activePlugin:t,activeVersion:l(t.pluginData,n)}}function m(e){return p(e).versions}function h(e){const t=p(e);return i(t)}function b(e){const t=p(e),{pathname:n}=(0,r.zy)();return c(t,n)}function v(e){const t=p(e),{pathname:n}=(0,r.zy)();return function(e,t){const n=i(e);return{latestDocSuggestion:c(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(t,n)}},8155:(e,t,n)=>{"use strict";n.r(t);var r=n(1712),a=n(9900);const o="/jest-preset-angular/sw.js",s=["appInstalled","queryString"],i=!1,l=(0,a.Wf)("docusaurus.pwa.event.appInstalled.fired");function c(e,t){i&&(void 0===t?console.log(`[Docusaurus-PWA][registerSw]: ${e}`):console.log(`[Docusaurus-PWA][registerSw]: ${e}`,t))}async function u(){const e=await navigator.serviceWorker.getRegistrations();c("will unregister all service workers",{registrations:e}),await Promise.all(e.map((e=>e.unregister().then((t=>c("unregister service worker",{registration:e,result:t})))))),c("unregistered all service workers",{registrations:e}),window.location.reload()}const d={always:()=>!0,mobile:()=>window.innerWidth<=996,saveData:()=>!!navigator.connection?.saveData,appInstalled:()=>"true"===l.get()||async function(){if(!("getInstalledRelatedApps"in window.navigator))return!1;try{return(await navigator.getInstalledRelatedApps()).some((e=>"webapp"===e.platform))}catch(e){return!1}}(),standalone:()=>window.matchMedia("(display-mode: standalone)").matches,queryString:()=>"true"===new URLSearchParams(window.location.search).get("offlineMode")};async function p(){const e=await async function(){return(await Promise.all(s.map((e=>Promise.resolve(d[e]()).then((t=>t?e:void 0)))))).filter(Boolean)}(),t=e.length>0;return c(t?"offline mode enabled, because of activation strategies":"offline mode disabled, because none of the offlineModeActivationStrategies could be used",{activeStrategies:e,availableStrategies:s}),t}r.A.canUseDOM&&(c("debug mode enabled"),"serviceWorker"in navigator&&(c("addLegacyAppInstalledEventsListeners"),window.addEventListener("appinstalled",(e=>{c("event appinstalled",{event:e}),l.set("true"),c("AppInstalledEventFiredStorage.set('true')"),u()})),window.addEventListener("beforeinstallprompt",(e=>{c("event beforeinstallprompt",{event:e});const t=l.get();c("AppInstalledEventFiredStorage.get()",{appInstalledEventFired:t}),t&&(l.del(),c("AppInstalledEventFiredStorage.del()"),u())})),c("legacy appinstalled and beforeinstallprompt event listeners installed"),async function(){const[{Workbox:e},t]=await Promise.all([n.e(9730).then(n.bind(n,9730)),p()]),r=new e(function(e){const t=JSON.stringify(e),n=`${o}?params=${encodeURIComponent(t)}`;return c("service worker url",{url:n,params:e}),n}({offlineMode:t,debug:i})),a=()=>r.messageSW({type:"SKIP_WAITING"}),s=()=>(c("handleServiceWorkerWaiting"),t?n.e(5691).then(n.bind(n,5691)).then((e=>{let{renderReloadPopup:t}=e;return t({onReload(){r.addEventListener("controlling",(()=>{window.location.reload()})),a()}})})):a());r.addEventListener("waiting",(e=>{c("event waiting",{event:e}),s()})),r.addEventListener("externalwaiting",(e=>{c("event externalwaiting",{event:e}),s()}));const l=await r.register();l&&(l.active&&c("registration.active",{registration:l}),l.installing&&c("registration.installing",{registration:l}),l.waiting&&(c("registration.waiting",{registration:l}),await s()))}().catch((e=>console.error("registerSW failed",e)))))},5729:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});var r=n(5947),a=n.n(r);a().configure({showSpinner:!1});const o={onRouteUpdate(e){let{location:t,previousLocation:n}=e;if(n&&t.pathname!==n.pathname){const e=window.setTimeout((()=>{a().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){a().done()}}},4753:(e,t,n)=>{"use strict";var r=n(1765),a=n(4784);!function(e){const{themeConfig:{prism:t}}=a.default,{additionalLanguages:r}=t,o=globalThis.Prism;globalThis.Prism=e,r.forEach((e=>{"php"===e&&n(9700),n(8692)(`./prism-${e}`)})),delete globalThis.Prism,void 0!==o&&(globalThis.Prism=e)}(r.My)},5225:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});n(6540);var r=n(4164),a=n(3230),o=n(6957),s=n(4783),i=n(7344);const l={anchorWithStickyNavbar:"anchorWithStickyNavbar_LWe7",anchorWithHideOnScrollNavbar:"anchorWithHideOnScrollNavbar_WYt5"};var c=n(4848);function u(e){let{as:t,id:n,...u}=e;const d=(0,i.A)(),{navbar:{hideOnScroll:p}}=(0,o.p)();if("h1"===t||!n)return(0,c.jsx)(t,{...u,id:void 0});d.collectAnchor(n);const g=(0,a.T)({id:"theme.common.headingLinkTitle",message:"Direct link to {heading}",description:"Title for link to heading"},{heading:"string"==typeof u.children?u.children:n});return(0,c.jsxs)(t,{...u,className:(0,r.A)("anchor",p?l.anchorWithHideOnScrollNavbar:l.anchorWithStickyNavbar,u.className),id:n,children:[u.children,(0,c.jsx)(s.A,{className:"hash-link",to:`#${n}`,"aria-label":g,title:g,children:"\u200b"})]})}},716:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});n(6540);const r={iconExternalLink:"iconExternalLink_nPIU"};var a=n(4848);function o(e){let{width:t=13.5,height:n=13.5}=e;return(0,a.jsx)("svg",{width:t,height:n,"aria-hidden":"true",viewBox:"0 0 24 24",className:r.iconExternalLink,children:(0,a.jsx)("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"})})}},7784:(e,t,n)=>{"use strict";n.d(t,{A:()=>Ot});var r=n(6540),a=n(4164),o=n(3832),s=n(4239),i=n(6347),l=n(3230),c=n(4067),u=n(4848);const d="__docusaurus_skipToContent_fallback";function p(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function g(){const e=(0,r.useRef)(null),{action:t}=(0,i.W6)(),n=(0,r.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.getElementById(d);t&&p(t)}),[]);return(0,c.$)((n=>{let{location:r}=n;e.current&&!r.hash&&"PUSH"===t&&p(e.current)})),{containerRef:e,onClick:n}}const f=(0,l.T)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function m(e){const t=e.children??f,{containerRef:n,onClick:r}=g();return(0,u.jsx)("div",{ref:n,role:"region","aria-label":f,children:(0,u.jsx)("a",{...e,href:`#${d}`,onClick:r,children:t})})}var h=n(8630),b=n(9503);const v={skipToContent:"skipToContent_fXgn"};function y(){return(0,u.jsx)(m,{className:v.skipToContent})}var w=n(6957),x=n(2);function k(e){let{width:t=21,height:n=21,color:r="currentColor",strokeWidth:a=1.2,className:o,...s}=e;return(0,u.jsx)("svg",{viewBox:"0 0 15 15",width:t,height:n,...s,children:(0,u.jsx)("g",{stroke:r,strokeWidth:a,children:(0,u.jsx)("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})})})}const j={closeButton:"closeButton_CVFx"};function _(e){return(0,u.jsx)("button",{type:"button","aria-label":(0,l.T)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"}),...e,className:(0,a.A)("clean-btn close",j.closeButton,e.className),children:(0,u.jsx)(k,{width:14,height:14,strokeWidth:3.1})})}const S={content:"content_knG7"};function E(e){const{announcementBar:t}=(0,w.p)(),{content:n}=t;return(0,u.jsx)("div",{...e,className:(0,a.A)(S.content,e.className),dangerouslySetInnerHTML:{__html:n}})}const C={announcementBar:"announcementBar_mb4j",announcementBarPlaceholder:"announcementBarPlaceholder_vyr4",announcementBarClose:"announcementBarClose_gvF7",announcementBarContent:"announcementBarContent_xLdY"};function T(){const{announcementBar:e}=(0,w.p)(),{isActive:t,close:n}=(0,x.M)();if(!t)return null;const{backgroundColor:r,textColor:a,isCloseable:o}=e;return(0,u.jsxs)("div",{className:C.announcementBar,style:{backgroundColor:r,color:a},role:"banner",children:[o&&(0,u.jsx)("div",{className:C.announcementBarPlaceholder}),(0,u.jsx)(E,{className:C.announcementBarContent}),o&&(0,u.jsx)(_,{onClick:n,className:C.announcementBarClose})]})}var A=n(1938),P=n(4245);var R=n(4799),L=n(763);const N=r.createContext(null);function O(e){let{children:t}=e;const n=function(){const e=(0,A.M)(),t=(0,L.YL)(),[n,a]=(0,r.useState)(!1),o=null!==t.component,s=(0,R.ZC)(o);return(0,r.useEffect)((()=>{o&&!s&&a(!0)}),[o,s]),(0,r.useEffect)((()=>{o?e.shown||a(!0):a(!1)}),[e.shown,o]),(0,r.useMemo)((()=>[n,a]),[n])}();return(0,u.jsx)(N.Provider,{value:n,children:t})}function D(e){if(e.component){const t=e.component;return(0,u.jsx)(t,{...e.props})}}function I(){const e=(0,r.useContext)(N);if(!e)throw new R.dV("NavbarSecondaryMenuDisplayProvider");const[t,n]=e,a=(0,r.useCallback)((()=>n(!1)),[n]),o=(0,L.YL)();return(0,r.useMemo)((()=>({shown:t,hide:a,content:D(o)})),[a,o,t])}function M(e){let{header:t,primaryMenu:n,secondaryMenu:r}=e;const{shown:o}=I();return(0,u.jsxs)("div",{className:"navbar-sidebar",children:[t,(0,u.jsxs)("div",{className:(0,a.A)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":o}),children:[(0,u.jsx)("div",{className:"navbar-sidebar__item menu",children:n}),(0,u.jsx)("div",{className:"navbar-sidebar__item menu",children:r})]})]})}var F=n(7710),B=n(1062);function z(e){return(0,u.jsx)("svg",{viewBox:"0 0 24 24",width:24,height:24,...e,children:(0,u.jsx)("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"})})}function $(e){return(0,u.jsx)("svg",{viewBox:"0 0 24 24",width:24,height:24,...e,children:(0,u.jsx)("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"})})}const U={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function q(e){let{className:t,buttonClassName:n,value:r,onChange:o}=e;const s=(0,B.A)(),i=(0,l.T)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===r?(0,l.T)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,l.T)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return(0,u.jsx)("div",{className:(0,a.A)(U.toggle,t),children:(0,u.jsxs)("button",{className:(0,a.A)("clean-btn",U.toggleButton,!s&&U.toggleButtonDisabled,n),type:"button",onClick:()=>o("dark"===r?"light":"dark"),disabled:!s,title:i,"aria-label":i,"aria-live":"polite","aria-pressed":"dark"===r?"true":"false",children:[(0,u.jsx)(z,{className:(0,a.A)(U.toggleIcon,U.lightToggleIcon)}),(0,u.jsx)($,{className:(0,a.A)(U.toggleIcon,U.darkToggleIcon)})]})})}const H=r.memo(q),G={darkNavbarColorModeToggle:"darkNavbarColorModeToggle_X3D1"};function W(e){let{className:t}=e;const n=(0,w.p)().navbar.style,r=(0,w.p)().colorMode.disableSwitch,{colorMode:a,setColorMode:o}=(0,F.G)();return r?null:(0,u.jsx)(H,{className:t,buttonClassName:"dark"===n?G.darkNavbarColorModeToggle:void 0,value:a,onChange:o})}var V=n(20);function K(){return(0,u.jsx)(V.A,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function Q(){const e=(0,A.M)();return(0,u.jsx)("button",{type:"button","aria-label":(0,l.T)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle(),children:(0,u.jsx)(k,{color:"var(--ifm-color-emphasis-600)"})})}function Y(){return(0,u.jsxs)("div",{className:"navbar-sidebar__brand",children:[(0,u.jsx)(K,{}),(0,u.jsx)(W,{className:"margin-right--md"}),(0,u.jsx)(Q,{})]})}var Z=n(4783),X=n(8180),J=n(877),ee=n(7865),te=n(716);function ne(e){let{activeBasePath:t,activeBaseRegex:n,to:r,href:a,label:o,html:s,isDropdownLink:i,prependBaseUrlToHref:l,...c}=e;const d=(0,X.Ay)(r),p=(0,X.Ay)(t),g=(0,X.Ay)(a,{forcePrependBaseUrl:!0}),f=o&&a&&!(0,J.A)(a),m=s?{dangerouslySetInnerHTML:{__html:s}}:{children:(0,u.jsxs)(u.Fragment,{children:[o,f&&(0,u.jsx)(te.A,{...i&&{width:12,height:12}})]})};return a?(0,u.jsx)(Z.A,{href:l?g:a,...c,...m}):(0,u.jsx)(Z.A,{to:d,isNavLink:!0,...(t||n)&&{isActive:(e,t)=>n?(0,ee.G)(n,t.pathname):t.pathname.startsWith(p)},...c,...m})}function re(e){let{className:t,isDropdownItem:n=!1,...r}=e;const o=(0,u.jsx)(ne,{className:(0,a.A)(n?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:n,...r});return n?(0,u.jsx)("li",{children:o}):o}function ae(e){let{className:t,isDropdownItem:n,...r}=e;return(0,u.jsx)("li",{className:"menu__list-item",children:(0,u.jsx)(ne,{className:(0,a.A)("menu__link",t),...r})})}function oe(e){let{mobile:t=!1,position:n,...r}=e;const a=t?ae:re;return(0,u.jsx)(a,{...r,activeClassName:r.activeClassName??(t?"menu__link--active":"navbar__link--active")})}var se=n(4549),ie=n(260),le=n(7639);const ce={dropdownNavbarItemMobile:"dropdownNavbarItemMobile_S0Fm"};function ue(e,t){return e.some((e=>function(e,t){return!!(0,ie.ys)(e.to,t)||!!(0,ee.G)(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)))}function de(e){let{items:t,position:n,className:o,onClick:s,...i}=e;const l=(0,r.useRef)(null),[c,d]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{l.current&&!l.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("focusin",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("focusin",e)}}),[l]),(0,u.jsxs)("div",{ref:l,className:(0,a.A)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===n,"dropdown--show":c}),children:[(0,u.jsx)(ne,{"aria-haspopup":"true","aria-expanded":c,role:"button",href:i.to?void 0:"#",className:(0,a.A)("navbar__link",o),...i,onClick:i.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(!c))},children:i.children??i.label}),(0,u.jsx)("ul",{className:"dropdown__menu",children:t.map(((e,t)=>(0,r.createElement)(We,{isDropdownItem:!0,activeClassName:"dropdown__link--active",...e,key:t})))})]})}function pe(e){let{items:t,className:n,position:o,onClick:s,...l}=e;const c=function(){const{siteConfig:{baseUrl:e}}=(0,le.A)(),{pathname:t}=(0,i.zy)();return t.replace(e,"/")}(),d=ue(t,c),{collapsed:p,toggleCollapsed:g,setCollapsed:f}=(0,se.u)({initialState:()=>!d});return(0,r.useEffect)((()=>{d&&f(!d)}),[c,d,f]),(0,u.jsxs)("li",{className:(0,a.A)("menu__list-item",{"menu__list-item--collapsed":p}),children:[(0,u.jsx)(ne,{role:"button",className:(0,a.A)(ce.dropdownNavbarItemMobile,"menu__link menu__link--sublist menu__link--sublist-caret",n),...l,onClick:e=>{e.preventDefault(),g()},children:l.children??l.label}),(0,u.jsx)(se.N,{lazy:!0,as:"ul",className:"menu__list",collapsed:p,children:t.map(((e,t)=>(0,r.createElement)(We,{mobile:!0,isDropdownItem:!0,onClick:s,activeClassName:"menu__link--active",...e,key:t})))})]})}function ge(e){let{mobile:t=!1,...n}=e;const r=t?pe:de;return(0,u.jsx)(r,{...n})}var fe=n(2098);function me(e){let{width:t=20,height:n=20,...r}=e;return(0,u.jsx)("svg",{viewBox:"0 0 24 24",width:t,height:n,"aria-hidden":!0,...r,children:(0,u.jsx)("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"})})}const he="iconLanguage_nlXk";var be=n(961);function ve(){return r.createElement("svg",{width:"15",height:"15",className:"DocSearch-Control-Key-Icon"},r.createElement("path",{d:"M4.505 4.496h2M5.505 5.496v5M8.216 4.496l.055 5.993M10 7.5c.333.333.5.667.5 1v2M12.326 4.5v5.996M8.384 4.496c1.674 0 2.116 0 2.116 1.5s-.442 1.5-2.116 1.5M3.205 9.303c-.09.448-.277 1.21-1.241 1.203C1 10.5.5 9.513.5 8V7c0-1.57.5-2.5 1.464-2.494.964.006 1.134.598 1.24 1.342M12.553 10.5h1.953",strokeWidth:"1.2",stroke:"currentColor",fill:"none",strokeLinecap:"square"}))}var ye=n(9188),we=["translations"];function xe(){return xe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xe.apply(this,arguments)}function ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],s=!0,i=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(l){i=!0,a=l}finally{try{s||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return je(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return je(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function je(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _e(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Se="Ctrl";var Ee=r.forwardRef((function(e,t){var n=e.translations,a=void 0===n?{}:n,o=_e(e,we),s=a.buttonText,i=void 0===s?"Search":s,l=a.buttonAriaLabel,c=void 0===l?"Search":l,u=ke((0,r.useState)(null),2),d=u[0],p=u[1];return(0,r.useEffect)((function(){"undefined"!=typeof navigator&&(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?p("\u2318"):p(Se))}),[]),r.createElement("button",xe({type:"button",className:"DocSearch DocSearch-Button","aria-label":c},o,{ref:t}),r.createElement("span",{className:"DocSearch-Button-Container"},r.createElement(ye.W,null),r.createElement("span",{className:"DocSearch-Button-Placeholder"},i)),r.createElement("span",{className:"DocSearch-Button-Keys"},null!==d&&r.createElement(r.Fragment,null,r.createElement("kbd",{className:"DocSearch-Button-Key"},d===Se?r.createElement(ve,null):d),r.createElement("kbd",{className:"DocSearch-Button-Key"},"K"))))})),Ce=n(1141),Te=n(1142),Ae=n(2177),Pe=n(1482),Re=n(3718);function Le(){return[`language:${(0,le.A)().i18n.currentLocale}`,function(){const e=(0,Re.v)();return[Pe.C,...e]}().map((e=>`docusaurus_tag:${e}`))]}const Ne={button:{buttonText:(0,l.T)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"}),buttonAriaLabel:(0,l.T)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"})},modal:{searchBox:{resetButtonTitle:(0,l.T)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),resetButtonAriaLabel:(0,l.T)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),cancelButtonText:(0,l.T)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"}),cancelButtonAriaLabel:(0,l.T)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"})},startScreen:{recentSearchesTitle:(0,l.T)({id:"theme.SearchModal.startScreen.recentSearchesTitle",message:"Recent",description:"The title for recent searches"}),noRecentSearchesText:(0,l.T)({id:"theme.SearchModal.startScreen.noRecentSearchesText",message:"No recent searches",description:"The text when no recent searches"}),saveRecentSearchButtonTitle:(0,l.T)({id:"theme.SearchModal.startScreen.saveRecentSearchButtonTitle",message:"Save this search",description:"The label for save recent search button"}),removeRecentSearchButtonTitle:(0,l.T)({id:"theme.SearchModal.startScreen.removeRecentSearchButtonTitle",message:"Remove this search from history",description:"The label for remove recent search button"}),favoriteSearchesTitle:(0,l.T)({id:"theme.SearchModal.startScreen.favoriteSearchesTitle",message:"Favorite",description:"The title for favorite searches"}),removeFavoriteSearchButtonTitle:(0,l.T)({id:"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle",message:"Remove this search from favorites",description:"The label for remove favorite search button"})},errorScreen:{titleText:(0,l.T)({id:"theme.SearchModal.errorScreen.titleText",message:"Unable to fetch results",description:"The title for error screen of search modal"}),helpText:(0,l.T)({id:"theme.SearchModal.errorScreen.helpText",message:"You might want to check your network connection.",description:"The help text for error screen of search modal"})},footer:{selectText:(0,l.T)({id:"theme.SearchModal.footer.selectText",message:"to select",description:"The explanatory text of the action for the enter key"}),selectKeyAriaLabel:(0,l.T)({id:"theme.SearchModal.footer.selectKeyAriaLabel",message:"Enter key",description:"The ARIA label for the Enter key button that makes the selection"}),navigateText:(0,l.T)({id:"theme.SearchModal.footer.navigateText",message:"to navigate",description:"The explanatory text of the action for the Arrow up and Arrow down key"}),navigateUpKeyAriaLabel:(0,l.T)({id:"theme.SearchModal.footer.navigateUpKeyAriaLabel",message:"Arrow up",description:"The ARIA label for the Arrow up key button that makes the navigation"}),navigateDownKeyAriaLabel:(0,l.T)({id:"theme.SearchModal.footer.navigateDownKeyAriaLabel",message:"Arrow down",description:"The ARIA label for the Arrow down key button that makes the navigation"}),closeText:(0,l.T)({id:"theme.SearchModal.footer.closeText",message:"to close",description:"The explanatory text of the action for Escape key"}),closeKeyAriaLabel:(0,l.T)({id:"theme.SearchModal.footer.closeKeyAriaLabel",message:"Escape key",description:"The ARIA label for the Escape key button that close the modal"}),searchByText:(0,l.T)({id:"theme.SearchModal.footer.searchByText",message:"Search by",description:"The text explain that the search is making by Algolia"})},noResultsScreen:{noResultsText:(0,l.T)({id:"theme.SearchModal.noResultsScreen.noResultsText",message:"No results for",description:"The text explains that there are no results for the following search"}),suggestedQueryText:(0,l.T)({id:"theme.SearchModal.noResultsScreen.suggestedQueryText",message:"Try searching for",description:"The text for the suggested query when no results are found for the following search"}),reportMissingResultsText:(0,l.T)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsText",message:"Believe this query should return results?",description:"The text for the question where the user thinks there are missing results"}),reportMissingResultsLinkText:(0,l.T)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText",message:"Let us know.",description:"The text for the link to report missing results"})}},placeholder:(0,l.T)({id:"theme.SearchModal.placeholder",message:"Search docs",description:"The placeholder of the input of the DocSearch pop-up modal"})};let Oe=null;function De(e){let{hit:t,children:n}=e;return(0,u.jsx)(Z.A,{to:t.url,children:n})}function Ie(e){let{state:t,onClose:n}=e;const r=(0,Te.w)();return(0,u.jsx)(Z.A,{to:r(t.query),onClick:n,children:(0,u.jsx)(l.A,{id:"theme.SearchBar.seeAll",values:{count:t.context.nbHits},children:"See all {count} results"})})}function Me(e){let{contextualSearch:t,externalUrlRegex:a,...o}=e;const{siteMetadata:s}=(0,le.A)(),l=(0,Ae.C)(),c=Le(),d=o.searchParameters?.facetFilters??[],p=t?function(e,t){const n=e=>"string"==typeof e?[e]:e;return[...n(e),...n(t)]}(c,d):d,g={...o.searchParameters,facetFilters:p},f=(0,i.W6)(),m=(0,r.useRef)(null),h=(0,r.useRef)(null),[b,v]=(0,r.useState)(!1),[y,w]=(0,r.useState)(void 0),x=(0,r.useCallback)((()=>Oe?Promise.resolve():Promise.all([n.e(9462).then(n.bind(n,9462)),Promise.all([n.e(1869),n.e(8913)]).then(n.bind(n,8913)),Promise.all([n.e(1869),n.e(135)]).then(n.bind(n,135))]).then((e=>{let[{DocSearchModal:t}]=e;Oe=t}))),[]),k=(0,r.useCallback)((()=>{if(!m.current){const e=document.createElement("div");m.current=e,document.body.insertBefore(e,document.body.firstChild)}}),[]),j=(0,r.useCallback)((()=>{k(),x().then((()=>v(!0)))}),[x,k]),_=(0,r.useCallback)((()=>{v(!1),h.current?.focus()}),[]),S=(0,r.useCallback)((e=>{"f"===e.key&&(e.metaKey||e.ctrlKey)||(e.preventDefault(),w(e.key),j())}),[j]),E=(0,r.useRef)({navigate(e){let{itemUrl:t}=e;(0,ee.G)(a,t)?window.location.href=t:f.push(t)}}).current,C=(0,r.useRef)((e=>o.transformItems?o.transformItems(e):e.map((e=>({...e,url:l(e.url)}))))).current,T=(0,r.useMemo)((()=>e=>(0,u.jsx)(Ie,{...e,onClose:_})),[_]),A=(0,r.useCallback)((e=>(e.addAlgoliaAgent("docusaurus",s.docusaurusVersion),e)),[s.docusaurusVersion]);return function(e){var t=e.isOpen,n=e.onOpen,a=e.onClose,o=e.onInput,s=e.searchButtonRef;r.useEffect((function(){function e(e){var r;(27===e.keyCode&&t||"k"===(null===(r=e.key)||void 0===r?void 0:r.toLowerCase())&&(e.metaKey||e.ctrlKey)||!function(e){var t=e.target,n=t.tagName;return t.isContentEditable||"INPUT"===n||"SELECT"===n||"TEXTAREA"===n}(e)&&"/"===e.key&&!t)&&(e.preventDefault(),t?a():document.body.classList.contains("DocSearch--active")||document.body.classList.contains("DocSearch--active")||n()),s&&s.current===document.activeElement&&o&&/[a-zA-Z0-9]/.test(String.fromCharCode(e.keyCode))&&o(e)}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}),[t,n,a,o,s])}({isOpen:b,onOpen:j,onClose:_,onInput:S,searchButtonRef:h}),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Ce.A,{children:(0,u.jsx)("link",{rel:"preconnect",href:`https://${o.appId}-dsn.algolia.net`,crossOrigin:"anonymous"})}),(0,u.jsx)(Ee,{onTouchStart:x,onFocus:x,onMouseOver:x,onClick:j,ref:h,translations:Ne.button}),b&&Oe&&m.current&&(0,be.createPortal)((0,u.jsx)(Oe,{onClose:_,initialScrollY:window.scrollY,initialQuery:y,navigator:E,transformItems:C,hitComponent:De,transformSearchClient:A,...o.searchPagePath&&{resultsFooterComponent:T},...o,searchParameters:g,placeholder:Ne.placeholder,translations:Ne.modal}),m.current)]})}function Fe(){const{siteConfig:e}=(0,le.A)();return(0,u.jsx)(Me,{...e.themeConfig.algolia})}const Be={navbarSearchContainer:"navbarSearchContainer_Bca1"};function ze(e){let{children:t,className:n}=e;return(0,u.jsx)("div",{className:(0,a.A)(n,Be.navbarSearchContainer),children:t})}var $e=n(4721),Ue=n(5357);var qe=n(6457);function He(e,t){return t.alternateDocVersions[e.name]??function(e){return e.docs.find((t=>t.id===e.mainDocId))}(e)}const Ge={default:oe,localeDropdown:function(e){let{mobile:t,dropdownItemsBefore:n,dropdownItemsAfter:r,queryString:a="",...o}=e;const{i18n:{currentLocale:s,locales:c,localeConfigs:d}}=(0,le.A)(),p=(0,fe.o)(),{search:g,hash:f}=(0,i.zy)(),m=[...n,...c.map((e=>{const n=`${`pathname://${p.createUrl({locale:e,fullyQualified:!1})}`}${g}${f}${a}`;return{label:d[e].label,lang:d[e].htmlLang,to:n,target:"_self",autoAddBaseUrl:!1,className:e===s?t?"menu__link--active":"dropdown__link--active":""}})),...r],h=t?(0,l.T)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):d[s].label;return(0,u.jsx)(ge,{...o,mobile:t,label:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(me,{className:he}),h]}),items:m})},search:function(e){let{mobile:t,className:n}=e;return t?null:(0,u.jsx)(ze,{className:n,children:(0,u.jsx)(Fe,{})})},dropdown:ge,html:function(e){let{value:t,className:n,mobile:r=!1,isDropdownItem:o=!1}=e;const s=o?"li":"div";return(0,u.jsx)(s,{className:(0,a.A)({navbar__item:!r&&!o,"menu__list-item":r},n),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){let{docId:t,label:n,docsPluginId:r,...a}=e;const{activeDoc:o}=(0,$e.zK)(r),s=(0,Ue.QB)(t,r),i=o?.path===s?.path;return null===s||s.unlisted&&!i?null:(0,u.jsx)(oe,{exact:!0,...a,isActive:()=>i||!!o?.sidebar&&o.sidebar===s.sidebar,label:n??s.id,to:s.path})},docSidebar:function(e){let{sidebarId:t,label:n,docsPluginId:r,...a}=e;const{activeDoc:o}=(0,$e.zK)(r),s=(0,Ue.fW)(t,r).link;if(!s)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${t}" doesn't have anything to be linked to.`);return(0,u.jsx)(oe,{exact:!0,...a,isActive:()=>o?.sidebar===t,label:n??s.label,to:s.path})},docsVersion:function(e){let{label:t,to:n,docsPluginId:r,...a}=e;const o=(0,Ue.Vd)(r)[0],s=t??o.label,i=n??(e=>e.docs.find((t=>t.id===e.mainDocId)))(o).path;return(0,u.jsx)(oe,{...a,label:s,to:i})},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:n,dropdownActiveClassDisabled:r,dropdownItemsBefore:a,dropdownItemsAfter:o,...s}=e;const{search:c,hash:d}=(0,i.zy)(),p=(0,$e.zK)(n),g=(0,$e.jh)(n),{savePreferredVersionName:f}=(0,qe.g1)(n),m=[...a,...g.map((function(e){const t=He(e,p);return{label:e.label,to:`${t.path}${c}${d}`,isActive:()=>e===p.activeVersion,onClick:()=>f(e.name)}})),...o],h=(0,Ue.Vd)(n)[0],b=t&&m.length>1?(0,l.T)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):h.label,v=t&&m.length>1?void 0:He(h,p).path;return m.length<=1?(0,u.jsx)(oe,{...s,mobile:t,label:b,to:v,isActive:r?()=>!1:void 0}):(0,u.jsx)(ge,{...s,mobile:t,label:b,to:v,items:m,isActive:r?()=>!1:void 0})}};function We(e){let{type:t,...n}=e;const r=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),a=Ge[r];if(!a)throw new Error(`No NavbarItem component found for type "${t}".`);return(0,u.jsx)(a,{...n})}function Ve(){const e=(0,A.M)(),t=(0,w.p)().navbar.items;return(0,u.jsx)("ul",{className:"menu__list",children:t.map(((t,n)=>(0,r.createElement)(We,{mobile:!0,...t,onClick:()=>e.toggle(),key:n})))})}function Ke(e){return(0,u.jsx)("button",{...e,type:"button",className:"clean-btn navbar-sidebar__back",children:(0,u.jsx)(l.A,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)",children:"\u2190 Back to main menu"})})}function Qe(){const e=0===(0,w.p)().navbar.items.length,t=I();return(0,u.jsxs)(u.Fragment,{children:[!e&&(0,u.jsx)(Ke,{onClick:()=>t.hide()}),t.content]})}function Ye(){const e=(0,A.M)();var t;return void 0===(t=e.shown)&&(t=!0),(0,r.useEffect)((()=>(document.body.style.overflow=t?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[t]),e.shouldRender?(0,u.jsx)(M,{header:(0,u.jsx)(Y,{}),primaryMenu:(0,u.jsx)(Ve,{}),secondaryMenu:(0,u.jsx)(Qe,{})}):null}const Ze={navbarHideable:"navbarHideable_m1mJ",navbarHidden:"navbarHidden_jGov"};function Xe(e){return(0,u.jsx)("div",{role:"presentation",...e,className:(0,a.A)("navbar-sidebar__backdrop",e.className)})}function Je(e){let{children:t}=e;const{navbar:{hideOnScroll:n,style:o}}=(0,w.p)(),s=(0,A.M)(),{navbarRef:i,isNavbarVisible:d}=function(e){const[t,n]=(0,r.useState)(e),a=(0,r.useRef)(!1),o=(0,r.useRef)(0),s=(0,r.useCallback)((e=>{null!==e&&(o.current=e.getBoundingClientRect().height)}),[]);return(0,P.Mq)(((t,r)=>{let{scrollY:s}=t;if(!e)return;if(s<o.current)return void n(!0);if(a.current)return void(a.current=!1);const i=r?.scrollY,l=document.documentElement.scrollHeight-o.current,c=window.innerHeight;i&&s>=i?n(!1):s+c<l&&n(!0)})),(0,c.$)((t=>{if(!e)return;const r=t.location.hash;if(r?document.getElementById(r.substring(1)):void 0)return a.current=!0,void n(!1);n(!0)})),{navbarRef:s,isNavbarVisible:t}}(n);return(0,u.jsxs)("nav",{ref:i,"aria-label":(0,l.T)({id:"theme.NavBar.navAriaLabel",message:"Main",description:"The ARIA label for the main navigation"}),className:(0,a.A)("navbar","navbar--fixed-top",n&&[Ze.navbarHideable,!d&&Ze.navbarHidden],{"navbar--dark":"dark"===o,"navbar--primary":"primary"===o,"navbar-sidebar--show":s.shown}),children:[t,(0,u.jsx)(Xe,{onClick:s.toggle}),(0,u.jsx)(Ye,{})]})}var et=n(4609);const tt={errorBoundaryError:"errorBoundaryError_a6uf",errorBoundaryFallback:"errorBoundaryFallback_VBag"};function nt(e){return(0,u.jsx)("button",{type:"button",...e,children:(0,u.jsx)(l.A,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again rendering when the React error boundary captures an error",children:"Try again"})})}function rt(e){let{error:t}=e;const n=(0,et.rA)(t).map((e=>e.message)).join("\n\nCause:\n");return(0,u.jsx)("p",{className:tt.errorBoundaryError,children:n})}class at extends r.Component{componentDidCatch(e,t){throw this.props.onError(e,t)}render(){return this.props.children}}const ot="right";function st(e){let{width:t=30,height:n=30,className:r,...a}=e;return(0,u.jsx)("svg",{className:r,width:t,height:n,viewBox:"0 0 30 30","aria-hidden":"true",...a,children:(0,u.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"})})}function it(){const{toggle:e,shown:t}=(0,A.M)();return(0,u.jsx)("button",{onClick:e,"aria-label":(0,l.T)({id:"theme.docs.sidebar.toggleSidebarButtonAriaLabel",message:"Toggle navigation bar",description:"The ARIA label for hamburger menu button of mobile navigation"}),"aria-expanded":t,className:"navbar__toggle clean-btn",type:"button",children:(0,u.jsx)(st,{})})}const lt={colorModeToggle:"colorModeToggle_DEke"};function ct(e){let{items:t}=e;return(0,u.jsx)(u.Fragment,{children:t.map(((e,t)=>(0,u.jsx)(at,{onError:t=>new Error(`A theme navbar item failed to render.\nPlease double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:\n${JSON.stringify(e,null,2)}`,{cause:t}),children:(0,u.jsx)(We,{...e})},t)))})}function ut(e){let{left:t,right:n}=e;return(0,u.jsxs)("div",{className:"navbar__inner",children:[(0,u.jsx)("div",{className:"navbar__items",children:t}),(0,u.jsx)("div",{className:"navbar__items navbar__items--right",children:n})]})}function dt(){const e=(0,A.M)(),t=(0,w.p)().navbar.items,[n,r]=function(e){function t(e){return"left"===(e.position??ot)}return[e.filter(t),e.filter((e=>!t(e)))]}(t),a=t.find((e=>"search"===e.type));return(0,u.jsx)(ut,{left:(0,u.jsxs)(u.Fragment,{children:[!e.disabled&&(0,u.jsx)(it,{}),(0,u.jsx)(K,{}),(0,u.jsx)(ct,{items:n})]}),right:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ct,{items:r}),(0,u.jsx)(W,{className:lt.colorModeToggle}),!a&&(0,u.jsx)(ze,{children:(0,u.jsx)(Fe,{})})]})})}function pt(){return(0,u.jsx)(Je,{children:(0,u.jsx)(dt,{})})}function gt(e){let{item:t}=e;const{to:n,href:r,label:a,prependBaseUrlToHref:o,...s}=t,i=(0,X.Ay)(n),l=(0,X.Ay)(r,{forcePrependBaseUrl:!0});return(0,u.jsxs)(Z.A,{className:"footer__link-item",...r?{href:o?l:r}:{to:i},...s,children:[a,r&&!(0,J.A)(r)&&(0,u.jsx)(te.A,{})]})}function ft(e){let{item:t}=e;return t.html?(0,u.jsx)("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:t.html}}):(0,u.jsx)("li",{className:"footer__item",children:(0,u.jsx)(gt,{item:t})},t.href??t.to)}function mt(e){let{column:t}=e;return(0,u.jsxs)("div",{className:"col footer__col",children:[(0,u.jsx)("div",{className:"footer__title",children:t.title}),(0,u.jsx)("ul",{className:"footer__items clean-list",children:t.items.map(((e,t)=>(0,u.jsx)(ft,{item:e},t)))})]})}function ht(e){let{columns:t}=e;return(0,u.jsx)("div",{className:"row footer__links",children:t.map(((e,t)=>(0,u.jsx)(mt,{column:e},t)))})}function bt(){return(0,u.jsx)("span",{className:"footer__link-separator",children:"\xb7"})}function vt(e){let{item:t}=e;return t.html?(0,u.jsx)("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:t.html}}):(0,u.jsx)(gt,{item:t})}function yt(e){let{links:t}=e;return(0,u.jsx)("div",{className:"footer__links text--center",children:(0,u.jsx)("div",{className:"footer__links",children:t.map(((e,n)=>(0,u.jsxs)(r.Fragment,{children:[(0,u.jsx)(vt,{item:e}),t.length!==n+1&&(0,u.jsx)(bt,{})]},n)))})})}function wt(e){let{links:t}=e;return function(e){return"title"in e[0]}(t)?(0,u.jsx)(ht,{columns:t}):(0,u.jsx)(yt,{links:t})}var xt=n(975);const kt={footerLogoLink:"footerLogoLink_BH7S"};function jt(e){let{logo:t}=e;const{withBaseUrl:n}=(0,X.hH)(),r={light:n(t.src),dark:n(t.srcDark??t.src)};return(0,u.jsx)(xt.A,{className:(0,a.A)("footer__logo",t.className),alt:t.alt,sources:r,width:t.width,height:t.height,style:t.style})}function _t(e){let{logo:t}=e;return t.href?(0,u.jsx)(Z.A,{href:t.href,className:kt.footerLogoLink,target:t.target,children:(0,u.jsx)(jt,{logo:t})}):(0,u.jsx)(jt,{logo:t})}function St(e){let{copyright:t}=e;return(0,u.jsx)("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function Et(e){let{style:t,links:n,logo:r,copyright:o}=e;return(0,u.jsx)("footer",{className:(0,a.A)("footer",{"footer--dark":"dark"===t}),children:(0,u.jsxs)("div",{className:"container container-fluid",children:[n,(r||o)&&(0,u.jsxs)("div",{className:"footer__bottom text--center",children:[r&&(0,u.jsx)("div",{className:"margin-bottom--sm",children:r}),o]})]})})}function Ct(){const{footer:e}=(0,w.p)();if(!e)return null;const{copyright:t,links:n,logo:r,style:a}=e;return(0,u.jsx)(Et,{style:a,links:n&&n.length>0&&(0,u.jsx)(wt,{links:n}),logo:r&&(0,u.jsx)(_t,{logo:r}),copyright:t&&(0,u.jsx)(St,{copyright:t})})}const Tt=r.memo(Ct),At=(0,R.fM)([F.a,x.o,P.Tv,qe.VQ,s.Jx,function(e){let{children:t}=e;return(0,u.jsx)(L.y_,{children:(0,u.jsx)(A.e,{children:(0,u.jsx)(O,{children:t})})})}]);function Pt(e){let{children:t}=e;return(0,u.jsx)(At,{children:t})}var Rt=n(5225);function Lt(e){let{error:t,tryAgain:n}=e;return(0,u.jsx)("main",{className:"container margin-vert--xl",children:(0,u.jsx)("div",{className:"row",children:(0,u.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,u.jsx)(Rt.A,{as:"h1",className:"hero__title",children:(0,u.jsx)(l.A,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed",children:"This page crashed."})}),(0,u.jsx)("div",{className:"margin-vert--lg",children:(0,u.jsx)(nt,{onClick:n,className:"button button--primary shadow--lw"})}),(0,u.jsx)("hr",{}),(0,u.jsx)("div",{className:"margin-vert--md",children:(0,u.jsx)(rt,{error:t})})]})})})}const Nt={mainWrapper:"mainWrapper_z2l0"};function Ot(e){const{children:t,noFooter:n,wrapperClassName:r,title:i,description:l}=e;return(0,b.J)(),(0,u.jsxs)(Pt,{children:[(0,u.jsx)(s.be,{title:i,description:l}),(0,u.jsx)(y,{}),(0,u.jsx)(T,{}),(0,u.jsx)(pt,{}),(0,u.jsx)("div",{id:d,className:(0,a.A)(h.G.wrapper.main,Nt.mainWrapper,r),children:(0,u.jsx)(o.A,{fallback:e=>(0,u.jsx)(Lt,{...e}),children:t})}),!n&&(0,u.jsx)(Tt,{})]})}},20:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});n(6540);var r=n(4783),a=n(8180),o=n(7639),s=n(6957),i=n(975),l=n(4848);function c(e){let{logo:t,alt:n,imageClassName:r}=e;const o={light:(0,a.Ay)(t.src),dark:(0,a.Ay)(t.srcDark||t.src)},s=(0,l.jsx)(i.A,{className:t.className,sources:o,height:t.height,width:t.width,alt:n,style:t.style});return r?(0,l.jsx)("div",{className:r,children:s}):s}function u(e){const{siteConfig:{title:t}}=(0,o.A)(),{navbar:{title:n,logo:i}}=(0,s.p)(),{imageClassName:u,titleClassName:d,...p}=e,g=(0,a.Ay)(i?.href||"/"),f=n?"":t,m=i?.alt??f;return(0,l.jsxs)(r.A,{to:g,...p,...i?.target&&{target:i.target},children:[i&&(0,l.jsx)(c,{logo:i,alt:m,imageClassName:u}),null!=n&&(0,l.jsx)("b",{className:d,children:n})]})}},1210:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});n(6540);var r=n(1141),a=n(4848);function o(e){let{locale:t,version:n,tag:o}=e;const s=t;return(0,a.jsxs)(r.A,{children:[t&&(0,a.jsx)("meta",{name:"docusaurus_locale",content:t}),n&&(0,a.jsx)("meta",{name:"docusaurus_version",content:n}),o&&(0,a.jsx)("meta",{name:"docusaurus_tag",content:o}),s&&(0,a.jsx)("meta",{name:"docsearch:language",content:s}),n&&(0,a.jsx)("meta",{name:"docsearch:version",content:n}),o&&(0,a.jsx)("meta",{name:"docsearch:docusaurus_tag",content:o})]})}},975:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(6540),a=n(4164),o=n(1062),s=n(7710);const i={themedComponent:"themedComponent_mlkZ","themedComponent--light":"themedComponent--light_NVdE","themedComponent--dark":"themedComponent--dark_xIcU"};var l=n(4848);function c(e){let{className:t,children:n}=e;const c=(0,o.A)(),{colorMode:u}=(0,s.G)();return(0,l.jsx)(l.Fragment,{children:(c?"dark"===u?["dark"]:["light"]:["light","dark"]).map((e=>{const o=n({theme:e,className:(0,a.A)(t,i.themedComponent,i[`themedComponent--${e}`])});return(0,l.jsx)(r.Fragment,{children:o},e)}))})}function u(e){const{sources:t,className:n,alt:r,...a}=e;return(0,l.jsx)(c,{className:n,children:e=>{let{theme:n,className:o}=e;return(0,l.jsx)("img",{src:t[n],alt:r,className:o,...a})}})}},4549:(e,t,n)=>{"use strict";n.d(t,{N:()=>b,u:()=>c});var r=n(6540),a=n(1712),o=n(6494),s=n(6350),i=n(4848);const l="ease-in-out";function c(e){let{initialState:t}=e;const[n,a]=(0,r.useState)(t??!1),o=(0,r.useCallback)((()=>{a((e=>!e))}),[]);return{collapsed:n,setCollapsed:a,toggleCollapsed:o}}const u={display:"none",overflow:"hidden",height:"0px"},d={display:"block",overflow:"visible",height:"auto"};function p(e,t){const n=t?u:d;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function g(e){let{collapsibleRef:t,collapsed:n,animation:a}=e;const o=(0,r.useRef)(!1);(0,r.useEffect)((()=>{const e=t.current;function r(){const t=e.scrollHeight,n=a?.duration??function(e){if((0,s.O)())return 1;const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${n}ms ${a?.easing??l}`,height:`${t}px`}}function i(){const t=r();e.style.transition=t.transition,e.style.height=t.height}if(!o.current)return p(e,n),void(o.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{n?(i(),requestAnimationFrame((()=>{e.style.height=u.height,e.style.overflow=u.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{i()})))}));return()=>cancelAnimationFrame(t)}()}),[t,n,a])}function f(e){if(!a.A.canUseDOM)return e?u:d}function m(e){let{as:t="div",collapsed:n,children:a,animation:o,onCollapseTransitionEnd:s,className:l,disableSSRStyle:c}=e;const u=(0,r.useRef)(null);return g({collapsibleRef:u,collapsed:n,animation:o}),(0,i.jsx)(t,{ref:u,style:c?void 0:f(n),onTransitionEnd:e=>{"height"===e.propertyName&&(p(u.current,n),s?.(n))},className:l,children:a})}function h(e){let{collapsed:t,...n}=e;const[a,s]=(0,r.useState)(!t),[l,c]=(0,r.useState)(t);return(0,o.A)((()=>{t||s(!0)}),[t]),(0,o.A)((()=>{a&&c(t)}),[a,t]),a?(0,i.jsx)(m,{...n,collapsed:l}):null}function b(e){let{lazy:t,...n}=e;const r=t?h:m;return(0,i.jsx)(r,{...n})}},2:(e,t,n)=>{"use strict";n.d(t,{M:()=>m,o:()=>f});var r=n(6540),a=n(1062),o=n(9900),s=n(4799),i=n(6957),l=n(4848);const c=(0,o.Wf)("docusaurus.announcement.dismiss"),u=(0,o.Wf)("docusaurus.announcement.id"),d=()=>"true"===c.get(),p=e=>c.set(String(e)),g=r.createContext(null);function f(e){let{children:t}=e;const n=function(){const{announcementBar:e}=(0,i.p)(),t=(0,a.A)(),[n,o]=(0,r.useState)((()=>!!t&&d()));(0,r.useEffect)((()=>{o(d())}),[]);const s=(0,r.useCallback)((()=>{p(!0),o(!0)}),[]);return(0,r.useEffect)((()=>{if(!e)return;const{id:t}=e;let n=u.get();"annoucement-bar"===n&&(n="announcement-bar");const r=t!==n;u.set(t),r&&p(!1),!r&&d()||o(!1)}),[e]),(0,r.useMemo)((()=>({isActive:!!e&&!n,close:s})),[e,n,s])}();return(0,l.jsx)(g.Provider,{value:n,children:t})}function m(){const e=(0,r.useContext)(g);if(!e)throw new s.dV("AnnouncementBarProvider");return e}},7710:(e,t,n)=>{"use strict";n.d(t,{G:()=>b,a:()=>h});var r=n(6540),a=n(1712),o=n(4799),s=n(9900),i=n(6957),l=n(4848);const c=r.createContext(void 0),u="theme",d=(0,s.Wf)(u),p={light:"light",dark:"dark"},g=e=>e===p.dark?p.dark:p.light,f=e=>a.A.canUseDOM?g(document.documentElement.getAttribute("data-theme")):g(e),m=e=>{d.set(g(e))};function h(e){let{children:t}=e;const n=function(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:n}}=(0,i.p)(),[a,o]=(0,r.useState)(f(e));(0,r.useEffect)((()=>{t&&d.del()}),[t]);const s=(0,r.useCallback)((function(t,r){void 0===r&&(r={});const{persist:a=!0}=r;t?(o(t),a&&m(t)):(o(n?window.matchMedia("(prefers-color-scheme: dark)").matches?p.dark:p.light:e),d.del())}),[n,e]);(0,r.useEffect)((()=>{document.documentElement.setAttribute("data-theme",g(a))}),[a]),(0,r.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==u)return;const t=d.get();null!==t&&s(g(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,s]);const l=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{if(t&&!n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{window.matchMedia("print").matches||l.current?l.current=window.matchMedia("print").matches:s(null)};return e.addListener(r),()=>e.removeListener(r)}),[s,t,n]),(0,r.useMemo)((()=>({colorMode:a,setColorMode:s,get isDarkTheme(){return a===p.dark},setLightTheme(){s(p.light)},setDarkTheme(){s(p.dark)}})),[a,s])}();return(0,l.jsx)(c.Provider,{value:n,children:t})}function b(){const e=(0,r.useContext)(c);if(null==e)throw new o.dV("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},1938:(e,t,n)=>{"use strict";n.d(t,{M:()=>g,e:()=>p});var r=n(6540),a=n(763),o=n(2216),s=n(2814),i=n(6957),l=n(4799),c=n(4848);const u=r.createContext(void 0);function d(){const e=function(){const e=(0,a.YL)(),{items:t}=(0,i.p)().navbar;return 0===t.length&&!e.component}(),t=(0,o.l)(),n=!e&&"mobile"===t,[l,c]=(0,r.useState)(!1);(0,s.$Z)((()=>{if(l)return c(!1),!1}));const u=(0,r.useCallback)((()=>{c((e=>!e))}),[]);return(0,r.useEffect)((()=>{"desktop"===t&&c(!1)}),[t]),(0,r.useMemo)((()=>({disabled:e,shouldRender:n,toggle:u,shown:l})),[e,n,u,l])}function p(e){let{children:t}=e;const n=d();return(0,c.jsx)(u.Provider,{value:n,children:t})}function g(){const e=r.useContext(u);if(void 0===e)throw new l.dV("NavbarMobileSidebarProvider");return e}},763:(e,t,n)=>{"use strict";n.d(t,{GX:()=>c,YL:()=>l,y_:()=>i});var r=n(6540),a=n(4799),o=n(4848);const s=r.createContext(null);function i(e){let{children:t}=e;const n=(0,r.useState)({component:null,props:null});return(0,o.jsx)(s.Provider,{value:n,children:t})}function l(){const e=(0,r.useContext)(s);if(!e)throw new a.dV("NavbarSecondaryMenuContentProvider");return e[0]}function c(e){let{component:t,props:n}=e;const o=(0,r.useContext)(s);if(!o)throw new a.dV("NavbarSecondaryMenuContentProvider");const[,i]=o,l=(0,a.Be)(n);return(0,r.useEffect)((()=>{i({component:t,props:l})}),[i,t,l]),(0,r.useEffect)((()=>()=>i({component:null,props:null})),[i]),null}},9503:(e,t,n)=>{"use strict";n.d(t,{w:()=>a,J:()=>o});var r=n(6540);const a="navigation-with-keyboard";function o(){(0,r.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(a),"mousedown"===e.type&&document.body.classList.remove(a)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(a),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},1142:(e,t,n)=>{"use strict";n.d(t,{b:()=>i,w:()=>l});var r=n(6540),a=n(7639),o=n(2814);const s="q";function i(){return(0,o.l)(s)}function l(){const{siteConfig:{baseUrl:e,themeConfig:t}}=(0,a.A)(),{algolia:{searchPagePath:n}}=t;return(0,r.useCallback)((t=>`${e}${n}?${s}=${encodeURIComponent(t)}`),[e,n])}},2216:(e,t,n)=>{"use strict";n.d(t,{l:()=>i});var r=n(6540),a=n(1712);const o={desktop:"desktop",mobile:"mobile",ssr:"ssr"},s=996;function i(e){let{desktopBreakpoint:t=s}=void 0===e?{}:e;const[n,i]=(0,r.useState)((()=>"ssr"));return(0,r.useEffect)((()=>{function e(){i(function(e){if(!a.A.canUseDOM)throw new Error("getWindowSize() should only be called after React hydration");return window.innerWidth>e?o.desktop:o.mobile}(t))}return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[t]),n}},8630:(e,t,n)=>{"use strict";n.d(t,{G:()=>r});const r={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",blogAuthorsListPage:"blog-authors-list-page",blogAuthorsPostsPage:"blog-authors-posts-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",unlistedBanner:"theme-unlisted-banner",draftBanner:"theme-draft-banner",admonitionType:e=>`theme-admonition-${e}`},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{blogFooterTagsRow:"theme-blog-footer-tags-row",blogFooterEditMetaRow:"theme-blog-footer-edit-meta-row"},pages:{pageFooterEditMetaRow:"theme-pages-footer-edit-meta-row"}}},6350:(e,t,n)=>{"use strict";function r(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}n.d(t,{O:()=>r})},7942:(e,t,n)=>{"use strict";n.d(t,{s:()=>a});var r=n(7639);function a(e){const{siteConfig:t}=(0,r.A)(),{title:n,titleDelimiter:a}=t;return e?.trim().length?`${e.trim()} ${a} ${n}`:n}},2814:(e,t,n)=>{"use strict";n.d(t,{$Z:()=>s,aZ:()=>l,l:()=>c});var r=n(6540),a=n(6347),o=n(4799);function s(e){!function(e){const t=(0,a.W6)(),n=(0,o._q)(e);(0,r.useEffect)((()=>t.block(((e,t)=>n(e,t)))),[t,n])}(((t,n)=>{if("POP"===n)return e(t,n)}))}function i(e){const t=(0,a.W6)();return(0,r.useSyncExternalStore)(t.listen,(()=>e(t)),(()=>e(t)))}function l(e){return i((t=>null===e?null:new URLSearchParams(t.location.search).get(e)))}function c(e){const t=l(e)??"",n=function(e){const t=(0,a.W6)();return(0,r.useCallback)(((n,r)=>{const a=new URLSearchParams(t.location.search);n?a.set(e,n):a.delete(e),(r?.push?t.push:t.replace)({search:a.toString()})}),[e,t])}(e);return[t,n]}},5167:(e,t,n)=>{"use strict";function r(e,t){return void 0===t&&(t=(e,t)=>e===t),e.filter(((n,r)=>e.findIndex((e=>t(e,n)))!==r))}function a(e){return Array.from(new Set(e))}n.d(t,{XI:()=>r,sb:()=>a})},4239:(e,t,n)=>{"use strict";n.d(t,{e3:()=>g,be:()=>d,Jx:()=>f});var r=n(6540),a=n(4164),o=n(1141),s=n(3363);function i(){const e=r.useContext(s.o);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var l=n(8180),c=n(7942),u=n(4848);function d(e){let{title:t,description:n,keywords:r,image:a,children:s}=e;const i=(0,c.s)(t),{withBaseUrl:d}=(0,l.hH)(),p=a?d(a,{absolute:!0}):void 0;return(0,u.jsxs)(o.A,{children:[t&&(0,u.jsx)("title",{children:i}),t&&(0,u.jsx)("meta",{property:"og:title",content:i}),n&&(0,u.jsx)("meta",{name:"description",content:n}),n&&(0,u.jsx)("meta",{property:"og:description",content:n}),r&&(0,u.jsx)("meta",{name:"keywords",content:Array.isArray(r)?r.join(","):r}),p&&(0,u.jsx)("meta",{property:"og:image",content:p}),p&&(0,u.jsx)("meta",{name:"twitter:image",content:p}),s]})}const p=r.createContext(void 0);function g(e){let{className:t,children:n}=e;const s=r.useContext(p),i=(0,a.A)(s,t);return(0,u.jsxs)(p.Provider,{value:i,children:[(0,u.jsx)(o.A,{children:(0,u.jsx)("html",{className:i})}),n]})}function f(e){let{children:t}=e;const n=i(),r=`plugin-${n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const o=`plugin-id-${n.plugin.id}`;return(0,u.jsx)(g,{className:(0,a.A)(r,o),children:t})}},4799:(e,t,n)=>{"use strict";n.d(t,{Be:()=>c,ZC:()=>i,_q:()=>s,dV:()=>l,fM:()=>u});var r=n(6540),a=n(6494),o=n(4848);function s(e){const t=(0,r.useRef)(e);return(0,a.A)((()=>{t.current=e}),[e]),(0,r.useCallback)((function(){return t.current(...arguments)}),[])}function i(e){const t=(0,r.useRef)();return(0,a.A)((()=>{t.current=e})),t.current}class l extends Error{constructor(e,t){super(),this.name="ReactContextError",this.message=`Hook ${this.stack?.split("\n")[1]?.match(/at (?:\w+\.)?(?<name>\w+)/)?.groups.name??""} is called outside the <${e}>. ${t??""}`}}function c(e){const t=Object.entries(e);return t.sort(((e,t)=>e[0].localeCompare(t[0]))),(0,r.useMemo)((()=>e),t.flat())}function u(e){return t=>{let{children:n}=t;return(0,o.jsx)(o.Fragment,{children:e.reduceRight(((e,t)=>(0,o.jsx)(t,{children:e})),n)})}}},7865:(e,t,n)=>{"use strict";function r(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}n.d(t,{G:()=>r})},260:(e,t,n)=>{"use strict";n.d(t,{Dt:()=>i,ys:()=>s});var r=n(6540),a=n(2413),o=n(7639);function s(e,t){const n=e=>(!e||e.endsWith("/")?e:`${e}/`)?.toLowerCase();return n(e)===n(t)}function i(){const{baseUrl:e}=(0,o.A)().siteConfig;return(0,r.useMemo)((()=>function(e){let{baseUrl:t,routes:n}=e;function r(e){return e.path===t&&!0===e.exact}function a(e){return e.path===t&&!e.exact}return function e(t){if(0===t.length)return;return t.find(r)||e(t.filter(a).flatMap((e=>e.routes??[])))}(n)}({routes:a.A,baseUrl:e})),[e])}},4245:(e,t,n)=>{"use strict";n.d(t,{Mq:()=>g,Tv:()=>u,a_:()=>f,gk:()=>m});var r=n(6540),a=n(1712),o=n(1062),s=n(6494),i=n(4799),l=n(4848);const c=r.createContext(void 0);function u(e){let{children:t}=e;const n=function(){const e=(0,r.useRef)(!0);return(0,r.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return(0,l.jsx)(c.Provider,{value:n,children:t})}function d(){const e=(0,r.useContext)(c);if(null==e)throw new i.dV("ScrollControllerProvider");return e}const p=()=>a.A.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function g(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:n}=d(),a=(0,r.useRef)(p()),o=(0,i._q)(e);(0,r.useEffect)((()=>{const e=()=>{if(!n.current)return;const e=p();o(e,a.current),a.current=e},t={passive:!0};return e(),window.addEventListener("scroll",e,t),()=>window.removeEventListener("scroll",e,t)}),[o,n,...t])}function f(){const e=d(),t=function(){const e=(0,r.useRef)({elem:null,top:0}),t=(0,r.useCallback)((t=>{e.current={elem:t,top:t.getBoundingClientRect().top}}),[]),n=(0,r.useCallback)((()=>{const{current:{elem:t,top:n}}=e;if(!t)return{restored:!1};const r=t.getBoundingClientRect().top-n;return r&&window.scrollBy({left:0,top:r}),e.current={elem:null,top:0},{restored:0!==r}}),[]);return(0,r.useMemo)((()=>({save:t,restore:n})),[n,t])}(),n=(0,r.useRef)(void 0),a=(0,r.useCallback)((r=>{t.save(r),e.disableScrollEvents(),n.current=()=>{const{restored:r}=t.restore();if(n.current=void 0,r){const t=()=>{e.enableScrollEvents(),window.removeEventListener("scroll",t)};window.addEventListener("scroll",t)}else e.enableScrollEvents()}}),[e,t]);return(0,s.A)((()=>{queueMicrotask((()=>n.current?.()))})),{blockElementScrollPositionUntilNextRender:a}}function m(){const e=(0,r.useRef)(null),t=(0,o.A)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:n=>{e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(n):function(e){let t=null;const n=document.documentElement.scrollTop>e;return function r(){const a=document.documentElement.scrollTop;(n&&a>e||!n&&a<e)&&(t=requestAnimationFrame(r),window.scrollTo(0,Math.floor(.85*(a-e))+e))}(),()=>t&&cancelAnimationFrame(t)}(n)},cancelScroll:()=>e.current?.()}}},1482:(e,t,n)=>{"use strict";n.d(t,{C:()=>r});const r="default"},9900:(e,t,n)=>{"use strict";n.d(t,{Wf:()=>u,Dv:()=>d});var r=n(6540);const a=JSON.parse('{"N":"localStorage","M":""}'),o=a.N;function s(e){let{key:t,oldValue:n,newValue:r,storage:a}=e;if(n===r)return;const o=document.createEvent("StorageEvent");o.initStorageEvent("storage",!1,!1,t,n,r,window.location.href,a),window.dispatchEvent(o)}function i(e){if(void 0===e&&(e=o),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(n){return t=n,l||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),l=!0),null}var t}let l=!1;const c={get:()=>null,set:()=>{},del:()=>{},listen:()=>()=>{}};function u(e,t){const n=`${e}${a.M}`;if("undefined"==typeof window)return function(e){function t(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:t,set:t,del:t,listen:t}}(n);const r=i(t?.persistence);return null===r?c:{get:()=>{try{return r.getItem(n)}catch(e){return console.error(`Docusaurus storage error, can't get key=${n}`,e),null}},set:e=>{try{const t=r.getItem(n);r.setItem(n,e),s({key:n,oldValue:t,newValue:e,storage:r})}catch(t){console.error(`Docusaurus storage error, can't set ${n}=${e}`,t)}},del:()=>{try{const e=r.getItem(n);r.removeItem(n),s({key:n,oldValue:e,newValue:null,storage:r})}catch(e){console.error(`Docusaurus storage error, can't delete key=${n}`,e)}},listen:e=>{try{const t=t=>{t.storageArea===r&&t.key===n&&e(t)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}catch(t){return console.error(`Docusaurus storage error, can't listen for changes of key=${n}`,t),()=>{}}}}}function d(e,t){const n=(0,r.useRef)((()=>null===e?c:u(e,t))).current(),a=(0,r.useCallback)((e=>"undefined"==typeof window?()=>{}:n.listen(e)),[n]);return[(0,r.useSyncExternalStore)(a,(()=>"undefined"==typeof window?null:n.get()),(()=>null)),n]}},2098:(e,t,n)=>{"use strict";n.d(t,{o:()=>s});var r=n(7639),a=n(6347),o=n(4609);function s(){const{siteConfig:{baseUrl:e,url:t,trailingSlash:n},i18n:{defaultLocale:s,currentLocale:i}}=(0,r.A)(),{pathname:l}=(0,a.zy)(),c=(0,o.Ks)(l,{trailingSlash:n,baseUrl:e}),u=i===s?e:e.replace(`/${i}/`,"/"),d=c.replace(e,"");return{createUrl:function(e){let{locale:n,fullyQualified:r}=e;return`${r?t:""}${function(e){return e===s?`${u}`:`${u}${e}/`}(n)}${d}`}}}},4067:(e,t,n)=>{"use strict";n.d(t,{$:()=>s});var r=n(6540),a=n(6347),o=n(4799);function s(e){const t=(0,a.zy)(),n=(0,o.ZC)(t),s=(0,o._q)(e);(0,r.useEffect)((()=>{n&&t!==n&&s({location:t,previousLocation:n})}),[s,t,n])}},6957:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(7639);function a(){return(0,r.A)().siteConfig.themeConfig}},6349:(e,t,n)=>{"use strict";n.d(t,{c:()=>a});var r=n(7639);function a(){const{siteConfig:{themeConfig:e}}=(0,r.A)();return e}},2177:(e,t,n)=>{"use strict";n.d(t,{C:()=>i});var r=n(6540),a=n(7865),o=n(8180),s=n(6349);function i(){const{withBaseUrl:e}=(0,o.hH)(),{algolia:{externalUrlRegex:t,replaceSearchResultPathname:n}}=(0,s.c)();return(0,r.useCallback)((r=>{const o=new URL(r);if((0,a.G)(t,o.href))return r;const s=`${o.pathname+o.hash}`;return e(function(e,t){return t?e.replaceAll(new RegExp(t.from,"g"),t.to):e}(s,n))}),[e,t,n])}},4356:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addTrailingSlash=a,t.default=function(e,t){const{trailingSlash:n,baseUrl:r}=t;if(e.startsWith("#"))return e;if(void 0===n)return e;const[s]=e.split(/[#?]/),i="/"===s||s===r?s:(l=s,c=n,c?a(l):o(l));var l,c;return e.replace(s,i)},t.addLeadingSlash=function(e){return(0,r.addPrefix)(e,"/")},t.removeTrailingSlash=o;const r=n(835);function a(e){return e.endsWith("/")?e:`${e}/`}function o(e){return(0,r.removeSuffix)(e,"/")}},8274:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCausalChain=function e(t){if(t.cause)return[t,...e(t.cause)];return[t]}},4609:(e,t,n)=>{"use strict";t.rA=t.Ks=void 0;const r=n(1635);var a=n(4356);Object.defineProperty(t,"Ks",{enumerable:!0,get:function(){return r.__importDefault(a).default}});var o=n(835);var s=n(8274);Object.defineProperty(t,"rA",{enumerable:!0,get:function(){return s.getErrorCausalChain}})},835:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addPrefix=function(e,t){return e.startsWith(t)?e:`${t}${e}`},t.removeSuffix=function(e,t){if(""===t)return e;return e.endsWith(t)?e.slice(0,-t.length):e},t.addSuffix=function(e,t){return e.endsWith(t)?e:`${e}${t}`},t.removePrefix=function(e,t){return e.startsWith(t)?e.slice(t.length):e}},1513:(e,t,n)=>{"use strict";n.d(t,{zR:()=>w,TM:()=>E,yJ:()=>g,sC:()=>T,AO:()=>p});var r=n(8168);function a(e){return"/"===e.charAt(0)}function o(e,t){for(var n=t,r=n+1,a=e.length;r<a;n+=1,r+=1)e[n]=e[r];e.pop()}const s=function(e,t){void 0===t&&(t="");var n,r=e&&e.split("/")||[],s=t&&t.split("/")||[],i=e&&a(e),l=t&&a(t),c=i||l;if(e&&a(e)?s=r:r.length&&(s.pop(),s=s.concat(r)),!s.length)return"/";if(s.length){var u=s[s.length-1];n="."===u||".."===u||""===u}else n=!1;for(var d=0,p=s.length;p>=0;p--){var g=s[p];"."===g?o(s,p):".."===g?(o(s,p),d++):d&&(o(s,p),d--)}if(!c)for(;d--;d)s.unshift("..");!c||""===s[0]||s[0]&&a(s[0])||s.unshift("");var f=s.join("/");return n&&"/"!==f.substr(-1)&&(f+="/"),f};var i=n(8997);function l(e){return"/"===e.charAt(0)?e:"/"+e}function c(e){return"/"===e.charAt(0)?e.substr(1):e}function u(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function d(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function p(e){var t=e.pathname,n=e.search,r=e.hash,a=t||"/";return n&&"?"!==n&&(a+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(a+="#"===r.charAt(0)?r:"#"+r),a}function g(e,t,n,a){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",a=t.indexOf("#");-1!==a&&(r=t.substr(a),t=t.substr(0,a));var o=t.indexOf("?");return-1!==o&&(n=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),o.state=t):(void 0===(o=(0,r.A)({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(i){throw i instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):i}return n&&(o.key=n),a?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=s(o.pathname,a.pathname)):o.pathname=a.pathname:o.pathname||(o.pathname="/"),o}function f(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,a){if(null!=e){var o="function"==typeof e?e(t,n):e;"string"==typeof o?"function"==typeof r?r(o,a):a(!0):a(!1!==o)}else a(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.forEach((function(e){return e.apply(void 0,n)}))}}}var m=!("undefined"==typeof window||!window.document||!window.document.createElement);function h(e,t){t(window.confirm(e))}var b="popstate",v="hashchange";function y(){try{return window.history.state||{}}catch(e){return{}}}function w(e){void 0===e&&(e={}),m||(0,i.A)(!1);var t,n=window.history,a=(-1===(t=window.navigator.userAgent).indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,o=!(-1===window.navigator.userAgent.indexOf("Trident")),s=e,c=s.forceRefresh,w=void 0!==c&&c,x=s.getUserConfirmation,k=void 0===x?h:x,j=s.keyLength,_=void 0===j?6:j,S=e.basename?d(l(e.basename)):"";function E(e){var t=e||{},n=t.key,r=t.state,a=window.location,o=a.pathname+a.search+a.hash;return S&&(o=u(o,S)),g(o,r,n)}function C(){return Math.random().toString(36).substr(2,_)}var T=f();function A(e){(0,r.A)($,e),$.length=n.length,T.notifyListeners($.location,$.action)}function P(e){(function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")})(e)||N(E(e.state))}function R(){N(E(y()))}var L=!1;function N(e){if(L)L=!1,A();else{T.confirmTransitionTo(e,"POP",k,(function(t){t?A({action:"POP",location:e}):function(e){var t=$.location,n=D.indexOf(t.key);-1===n&&(n=0);var r=D.indexOf(e.key);-1===r&&(r=0);var a=n-r;a&&(L=!0,M(a))}(e)}))}}var O=E(y()),D=[O.key];function I(e){return S+p(e)}function M(e){n.go(e)}var F=0;function B(e){1===(F+=e)&&1===e?(window.addEventListener(b,P),o&&window.addEventListener(v,R)):0===F&&(window.removeEventListener(b,P),o&&window.removeEventListener(v,R))}var z=!1;var $={length:n.length,action:"POP",location:O,createHref:I,push:function(e,t){var r="PUSH",o=g(e,t,C(),$.location);T.confirmTransitionTo(o,r,k,(function(e){if(e){var t=I(o),s=o.key,i=o.state;if(a)if(n.pushState({key:s,state:i},null,t),w)window.location.href=t;else{var l=D.indexOf($.location.key),c=D.slice(0,l+1);c.push(o.key),D=c,A({action:r,location:o})}else window.location.href=t}}))},replace:function(e,t){var r="REPLACE",o=g(e,t,C(),$.location);T.confirmTransitionTo(o,r,k,(function(e){if(e){var t=I(o),s=o.key,i=o.state;if(a)if(n.replaceState({key:s,state:i},null,t),w)window.location.replace(t);else{var l=D.indexOf($.location.key);-1!==l&&(D[l]=o.key),A({action:r,location:o})}else window.location.replace(t)}}))},go:M,goBack:function(){M(-1)},goForward:function(){M(1)},block:function(e){void 0===e&&(e=!1);var t=T.setPrompt(e);return z||(B(1),z=!0),function(){return z&&(z=!1,B(-1)),t()}},listen:function(e){var t=T.appendListener(e);return B(1),function(){B(-1),t()}}};return $}var x="hashchange",k={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!/"+c(e)},decodePath:function(e){return"!"===e.charAt(0)?e.substr(1):e}},noslash:{encodePath:c,decodePath:l},slash:{encodePath:l,decodePath:l}};function j(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function _(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.substring(t+1)}function S(e){window.location.replace(j(window.location.href)+"#"+e)}function E(e){void 0===e&&(e={}),m||(0,i.A)(!1);var t=window.history,n=(window.navigator.userAgent.indexOf("Firefox"),e),a=n.getUserConfirmation,o=void 0===a?h:a,s=n.hashType,c=void 0===s?"slash":s,b=e.basename?d(l(e.basename)):"",v=k[c],y=v.encodePath,w=v.decodePath;function E(){var e=w(_());return b&&(e=u(e,b)),g(e)}var C=f();function T(e){(0,r.A)(z,e),z.length=t.length,C.notifyListeners(z.location,z.action)}var A=!1,P=null;function R(){var e,t,n=_(),r=y(n);if(n!==r)S(r);else{var a=E(),s=z.location;if(!A&&(t=a,(e=s).pathname===t.pathname&&e.search===t.search&&e.hash===t.hash))return;if(P===p(a))return;P=null,function(e){if(A)A=!1,T();else{var t="POP";C.confirmTransitionTo(e,t,o,(function(n){n?T({action:t,location:e}):function(e){var t=z.location,n=D.lastIndexOf(p(t));-1===n&&(n=0);var r=D.lastIndexOf(p(e));-1===r&&(r=0);var a=n-r;a&&(A=!0,I(a))}(e)}))}}(a)}}var L=_(),N=y(L);L!==N&&S(N);var O=E(),D=[p(O)];function I(e){t.go(e)}var M=0;function F(e){1===(M+=e)&&1===e?window.addEventListener(x,R):0===M&&window.removeEventListener(x,R)}var B=!1;var z={length:t.length,action:"POP",location:O,createHref:function(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=j(window.location.href)),n+"#"+y(b+p(e))},push:function(e,t){var n="PUSH",r=g(e,void 0,void 0,z.location);C.confirmTransitionTo(r,n,o,(function(e){if(e){var t=p(r),a=y(b+t);if(_()!==a){P=t,function(e){window.location.hash=e}(a);var o=D.lastIndexOf(p(z.location)),s=D.slice(0,o+1);s.push(t),D=s,T({action:n,location:r})}else T()}}))},replace:function(e,t){var n="REPLACE",r=g(e,void 0,void 0,z.location);C.confirmTransitionTo(r,n,o,(function(e){if(e){var t=p(r),a=y(b+t);_()!==a&&(P=t,S(a));var o=D.indexOf(p(z.location));-1!==o&&(D[o]=t),T({action:n,location:r})}}))},go:I,goBack:function(){I(-1)},goForward:function(){I(1)},block:function(e){void 0===e&&(e=!1);var t=C.setPrompt(e);return B||(F(1),B=!0),function(){return B&&(B=!1,F(-1)),t()}},listen:function(e){var t=C.appendListener(e);return F(1),function(){F(-1),t()}}};return z}function C(e,t,n){return Math.min(Math.max(e,t),n)}function T(e){void 0===e&&(e={});var t=e,n=t.getUserConfirmation,a=t.initialEntries,o=void 0===a?["/"]:a,s=t.initialIndex,i=void 0===s?0:s,l=t.keyLength,c=void 0===l?6:l,u=f();function d(e){(0,r.A)(w,e),w.length=w.entries.length,u.notifyListeners(w.location,w.action)}function m(){return Math.random().toString(36).substr(2,c)}var h=C(i,0,o.length-1),b=o.map((function(e){return g(e,void 0,"string"==typeof e?m():e.key||m())})),v=p;function y(e){var t=C(w.index+e,0,w.entries.length-1),r=w.entries[t];u.confirmTransitionTo(r,"POP",n,(function(e){e?d({action:"POP",location:r,index:t}):d()}))}var w={length:b.length,action:"POP",location:b[h],index:h,entries:b,createHref:v,push:function(e,t){var r="PUSH",a=g(e,t,m(),w.location);u.confirmTransitionTo(a,r,n,(function(e){if(e){var t=w.index+1,n=w.entries.slice(0);n.length>t?n.splice(t,n.length-t,a):n.push(a),d({action:r,location:a,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",a=g(e,t,m(),w.location);u.confirmTransitionTo(a,r,n,(function(e){e&&(w.entries[w.index]=a,d({action:r,location:a}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t<w.entries.length},block:function(e){return void 0===e&&(e=!1),u.setPrompt(e)},listen:function(e){return u.appendListener(e)}};return w}},4146:(e,t,n)=>{"use strict";var r=n(4363),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function l(e){return r.isMemo(e)?s:i[e.$$typeof]||a}i[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[r.Memo]=s;var c=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,g=Object.getPrototypeOf,f=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(f){var a=g(n);a&&a!==f&&e(t,a,r)}var s=u(n);d&&(s=s.concat(d(n)));for(var i=l(t),m=l(n),h=0;h<s.length;++h){var b=s[h];if(!(o[b]||r&&r[b]||m&&m[b]||i&&i[b])){var v=p(n,b);try{c(t,b,v)}catch(y){}}}}return t}},311:e=>{"use strict";e.exports=function(e,t,n,r,a,o,s,i){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,a,o,s,i],u=0;(l=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},4634:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},5300:(e,t,n)=>{"use strict";n.r(t)},8252:(e,t,n)=>{"use strict";n.r(t)},5947:function(e,t,n){var r,a;r=function(){var e,t,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function a(e,t,n){return e<t?t:e>n?n:e}function o(e){return 100*(-1+e)}function s(e,t,n){var a;return(a="translate3d"===r.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+n,a}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=a(e,r.minimum,1),n.status=1===e?null:e;var o=n.render(!t),c=o.querySelector(r.barSelector),u=r.speed,d=r.easing;return o.offsetWidth,i((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),l(c,s(e,u,d)),1===e?(l(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){l(o,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*a(Math.random()*t,.1,.95)),t=a(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var a,s=t.querySelector(r.barSelector),i=e?"-100":o(n.status||0),c=document.querySelector(r.parent);return l(s,{transition:"all 0 linear",transform:"translate3d("+i+"%,0,0)"}),r.showSpinner||(a=t.querySelector(r.spinnerSelector))&&g(a),c!=document.body&&u(c,"nprogress-custom-parent"),c.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&g(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var i=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),l=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,a=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);a--;)if((r=e[a]+o)in n)return r;return t}function a(e){return e=n(e),t[e]||(t[e]=r(e))}function o(e,t,n){t=a(t),e.style[t]=n}return function(e,t){var n,r,a=arguments;if(2==a.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&o(e,n,r);else o(e,a[1],a[2])}}();function c(e,t){return("string"==typeof e?e:p(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=p(e),r=n+t;c(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=p(e);c(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function g(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(a="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=a)},6969:e=>{e.exports&&(e.exports={core:{meta:{path:"components/prism-core.js",option:"mandatory"},core:"Core"},themes:{meta:{path:"themes/{id}.css",link:"index.html?theme={id}",exclusive:!0},prism:{title:"Default",option:"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{title:"Okaidia",owner:"ocodia"},"prism-twilight":{title:"Twilight",owner:"remybach"},"prism-coy":{title:"Coy",owner:"tshedor"},"prism-solarizedlight":{title:"Solarized Light",owner:"hectormatos2011 "},"prism-tomorrow":{title:"Tomorrow Night",owner:"Rosey"}},languages:{meta:{path:"components/prism-{id}",noCSS:!0,examplesPath:"examples/prism-{id}",addCheckAll:!0},markup:{title:"Markup",alias:["html","xml","svg","mathml","ssml","atom","rss"],aliasTitles:{html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",atom:"Atom",rss:"RSS"},option:"default"},css:{title:"CSS",option:"default",modify:"markup"},clike:{title:"C-like",option:"default"},javascript:{title:"JavaScript",require:"clike",modify:"markup",optional:"regex",alias:"js",option:"default"},abap:{title:"ABAP",owner:"dellagustin"},abnf:{title:"ABNF",owner:"RunDevelopment"},actionscript:{title:"ActionScript",require:"javascript",modify:"markup",owner:"Golmote"},ada:{title:"Ada",owner:"Lucretia"},agda:{title:"Agda",owner:"xy-ren"},al:{title:"AL",owner:"RunDevelopment"},antlr4:{title:"ANTLR4",alias:"g4",owner:"RunDevelopment"},apacheconf:{title:"Apache Configuration",owner:"GuiTeK"},apex:{title:"Apex",require:["clike","sql"],owner:"RunDevelopment"},apl:{title:"APL",owner:"ngn"},applescript:{title:"AppleScript",owner:"Golmote"},aql:{title:"AQL",owner:"RunDevelopment"},arduino:{title:"Arduino",require:"cpp",alias:"ino",owner:"dkern"},arff:{title:"ARFF",owner:"Golmote"},armasm:{title:"ARM Assembly",alias:"arm-asm",owner:"RunDevelopment"},arturo:{title:"Arturo",alias:"art",optional:["bash","css","javascript","markup","markdown","sql"],owner:"drkameleon"},asciidoc:{alias:"adoc",title:"AsciiDoc",owner:"Golmote"},aspnet:{title:"ASP.NET (C#)",require:["markup","csharp"],owner:"nauzilus"},asm6502:{title:"6502 Assembly",owner:"kzurawel"},asmatmel:{title:"Atmel AVR Assembly",owner:"cerkit"},autohotkey:{title:"AutoHotkey",owner:"aviaryan"},autoit:{title:"AutoIt",owner:"Golmote"},avisynth:{title:"AviSynth",alias:"avs",owner:"Zinfidel"},"avro-idl":{title:"Avro IDL",alias:"avdl",owner:"RunDevelopment"},awk:{title:"AWK",alias:"gawk",aliasTitles:{gawk:"GAWK"},owner:"RunDevelopment"},bash:{title:"Bash",alias:["sh","shell"],aliasTitles:{sh:"Shell",shell:"Shell"},owner:"zeitgeist87"},basic:{title:"BASIC",owner:"Golmote"},batch:{title:"Batch",owner:"Golmote"},bbcode:{title:"BBcode",alias:"shortcode",aliasTitles:{shortcode:"Shortcode"},owner:"RunDevelopment"},bbj:{title:"BBj",owner:"hyyan"},bicep:{title:"Bicep",owner:"johnnyreilly"},birb:{title:"Birb",require:"clike",owner:"Calamity210"},bison:{title:"Bison",require:"c",owner:"Golmote"},bnf:{title:"BNF",alias:"rbnf",aliasTitles:{rbnf:"RBNF"},owner:"RunDevelopment"},bqn:{title:"BQN",owner:"yewscion"},brainfuck:{title:"Brainfuck",owner:"Golmote"},brightscript:{title:"BrightScript",owner:"RunDevelopment"},bro:{title:"Bro",owner:"wayward710"},bsl:{title:"BSL (1C:Enterprise)",alias:"oscript",aliasTitles:{oscript:"OneScript"},owner:"Diversus23"},c:{title:"C",require:"clike",owner:"zeitgeist87"},csharp:{title:"C#",require:"clike",alias:["cs","dotnet"],owner:"mvalipour"},cpp:{title:"C++",require:"c",owner:"zeitgeist87"},cfscript:{title:"CFScript",require:"clike",alias:"cfc",owner:"mjclemente"},chaiscript:{title:"ChaiScript",require:["clike","cpp"],owner:"RunDevelopment"},cil:{title:"CIL",owner:"sbrl"},cilkc:{title:"Cilk/C",require:"c",alias:"cilk-c",owner:"OpenCilk"},cilkcpp:{title:"Cilk/C++",require:"cpp",alias:["cilk-cpp","cilk"],owner:"OpenCilk"},clojure:{title:"Clojure",owner:"troglotit"},cmake:{title:"CMake",owner:"mjrogozinski"},cobol:{title:"COBOL",owner:"RunDevelopment"},coffeescript:{title:"CoffeeScript",require:"javascript",alias:"coffee",owner:"R-osey"},concurnas:{title:"Concurnas",alias:"conc",owner:"jasontatton"},csp:{title:"Content-Security-Policy",owner:"ScottHelme"},cooklang:{title:"Cooklang",owner:"ahue"},coq:{title:"Coq",owner:"RunDevelopment"},crystal:{title:"Crystal",require:"ruby",owner:"MakeNowJust"},"css-extras":{title:"CSS Extras",require:"css",modify:"css",owner:"milesj"},csv:{title:"CSV",owner:"RunDevelopment"},cue:{title:"CUE",owner:"RunDevelopment"},cypher:{title:"Cypher",owner:"RunDevelopment"},d:{title:"D",require:"clike",owner:"Golmote"},dart:{title:"Dart",require:"clike",owner:"Golmote"},dataweave:{title:"DataWeave",owner:"machaval"},dax:{title:"DAX",owner:"peterbud"},dhall:{title:"Dhall",owner:"RunDevelopment"},diff:{title:"Diff",owner:"uranusjr"},django:{title:"Django/Jinja2",require:"markup-templating",alias:"jinja2",owner:"romanvm"},"dns-zone-file":{title:"DNS zone file",owner:"RunDevelopment",alias:"dns-zone"},docker:{title:"Docker",alias:"dockerfile",owner:"JustinBeckwith"},dot:{title:"DOT (Graphviz)",alias:"gv",optional:"markup",owner:"RunDevelopment"},ebnf:{title:"EBNF",owner:"RunDevelopment"},editorconfig:{title:"EditorConfig",owner:"osipxd"},eiffel:{title:"Eiffel",owner:"Conaclos"},ejs:{title:"EJS",require:["javascript","markup-templating"],owner:"RunDevelopment",alias:"eta",aliasTitles:{eta:"Eta"}},elixir:{title:"Elixir",owner:"Golmote"},elm:{title:"Elm",owner:"zwilias"},etlua:{title:"Embedded Lua templating",require:["lua","markup-templating"],owner:"RunDevelopment"},erb:{title:"ERB",require:["ruby","markup-templating"],owner:"Golmote"},erlang:{title:"Erlang",owner:"Golmote"},"excel-formula":{title:"Excel Formula",alias:["xlsx","xls"],owner:"RunDevelopment"},fsharp:{title:"F#",require:"clike",owner:"simonreynolds7"},factor:{title:"Factor",owner:"catb0t"},false:{title:"False",owner:"edukisto"},"firestore-security-rules":{title:"Firestore security rules",require:"clike",owner:"RunDevelopment"},flow:{title:"Flow",require:"javascript",owner:"Golmote"},fortran:{title:"Fortran",owner:"Golmote"},ftl:{title:"FreeMarker Template Language",require:"markup-templating",owner:"RunDevelopment"},gml:{title:"GameMaker Language",alias:"gamemakerlanguage",require:"clike",owner:"LiarOnce"},gap:{title:"GAP (CAS)",owner:"RunDevelopment"},gcode:{title:"G-code",owner:"RunDevelopment"},gdscript:{title:"GDScript",owner:"RunDevelopment"},gedcom:{title:"GEDCOM",owner:"Golmote"},gettext:{title:"gettext",alias:"po",owner:"RunDevelopment"},gherkin:{title:"Gherkin",owner:"hason"},git:{title:"Git",owner:"lgiraudel"},glsl:{title:"GLSL",require:"c",owner:"Golmote"},gn:{title:"GN",alias:"gni",owner:"RunDevelopment"},"linker-script":{title:"GNU Linker Script",alias:"ld",owner:"RunDevelopment"},go:{title:"Go",require:"clike",owner:"arnehormann"},"go-module":{title:"Go module",alias:"go-mod",owner:"RunDevelopment"},gradle:{title:"Gradle",require:"clike",owner:"zeabdelkhalek-badido18"},graphql:{title:"GraphQL",optional:"markdown",owner:"Golmote"},groovy:{title:"Groovy",require:"clike",owner:"robfletcher"},haml:{title:"Haml",require:"ruby",optional:["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],owner:"Golmote"},handlebars:{title:"Handlebars",require:"markup-templating",alias:["hbs","mustache"],aliasTitles:{mustache:"Mustache"},owner:"Golmote"},haskell:{title:"Haskell",alias:"hs",owner:"bholst"},haxe:{title:"Haxe",require:"clike",optional:"regex",owner:"Golmote"},hcl:{title:"HCL",owner:"outsideris"},hlsl:{title:"HLSL",require:"c",owner:"RunDevelopment"},hoon:{title:"Hoon",owner:"matildepark"},http:{title:"HTTP",optional:["csp","css","hpkp","hsts","javascript","json","markup","uri"],owner:"danielgtaylor"},hpkp:{title:"HTTP Public-Key-Pins",owner:"ScottHelme"},hsts:{title:"HTTP Strict-Transport-Security",owner:"ScottHelme"},ichigojam:{title:"IchigoJam",owner:"BlueCocoa"},icon:{title:"Icon",owner:"Golmote"},"icu-message-format":{title:"ICU Message Format",owner:"RunDevelopment"},idris:{title:"Idris",alias:"idr",owner:"KeenS",require:"haskell"},ignore:{title:".ignore",owner:"osipxd",alias:["gitignore","hgignore","npmignore"],aliasTitles:{gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore"}},inform7:{title:"Inform 7",owner:"Golmote"},ini:{title:"Ini",owner:"aviaryan"},io:{title:"Io",owner:"AlesTsurko"},j:{title:"J",owner:"Golmote"},java:{title:"Java",require:"clike",owner:"sherblot"},javadoc:{title:"JavaDoc",require:["markup","java","javadoclike"],modify:"java",optional:"scala",owner:"RunDevelopment"},javadoclike:{title:"JavaDoc-like",modify:["java","javascript","php"],owner:"RunDevelopment"},javastacktrace:{title:"Java stack trace",owner:"RunDevelopment"},jexl:{title:"Jexl",owner:"czosel"},jolie:{title:"Jolie",require:"clike",owner:"thesave"},jq:{title:"JQ",owner:"RunDevelopment"},jsdoc:{title:"JSDoc",require:["javascript","javadoclike","typescript"],modify:"javascript",optional:["actionscript","coffeescript"],owner:"RunDevelopment"},"js-extras":{title:"JS Extras",require:"javascript",modify:"javascript",optional:["actionscript","coffeescript","flow","n4js","typescript"],owner:"RunDevelopment"},json:{title:"JSON",alias:"webmanifest",aliasTitles:{webmanifest:"Web App Manifest"},owner:"CupOfTea696"},json5:{title:"JSON5",require:"json",owner:"RunDevelopment"},jsonp:{title:"JSONP",require:"json",owner:"RunDevelopment"},jsstacktrace:{title:"JS stack trace",owner:"sbrl"},"js-templates":{title:"JS Templates",require:"javascript",modify:"javascript",optional:["css","css-extras","graphql","markdown","markup","sql"],owner:"RunDevelopment"},julia:{title:"Julia",owner:"cdagnino"},keepalived:{title:"Keepalived Configure",owner:"dev-itsheng"},keyman:{title:"Keyman",owner:"mcdurdin"},kotlin:{title:"Kotlin",alias:["kt","kts"],aliasTitles:{kts:"Kotlin Script"},require:"clike",owner:"Golmote"},kumir:{title:"KuMir (\u041a\u0443\u041c\u0438\u0440)",alias:"kum",owner:"edukisto"},kusto:{title:"Kusto",owner:"RunDevelopment"},latex:{title:"LaTeX",alias:["tex","context"],aliasTitles:{tex:"TeX",context:"ConTeXt"},owner:"japborst"},latte:{title:"Latte",require:["clike","markup-templating","php"],owner:"nette"},less:{title:"Less",require:"css",optional:"css-extras",owner:"Golmote"},lilypond:{title:"LilyPond",require:"scheme",alias:"ly",owner:"RunDevelopment"},liquid:{title:"Liquid",require:"markup-templating",owner:"cinhtau"},lisp:{title:"Lisp",alias:["emacs","elisp","emacs-lisp"],owner:"JuanCaicedo"},livescript:{title:"LiveScript",owner:"Golmote"},llvm:{title:"LLVM IR",owner:"porglezomp"},log:{title:"Log file",optional:"javastacktrace",owner:"RunDevelopment"},lolcode:{title:"LOLCODE",owner:"Golmote"},lua:{title:"Lua",owner:"Golmote"},magma:{title:"Magma (CAS)",owner:"RunDevelopment"},makefile:{title:"Makefile",owner:"Golmote"},markdown:{title:"Markdown",require:"markup",optional:"yaml",alias:"md",owner:"Golmote"},"markup-templating":{title:"Markup templating",require:"markup",owner:"Golmote"},mata:{title:"Mata",owner:"RunDevelopment"},matlab:{title:"MATLAB",owner:"Golmote"},maxscript:{title:"MAXScript",owner:"RunDevelopment"},mel:{title:"MEL",owner:"Golmote"},mermaid:{title:"Mermaid",owner:"RunDevelopment"},metafont:{title:"METAFONT",owner:"LaeriExNihilo"},mizar:{title:"Mizar",owner:"Golmote"},mongodb:{title:"MongoDB",owner:"airs0urce",require:"javascript"},monkey:{title:"Monkey",owner:"Golmote"},moonscript:{title:"MoonScript",alias:"moon",owner:"RunDevelopment"},n1ql:{title:"N1QL",owner:"TMWilds"},n4js:{title:"N4JS",require:"javascript",optional:"jsdoc",alias:"n4jsd",owner:"bsmith-n4"},"nand2tetris-hdl":{title:"Nand To Tetris HDL",owner:"stephanmax"},naniscript:{title:"Naninovel Script",owner:"Elringus",alias:"nani"},nasm:{title:"NASM",owner:"rbmj"},neon:{title:"NEON",owner:"nette"},nevod:{title:"Nevod",owner:"nezaboodka"},nginx:{title:"nginx",owner:"volado"},nim:{title:"Nim",owner:"Golmote"},nix:{title:"Nix",owner:"Golmote"},nsis:{title:"NSIS",owner:"idleberg"},objectivec:{title:"Objective-C",require:"c",alias:"objc",owner:"uranusjr"},ocaml:{title:"OCaml",owner:"Golmote"},odin:{title:"Odin",owner:"edukisto"},opencl:{title:"OpenCL",require:"c",modify:["c","cpp"],owner:"Milania1"},openqasm:{title:"OpenQasm",alias:"qasm",owner:"RunDevelopment"},oz:{title:"Oz",owner:"Golmote"},parigp:{title:"PARI/GP",owner:"Golmote"},parser:{title:"Parser",require:"markup",owner:"Golmote"},pascal:{title:"Pascal",alias:"objectpascal",aliasTitles:{objectpascal:"Object Pascal"},owner:"Golmote"},pascaligo:{title:"Pascaligo",owner:"DefinitelyNotAGoat"},psl:{title:"PATROL Scripting Language",owner:"bertysentry"},pcaxis:{title:"PC-Axis",alias:"px",owner:"RunDevelopment"},peoplecode:{title:"PeopleCode",alias:"pcode",owner:"RunDevelopment"},perl:{title:"Perl",owner:"Golmote"},php:{title:"PHP",require:"markup-templating",owner:"milesj"},phpdoc:{title:"PHPDoc",require:["php","javadoclike"],modify:"php",owner:"RunDevelopment"},"php-extras":{title:"PHP Extras",require:"php",modify:"php",owner:"milesj"},"plant-uml":{title:"PlantUML",alias:"plantuml",owner:"RunDevelopment"},plsql:{title:"PL/SQL",require:"sql",owner:"Golmote"},powerquery:{title:"PowerQuery",alias:["pq","mscript"],owner:"peterbud"},powershell:{title:"PowerShell",owner:"nauzilus"},processing:{title:"Processing",require:"clike",owner:"Golmote"},prolog:{title:"Prolog",owner:"Golmote"},promql:{title:"PromQL",owner:"arendjr"},properties:{title:".properties",owner:"Golmote"},protobuf:{title:"Protocol Buffers",require:"clike",owner:"just-boris"},pug:{title:"Pug",require:["markup","javascript"],optional:["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],owner:"Golmote"},puppet:{title:"Puppet",owner:"Golmote"},pure:{title:"Pure",optional:["c","cpp","fortran"],owner:"Golmote"},purebasic:{title:"PureBasic",require:"clike",alias:"pbfasm",owner:"HeX0R101"},purescript:{title:"PureScript",require:"haskell",alias:"purs",owner:"sriharshachilakapati"},python:{title:"Python",alias:"py",owner:"multipetros"},qsharp:{title:"Q#",require:"clike",alias:"qs",owner:"fedonman"},q:{title:"Q (kdb+ database)",owner:"Golmote"},qml:{title:"QML",require:"javascript",owner:"RunDevelopment"},qore:{title:"Qore",require:"clike",owner:"temnroegg"},r:{title:"R",owner:"Golmote"},racket:{title:"Racket",require:"scheme",alias:"rkt",owner:"RunDevelopment"},cshtml:{title:"Razor C#",alias:"razor",require:["markup","csharp"],optional:["css","css-extras","javascript","js-extras"],owner:"RunDevelopment"},jsx:{title:"React JSX",require:["markup","javascript"],optional:["jsdoc","js-extras","js-templates"],owner:"vkbansal"},tsx:{title:"React TSX",require:["jsx","typescript"]},reason:{title:"Reason",require:"clike",owner:"Golmote"},regex:{title:"Regex",owner:"RunDevelopment"},rego:{title:"Rego",owner:"JordanSh"},renpy:{title:"Ren'py",alias:"rpy",owner:"HyuchiaDiego"},rescript:{title:"ReScript",alias:"res",owner:"vmarcosp"},rest:{title:"reST (reStructuredText)",owner:"Golmote"},rip:{title:"Rip",owner:"ravinggenius"},roboconf:{title:"Roboconf",owner:"Golmote"},robotframework:{title:"Robot Framework",alias:"robot",owner:"RunDevelopment"},ruby:{title:"Ruby",require:"clike",alias:"rb",owner:"samflores"},rust:{title:"Rust",owner:"Golmote"},sas:{title:"SAS",optional:["groovy","lua","sql"],owner:"Golmote"},sass:{title:"Sass (Sass)",require:"css",optional:"css-extras",owner:"Golmote"},scss:{title:"Sass (SCSS)",require:"css",optional:"css-extras",owner:"MoOx"},scala:{title:"Scala",require:"java",owner:"jozic"},scheme:{title:"Scheme",owner:"bacchus123"},"shell-session":{title:"Shell session",require:"bash",alias:["sh-session","shellsession"],owner:"RunDevelopment"},smali:{title:"Smali",owner:"RunDevelopment"},smalltalk:{title:"Smalltalk",owner:"Golmote"},smarty:{title:"Smarty",require:"markup-templating",optional:"php",owner:"Golmote"},sml:{title:"SML",alias:"smlnj",aliasTitles:{smlnj:"SML/NJ"},owner:"RunDevelopment"},solidity:{title:"Solidity (Ethereum)",alias:"sol",require:"clike",owner:"glachaud"},"solution-file":{title:"Solution file",alias:"sln",owner:"RunDevelopment"},soy:{title:"Soy (Closure Template)",require:"markup-templating",owner:"Golmote"},sparql:{title:"SPARQL",require:"turtle",owner:"Triply-Dev",alias:"rq"},"splunk-spl":{title:"Splunk SPL",owner:"RunDevelopment"},sqf:{title:"SQF: Status Quo Function (Arma 3)",require:"clike",owner:"RunDevelopment"},sql:{title:"SQL",owner:"multipetros"},squirrel:{title:"Squirrel",require:"clike",owner:"RunDevelopment"},stan:{title:"Stan",owner:"RunDevelopment"},stata:{title:"Stata Ado",require:["mata","java","python"],owner:"RunDevelopment"},iecst:{title:"Structured Text (IEC 61131-3)",owner:"serhioromano"},stylus:{title:"Stylus",owner:"vkbansal"},supercollider:{title:"SuperCollider",alias:"sclang",owner:"RunDevelopment"},swift:{title:"Swift",owner:"chrischares"},systemd:{title:"Systemd configuration file",owner:"RunDevelopment"},"t4-templating":{title:"T4 templating",owner:"RunDevelopment"},"t4-cs":{title:"T4 Text Templates (C#)",require:["t4-templating","csharp"],alias:"t4",owner:"RunDevelopment"},"t4-vb":{title:"T4 Text Templates (VB)",require:["t4-templating","vbnet"],owner:"RunDevelopment"},tap:{title:"TAP",owner:"isaacs",require:"yaml"},tcl:{title:"Tcl",owner:"PeterChaplin"},tt2:{title:"Template Toolkit 2",require:["clike","markup-templating"],owner:"gflohr"},textile:{title:"Textile",require:"markup",optional:"css",owner:"Golmote"},toml:{title:"TOML",owner:"RunDevelopment"},tremor:{title:"Tremor",alias:["trickle","troy"],owner:"darach",aliasTitles:{trickle:"trickle",troy:"troy"}},turtle:{title:"Turtle",alias:"trig",aliasTitles:{trig:"TriG"},owner:"jakubklimek"},twig:{title:"Twig",require:"markup-templating",owner:"brandonkelly"},typescript:{title:"TypeScript",require:"javascript",optional:"js-templates",alias:"ts",owner:"vkbansal"},typoscript:{title:"TypoScript",alias:"tsconfig",aliasTitles:{tsconfig:"TSConfig"},owner:"dkern"},unrealscript:{title:"UnrealScript",alias:["uscript","uc"],owner:"RunDevelopment"},uorazor:{title:"UO Razor Script",owner:"jaseowns"},uri:{title:"URI",alias:"url",aliasTitles:{url:"URL"},owner:"RunDevelopment"},v:{title:"V",require:"clike",owner:"taggon"},vala:{title:"Vala",require:"clike",optional:"regex",owner:"TemplarVolk"},vbnet:{title:"VB.Net",require:"basic",owner:"Bigsby"},velocity:{title:"Velocity",require:"markup",owner:"Golmote"},verilog:{title:"Verilog",owner:"a-rey"},vhdl:{title:"VHDL",owner:"a-rey"},vim:{title:"vim",owner:"westonganger"},"visual-basic":{title:"Visual Basic",alias:["vb","vba"],aliasTitles:{vba:"VBA"},owner:"Golmote"},warpscript:{title:"WarpScript",owner:"RunDevelopment"},wasm:{title:"WebAssembly",owner:"Golmote"},"web-idl":{title:"Web IDL",alias:"webidl",owner:"RunDevelopment"},wgsl:{title:"WGSL",owner:"Dr4gonthree"},wiki:{title:"Wiki markup",require:"markup",owner:"Golmote"},wolfram:{title:"Wolfram language",alias:["mathematica","nb","wl"],aliasTitles:{mathematica:"Mathematica",nb:"Mathematica Notebook"},owner:"msollami"},wren:{title:"Wren",owner:"clsource"},xeora:{title:"Xeora",require:"markup",alias:"xeoracube",aliasTitles:{xeoracube:"XeoraCube"},owner:"freakmaxi"},"xml-doc":{title:"XML doc (.net)",require:"markup",modify:["csharp","fsharp","vbnet"],owner:"RunDevelopment"},xojo:{title:"Xojo (REALbasic)",owner:"Golmote"},xquery:{title:"XQuery",require:"markup",owner:"Golmote"},yaml:{title:"YAML",alias:"yml",owner:"hason"},yang:{title:"YANG",owner:"RunDevelopment"},zig:{title:"Zig",owner:"RunDevelopment"}},plugins:{meta:{path:"plugins/{id}/prism-{id}",link:"plugins/{id}/"},"line-highlight":{title:"Line Highlight",description:"Highlights specific lines and/or line ranges."},"line-numbers":{title:"Line Numbers",description:"Line number at the beginning of code lines.",owner:"kuba-kubula"},"show-invisibles":{title:"Show Invisibles",description:"Show hidden characters such as tabs and line breaks.",optional:["autolinker","data-uri-highlight"]},autolinker:{title:"Autolinker",description:"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},wpd:{title:"WebPlatform Docs",description:'Makes tokens link to <a href="https://webplatform.github.io/docs/">WebPlatform.org documentation</a>. The links open in a new tab.'},"custom-class":{title:"Custom Class",description:"This plugin allows you to prefix Prism's default classes (<code>.comment</code> can become <code>.namespace--comment</code>) or replace them with your defined ones (like <code>.editor__comment</code>). You can even add new classes.",owner:"dvkndn",noCSS:!0},"file-highlight":{title:"File Highlight",description:"Fetch external files and highlight them with Prism. Used on the Prism website itself.",noCSS:!0},"show-language":{title:"Show Language",description:"Display the highlighted language in code blocks (inline code does not show the label).",owner:"nauzilus",noCSS:!0,require:"toolbar"},"jsonp-highlight":{title:"JSONP Highlight",description:"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).",noCSS:!0,owner:"nauzilus"},"highlight-keywords":{title:"Highlight Keywords",description:"Adds special CSS classes for each keyword for fine-grained highlighting.",owner:"vkbansal",noCSS:!0},"remove-initial-line-feed":{title:"Remove initial line feed",description:"Removes the initial line feed in code blocks.",owner:"Golmote",noCSS:!0},"inline-color":{title:"Inline color",description:"Adds a small inline preview for colors in style sheets.",require:"css-extras",owner:"RunDevelopment"},previewers:{title:"Previewers",description:"Previewers for angles, colors, gradients, easing and time.",require:"css-extras",owner:"Golmote"},autoloader:{title:"Autoloader",description:"Automatically loads the needed languages to highlight the code blocks.",owner:"Golmote",noCSS:!0},"keep-markup":{title:"Keep Markup",description:"Prevents custom markup from being dropped out during highlighting.",owner:"Golmote",optional:"normalize-whitespace",noCSS:!0},"command-line":{title:"Command Line",description:"Display a command line with a prompt and, optionally, the output/response from the commands.",owner:"chriswells0"},"unescaped-markup":{title:"Unescaped Markup",description:"Write markup without having to escape anything."},"normalize-whitespace":{title:"Normalize Whitespace",description:"Supports multiple operations to normalize whitespace in code blocks.",owner:"zeitgeist87",optional:"unescaped-markup",noCSS:!0},"data-uri-highlight":{title:"Data-URI Highlight",description:"Highlights data-URI contents.",owner:"Golmote",noCSS:!0},toolbar:{title:"Toolbar",description:"Attach a toolbar for plugins to easily register buttons on the top of a code block.",owner:"mAAdhaTTah"},"copy-to-clipboard":{title:"Copy to Clipboard Button",description:"Add a button that copies the code block to the clipboard when clicked.",owner:"mAAdhaTTah",require:"toolbar",noCSS:!0},"download-button":{title:"Download Button",description:"A button in the toolbar of a code block adding a convenient way to download a code file.",owner:"Golmote",require:"toolbar",noCSS:!0},"match-braces":{title:"Match braces",description:"Highlights matching braces.",owner:"RunDevelopment"},"diff-highlight":{title:"Diff Highlight",description:"Highlights the code inside diff blocks.",owner:"RunDevelopment",require:"diff"},"filter-highlight-all":{title:"Filter highlightAll",description:"Filters the elements the <code>highlightAll</code> and <code>highlightAllUnder</code> methods actually highlight.",owner:"RunDevelopment",noCSS:!0},treeview:{title:"Treeview",description:"A language with special styles to highlight file system tree structures.",owner:"Golmote"}}})},8722:(e,t,n)=>{const r=n(6969),a=n(8380),o=new Set;function s(e){void 0===e?e=Object.keys(r.languages).filter((e=>"meta"!=e)):Array.isArray(e)||(e=[e]);const t=[...o,...Object.keys(Prism.languages)];a(r,e,t).load((e=>{if(!(e in r.languages))return void(s.silent||console.warn("Language does not exist: "+e));const t="./prism-"+e;delete n.c[n(3157).resolve(t)],delete Prism.languages[e],n(3157)(t),o.add(e)}))}s.silent=!1,e.exports=s},9700:()=>{!function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,a,o){if(n.language===r){var s=n.tokenStack=[];n.code=n.code.replace(a,(function(e){if("function"==typeof o&&!o(e))return e;for(var a,i=s.length;-1!==n.code.indexOf(a=t(r,i));)++i;return s[i]=e,a})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var a=0,o=Object.keys(n.tokenStack);!function s(i){for(var l=0;l<i.length&&!(a>=o.length);l++){var c=i[l];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[a],d=n.tokenStack[u],p="string"==typeof c?c:c.content,g=t(r,u),f=p.indexOf(g);if(f>-1){++a;var m=p.substring(0,f),h=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),b=p.substring(f+g.length),v=[];m&&v.push.apply(v,s([m])),v.push(h),b&&v.push.apply(v,s([b])),"string"==typeof c?i.splice.apply(i,[l,1].concat(v)):c.content=v}}else c.content&&s(c.content)}return i}(n.tokens)}}}})}(Prism)},8692:(e,t,n)=>{var r={"./":8722};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=8692},3157:(e,t,n)=>{var r={"./":8722};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=3157},8380:e=>{"use strict";var t=function(){var e=function(){};function t(e,t){Array.isArray(e)?e.forEach(t):null!=e&&t(e,0)}function n(e){for(var t={},n=0,r=e.length;n<r;n++)t[e[n]]=!0;return t}function r(e){var n={},r=[];function a(r,o){if(!(r in n)){o.push(r);var s=o.indexOf(r);if(s<o.length-1)throw new Error("Circular dependency: "+o.slice(s).join(" -> "));var i={},l=e[r];if(l){function c(t){if(!(t in e))throw new Error(r+" depends on an unknown component "+t);if(!(t in i))for(var s in a(t,o),i[t]=!0,n[t])i[s]=!0}t(l.require,c),t(l.optional,c),t(l.modify,c)}n[r]=i,o.pop()}}return function(e){var t=n[e];return t||(a(e,r),t=n[e]),t}}function a(e){for(var t in e)return!0;return!1}return function(o,s,i){var l=function(e){var t={};for(var n in e){var r=e[n];for(var a in r)if("meta"!=a){var o=r[a];t[a]="string"==typeof o?{title:o}:o}}return t}(o),c=function(e){var n;return function(r){if(r in e)return r;if(!n)for(var a in n={},e){var o=e[a];t(o&&o.alias,(function(t){if(t in n)throw new Error(t+" cannot be alias for both "+a+" and "+n[t]);if(t in e)throw new Error(t+" cannot be alias of "+a+" because it is a component.");n[t]=a}))}return n[r]||r}}(l);s=s.map(c),i=(i||[]).map(c);var u=n(s),d=n(i);s.forEach((function e(n){var r=l[n];t(r&&r.require,(function(t){t in d||(u[t]=!0,e(t))}))}));for(var p,g=r(l),f=u;a(f);){for(var m in p={},f){var h=l[m];t(h&&h.modify,(function(e){e in d&&(p[e]=!0)}))}for(var b in d)if(!(b in u))for(var v in g(b))if(v in u){p[b]=!0;break}for(var y in f=p)u[y]=!0}var w={getIds:function(){var e=[];return w.load((function(t){e.push(t)})),e},load:function(t,n){return function(t,n,r,a){var o=a?a.series:void 0,s=a?a.parallel:e,i={},l={};function c(e){if(e in i)return i[e];l[e]=!0;var a,u=[];for(var d in t(e))d in n&&u.push(d);if(0===u.length)a=r(e);else{var p=s(u.map((function(e){var t=c(e);return delete l[e],t})));o?a=o(p,(function(){return r(e)})):r(e)}return i[e]=a}for(var u in n)c(u);var d=[];for(var p in l)d.push(i[p]);return s(d)}(g,u,t,n)}};return w}}();e.exports=t},2694:(e,t,n)=>{"use strict";var r=n(6925);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,s){if(s!==r){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:a};return n.PropTypes=n,n}},5556:(e,t,n)=>{e.exports=n(2694)()},6925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},2551:(e,t,n)=>{"use strict";var r=n(6540),a=n(9982);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function l(e,t){c(e,t),c(e+"Capture",t)}function c(e,t){for(i[e]=t,e=0;e<t.length;e++)s.add(t[e])}var u=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),d=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,g={},f={};function m(e,t,n,r,a,o,s){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var h={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){h[e]=new m(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];h[t]=new m(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){h[e]=new m(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){h[e]=new m(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){h[e]=new m(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){h[e]=new m(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){h[e]=new m(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){h[e]=new m(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){h[e]=new m(e,5,!1,e.toLowerCase(),null,!1,!1)}));var b=/[\-:]([a-z])/g;function v(e){return e[1].toUpperCase()}function y(e,t,n,r){var a=h.hasOwnProperty(t)?h[t]:null;(null!==a?0!==a.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,a,r)&&(n=null),r||null===a?function(e){return!!d.call(f,e)||!d.call(g,e)&&(p.test(e)?f[e]=!0:(g[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=null===n?3!==a.type&&"":n:(t=a.attributeName,r=a.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(a=a.type)||4===a&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(b,v);h[t]=new m(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(b,v);h[t]=new m(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(b,v);h[t]=new m(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){h[e]=new m(e,1,!1,e.toLowerCase(),null,!1,!1)})),h.xlinkHref=new m("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){h[e]=new m(e,1,!1,e.toLowerCase(),null,!0,!0)}));var w=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,x=Symbol.for("react.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),C=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),L=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var N=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var O=Symbol.iterator;function D(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=O&&e[O]||e["@@iterator"])?e:null}var I,M=Object.assign;function F(e){if(void 0===I)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);I=t&&t[1]||""}return"\n"+I+e}var B=!1;function z(e,t){if(!e||B)return"";B=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&"string"==typeof c.stack){for(var a=c.stack.split("\n"),o=r.stack.split("\n"),s=a.length-1,i=o.length-1;1<=s&&0<=i&&a[s]!==o[i];)i--;for(;1<=s&&0<=i;s--,i--)if(a[s]!==o[i]){if(1!==s||1!==i)do{if(s--,0>--i||a[s]!==o[i]){var l="\n"+a[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=s&&0<=i);break}}}finally{B=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?F(e):""}function $(e){switch(e.tag){case 5:return F(e.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return e=z(e.type,!1);case 11:return e=z(e.type.render,!1);case 1:return e=z(e.type,!0);default:return""}}function U(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case j:return"Fragment";case k:return"Portal";case S:return"Profiler";case _:return"StrictMode";case A:return"Suspense";case P:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case C:return(e.displayName||"Context")+".Consumer";case E:return(e._context.displayName||"Context")+".Provider";case T:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case R:return null!==(t=e.displayName||null)?t:U(e.type)||"Memo";case L:t=e._payload,e=e._init;try{return U(e(t))}catch(n){}}return null}function q(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U(t);case 8:return t===_?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function H(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function G(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function W(e){e._valueTracker||(e._valueTracker=function(e){var t=G(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function V(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=G(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function K(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Q(e,t){var n=t.checked;return M({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function Y(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=H(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Z(e,t){null!=(t=t.checked)&&y(e,"checked",t,!1)}function X(e,t){Z(e,t);var n=H(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,n):t.hasOwnProperty("defaultValue")&&ee(e,t.type,H(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function J(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ee(e,t,n){"number"===t&&K(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var te=Array.isArray;function ne(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+H(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function re(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(o(91));return M({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ae(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(o(92));if(te(n)){if(1<n.length)throw Error(o(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:H(n)}}function oe(e,t){var n=H(t.value),r=H(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function se(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function ie(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function le(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?ie(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var ce,ue,de=(ue=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((ce=ce||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ce.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return ue(e,t)}))}:ue);function pe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var ge={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fe=["Webkit","ms","Moz","O"];function me(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||ge.hasOwnProperty(e)&&ge[e]?(""+t).trim():t+"px"}function he(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),a=me(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}Object.keys(ge).forEach((function(e){fe.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ge[t]=ge[e]}))}));var be=M({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ve(e,t){if(t){if(be[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(o(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(o(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(o(62))}}function ye(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var we=null;function xe(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var ke=null,je=null,_e=null;function Se(e){if(e=ya(e)){if("function"!=typeof ke)throw Error(o(280));var t=e.stateNode;t&&(t=xa(t),ke(e.stateNode,e.type,t))}}function Ee(e){je?_e?_e.push(e):_e=[e]:je=e}function Ce(){if(je){var e=je,t=_e;if(_e=je=null,Se(e),t)for(e=0;e<t.length;e++)Se(t[e])}}function Te(e,t){return e(t)}function Ae(){}var Pe=!1;function Re(e,t,n){if(Pe)return e(t,n);Pe=!0;try{return Te(e,t,n)}finally{Pe=!1,(null!==je||null!==_e)&&(Ae(),Ce())}}function Le(e,t){var n=e.stateNode;if(null===n)return null;var r=xa(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(o(231,t,typeof n));return n}var Ne=!1;if(u)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){Ne=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch(ue){Ne=!1}function De(e,t,n,r,a,o,s,i,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var Ie=!1,Me=null,Fe=!1,Be=null,ze={onError:function(e){Ie=!0,Me=e}};function $e(e,t,n,r,a,o,s,i,l){Ie=!1,Me=null,De.apply(ze,arguments)}function Ue(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function qe(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function He(e){if(Ue(e)!==e)throw Error(o(188))}function Ge(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ue(e)))throw Error(o(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(null===a)break;var s=a.alternate;if(null===s){if(null!==(r=a.return)){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return He(a),e;if(s===r)return He(a),t;s=s.sibling}throw Error(o(188))}if(n.return!==r.return)n=a,r=s;else{for(var i=!1,l=a.child;l;){if(l===n){i=!0,n=a,r=s;break}if(l===r){i=!0,r=a,n=s;break}l=l.sibling}if(!i){for(l=s.child;l;){if(l===n){i=!0,n=s,r=a;break}if(l===r){i=!0,r=s,n=a;break}l=l.sibling}if(!i)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(3!==n.tag)throw Error(o(188));return n.stateNode.current===n?e:t}(e))?We(e):null}function We(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=We(e);if(null!==t)return t;e=e.sibling}return null}var Ve=a.unstable_scheduleCallback,Ke=a.unstable_cancelCallback,Qe=a.unstable_shouldYield,Ye=a.unstable_requestPaint,Ze=a.unstable_now,Xe=a.unstable_getCurrentPriorityLevel,Je=a.unstable_ImmediatePriority,et=a.unstable_UserBlockingPriority,tt=a.unstable_NormalPriority,nt=a.unstable_LowPriority,rt=a.unstable_IdlePriority,at=null,ot=null;var st=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(it(e)/lt|0)|0},it=Math.log,lt=Math.LN2;var ct=64,ut=4194304;function dt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function pt(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,a=e.suspendedLanes,o=e.pingedLanes,s=268435455&n;if(0!==s){var i=s&~a;0!==i?r=dt(i):0!==(o&=s)&&(r=dt(o))}else 0!==(s=n&~a)?r=dt(s):0!==o&&(r=dt(o));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&a)&&((a=r&-r)>=(o=t&-t)||16===a&&0!=(4194240&o)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)a=1<<(n=31-st(t)),r|=e[n],t&=~a;return r}function gt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function ft(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function mt(){var e=ct;return 0==(4194240&(ct<<=1))&&(ct=64),e}function ht(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function bt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-st(t)]=n}function vt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-st(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var yt=0;function wt(e){return 1<(e&=-e)?4<e?0!=(268435455&e)?16:536870912:4:1}var xt,kt,jt,_t,St,Et=!1,Ct=[],Tt=null,At=null,Pt=null,Rt=new Map,Lt=new Map,Nt=[],Ot="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Dt(e,t){switch(e){case"focusin":case"focusout":Tt=null;break;case"dragenter":case"dragleave":At=null;break;case"mouseover":case"mouseout":Pt=null;break;case"pointerover":case"pointerout":Rt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lt.delete(t.pointerId)}}function It(e,t,n,r,a,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},null!==t&&(null!==(t=ya(t))&&kt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function Mt(e){var t=va(e.target);if(null!==t){var n=Ue(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=qe(n)))return e.blockedOn=t,void St(e.priority,(function(){jt(n)}))}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Ft(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Qt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=ya(n))&&kt(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);we=r,n.target.dispatchEvent(r),we=null,t.shift()}return!0}function Bt(e,t,n){Ft(e)&&n.delete(t)}function zt(){Et=!1,null!==Tt&&Ft(Tt)&&(Tt=null),null!==At&&Ft(At)&&(At=null),null!==Pt&&Ft(Pt)&&(Pt=null),Rt.forEach(Bt),Lt.forEach(Bt)}function $t(e,t){e.blockedOn===t&&(e.blockedOn=null,Et||(Et=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,zt)))}function Ut(e){function t(t){return $t(t,e)}if(0<Ct.length){$t(Ct[0],e);for(var n=1;n<Ct.length;n++){var r=Ct[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==Tt&&$t(Tt,e),null!==At&&$t(At,e),null!==Pt&&$t(Pt,e),Rt.forEach(t),Lt.forEach(t),n=0;n<Nt.length;n++)(r=Nt[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Nt.length&&null===(n=Nt[0]).blockedOn;)Mt(n),null===n.blockedOn&&Nt.shift()}var qt=w.ReactCurrentBatchConfig,Ht=!0;function Gt(e,t,n,r){var a=yt,o=qt.transition;qt.transition=null;try{yt=1,Vt(e,t,n,r)}finally{yt=a,qt.transition=o}}function Wt(e,t,n,r){var a=yt,o=qt.transition;qt.transition=null;try{yt=4,Vt(e,t,n,r)}finally{yt=a,qt.transition=o}}function Vt(e,t,n,r){if(Ht){var a=Qt(e,t,n,r);if(null===a)Hr(e,t,r,Kt,n),Dt(e,r);else if(function(e,t,n,r,a){switch(t){case"focusin":return Tt=It(Tt,e,t,n,r,a),!0;case"dragenter":return At=It(At,e,t,n,r,a),!0;case"mouseover":return Pt=It(Pt,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return Rt.set(o,It(Rt.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,Lt.set(o,It(Lt.get(o)||null,e,t,n,r,a)),!0}return!1}(a,e,t,n,r))r.stopPropagation();else if(Dt(e,r),4&t&&-1<Ot.indexOf(e)){for(;null!==a;){var o=ya(a);if(null!==o&&xt(o),null===(o=Qt(e,t,n,r))&&Hr(e,t,r,Kt,n),o===a)break;a=o}null!==a&&r.stopPropagation()}else Hr(e,t,r,null,n)}}var Kt=null;function Qt(e,t,n,r){if(Kt=null,null!==(e=va(e=xe(r))))if(null===(t=Ue(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=qe(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Kt=e,null}function Yt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Xe()){case Je:return 1;case et:return 4;case tt:case nt:return 16;case rt:return 536870912;default:return 16}default:return 16}}var Zt=null,Xt=null,Jt=null;function en(){if(Jt)return Jt;var e,t,n=Xt,r=n.length,a="value"in Zt?Zt.value:Zt.textContent,o=a.length;for(e=0;e<r&&n[e]===a[e];e++);var s=r-e;for(t=1;t<=s&&n[r-t]===a[o-t];t++);return Jt=a.slice(e,1<t?1-t:void 0)}function tn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function nn(){return!0}function rn(){return!1}function an(e){function t(t,n,r,a,o){for(var s in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(s)&&(t=e[s],this[s]=t?t(a):a[s]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?nn:rn,this.isPropagationStopped=rn,this}return M(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var on,sn,ln,cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},un=an(cn),dn=M({},cn,{view:0,detail:0}),pn=an(dn),gn=M({},dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ln&&(ln&&"mousemove"===e.type?(on=e.screenX-ln.screenX,sn=e.screenY-ln.screenY):sn=on=0,ln=e),on)},movementY:function(e){return"movementY"in e?e.movementY:sn}}),fn=an(gn),mn=an(M({},gn,{dataTransfer:0})),hn=an(M({},dn,{relatedTarget:0})),bn=an(M({},cn,{animationName:0,elapsedTime:0,pseudoElement:0})),vn=M({},cn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yn=an(vn),wn=an(M({},cn,{data:0})),xn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},jn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _n(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=jn[e])&&!!t[e]}function Sn(){return _n}var En=M({},dn,{key:function(e){if(e.key){var t=xn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?kn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sn,charCode:function(e){return"keypress"===e.type?tn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Cn=an(En),Tn=an(M({},gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),An=an(M({},dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sn})),Pn=an(M({},cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=M({},gn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ln=an(Rn),Nn=[9,13,27,32],On=u&&"CompositionEvent"in window,Dn=null;u&&"documentMode"in document&&(Dn=document.documentMode);var In=u&&"TextEvent"in window&&!Dn,Mn=u&&(!On||Dn&&8<Dn&&11>=Dn),Fn=String.fromCharCode(32),Bn=!1;function zn(e,t){switch(e){case"keyup":return-1!==Nn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $n(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Un=!1;var qn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Hn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!qn[e.type]:"textarea"===t}function Gn(e,t,n,r){Ee(r),0<(t=Wr(t,"onChange")).length&&(n=new un("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Wn=null,Vn=null;function Kn(e){Fr(e,0)}function Qn(e){if(V(wa(e)))return e}function Yn(e,t){if("change"===e)return t}var Zn=!1;if(u){var Xn;if(u){var Jn="oninput"in document;if(!Jn){var er=document.createElement("div");er.setAttribute("oninput","return;"),Jn="function"==typeof er.oninput}Xn=Jn}else Xn=!1;Zn=Xn&&(!document.documentMode||9<document.documentMode)}function tr(){Wn&&(Wn.detachEvent("onpropertychange",nr),Vn=Wn=null)}function nr(e){if("value"===e.propertyName&&Qn(Vn)){var t=[];Gn(t,Vn,e,xe(e)),Re(Kn,t)}}function rr(e,t,n){"focusin"===e?(tr(),Vn=n,(Wn=t).attachEvent("onpropertychange",nr)):"focusout"===e&&tr()}function ar(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qn(Vn)}function or(e,t){if("click"===e)return Qn(t)}function sr(e,t){if("input"===e||"change"===e)return Qn(t)}var ir="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function lr(e,t){if(ir(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!d.call(t,a)||!ir(e[a],t[a]))return!1}return!0}function cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ur(e,t){var n,r=cr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=cr(r)}}function dr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?dr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function pr(){for(var e=window,t=K();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=K((e=t.contentWindow).document)}return t}function gr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function fr(e){var t=pr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&dr(n.ownerDocument.documentElement,n)){if(null!==r&&gr(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var a=n.textContent.length,o=Math.min(r.start,a);r=void 0===r.end?o:Math.min(r.end,a),!e.extend&&o>r&&(a=r,r=o,o=a),a=ur(n,o);var s=ur(n,r);a&&s&&(1!==e.rangeCount||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&((t=t.createRange()).setStart(a.node,a.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var mr=u&&"documentMode"in document&&11>=document.documentMode,hr=null,br=null,vr=null,yr=!1;function wr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;yr||null==hr||hr!==K(r)||("selectionStart"in(r=hr)&&gr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},vr&&lr(vr,r)||(vr=r,0<(r=Wr(br,"onSelect")).length&&(t=new un("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=hr)))}function xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var kr={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionend:xr("Transition","TransitionEnd")},jr={},_r={};function Sr(e){if(jr[e])return jr[e];if(!kr[e])return e;var t,n=kr[e];for(t in n)if(n.hasOwnProperty(t)&&t in _r)return jr[e]=n[t];return e}u&&(_r=document.createElement("div").style,"AnimationEvent"in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),"TransitionEvent"in window||delete kr.transitionend.transition);var Er=Sr("animationend"),Cr=Sr("animationiteration"),Tr=Sr("animationstart"),Ar=Sr("transitionend"),Pr=new Map,Rr="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Lr(e,t){Pr.set(e,t),l(t,[e])}for(var Nr=0;Nr<Rr.length;Nr++){var Or=Rr[Nr];Lr(Or.toLowerCase(),"on"+(Or[0].toUpperCase()+Or.slice(1)))}Lr(Er,"onAnimationEnd"),Lr(Cr,"onAnimationIteration"),Lr(Tr,"onAnimationStart"),Lr("dblclick","onDoubleClick"),Lr("focusin","onFocus"),Lr("focusout","onBlur"),Lr(Ar,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ir=new Set("cancel close invalid load scroll toggle".split(" ").concat(Dr));function Mr(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,a,s,i,l,c){if($e.apply(this,arguments),Ie){if(!Ie)throw Error(o(198));var u=Me;Ie=!1,Me=null,Fe||(Fe=!0,Be=u)}}(r,t,void 0,e),e.currentTarget=null}function Fr(e,t){t=0!=(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var s=r.length-1;0<=s;s--){var i=r[s],l=i.instance,c=i.currentTarget;if(i=i.listener,l!==o&&a.isPropagationStopped())break e;Mr(a,i,c),o=l}else for(s=0;s<r.length;s++){if(l=(i=r[s]).instance,c=i.currentTarget,i=i.listener,l!==o&&a.isPropagationStopped())break e;Mr(a,i,c),o=l}}}if(Fe)throw e=Be,Fe=!1,Be=null,e}function Br(e,t){var n=t[ma];void 0===n&&(n=t[ma]=new Set);var r=e+"__bubble";n.has(r)||(qr(t,e,2,!1),n.add(r))}function zr(e,t,n){var r=0;t&&(r|=4),qr(n,e,r,t)}var $r="_reactListening"+Math.random().toString(36).slice(2);function Ur(e){if(!e[$r]){e[$r]=!0,s.forEach((function(t){"selectionchange"!==t&&(Ir.has(t)||zr(t,!1,e),zr(t,!0,e))}));var t=9===e.nodeType?e:e.ownerDocument;null===t||t[$r]||(t[$r]=!0,zr("selectionchange",!1,t))}}function qr(e,t,n,r){switch(Yt(t)){case 1:var a=Gt;break;case 4:a=Wt;break;default:a=Vt}n=a.bind(null,t,n,e),a=void 0,!Ne||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Hr(e,t,n,r,a){var o=r;if(0==(1&t)&&0==(2&t)&&null!==r)e:for(;;){if(null===r)return;var s=r.tag;if(3===s||4===s){var i=r.stateNode.containerInfo;if(i===a||8===i.nodeType&&i.parentNode===a)break;if(4===s)for(s=r.return;null!==s;){var l=s.tag;if((3===l||4===l)&&((l=s.stateNode.containerInfo)===a||8===l.nodeType&&l.parentNode===a))return;s=s.return}for(;null!==i;){if(null===(s=va(i)))return;if(5===(l=s.tag)||6===l){r=o=s;continue e}i=i.parentNode}}r=r.return}Re((function(){var r=o,a=xe(n),s=[];e:{var i=Pr.get(e);if(void 0!==i){var l=un,c=e;switch(e){case"keypress":if(0===tn(n))break e;case"keydown":case"keyup":l=Cn;break;case"focusin":c="focus",l=hn;break;case"focusout":c="blur",l=hn;break;case"beforeblur":case"afterblur":l=hn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=fn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=mn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=An;break;case Er:case Cr:case Tr:l=bn;break;case Ar:l=Pn;break;case"scroll":l=pn;break;case"wheel":l=Ln;break;case"copy":case"cut":case"paste":l=yn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Tn}var u=0!=(4&t),d=!u&&"scroll"===e,p=u?null!==i?i+"Capture":null:i;u=[];for(var g,f=r;null!==f;){var m=(g=f).stateNode;if(5===g.tag&&null!==m&&(g=m,null!==p&&(null!=(m=Le(f,p))&&u.push(Gr(f,m,g)))),d)break;f=f.return}0<u.length&&(i=new l(i,c,null,n,a),s.push({event:i,listeners:u}))}}if(0==(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(i="mouseover"===e||"pointerover"===e)||n===we||!(c=n.relatedTarget||n.fromElement)||!va(c)&&!c[fa])&&(l||i)&&(i=a.window===a?a:(i=a.ownerDocument)?i.defaultView||i.parentWindow:window,l?(l=r,null!==(c=(c=n.relatedTarget||n.toElement)?va(c):null)&&(c!==(d=Ue(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=r),l!==c)){if(u=fn,m="onMouseLeave",p="onMouseEnter",f="mouse","pointerout"!==e&&"pointerover"!==e||(u=Tn,m="onPointerLeave",p="onPointerEnter",f="pointer"),d=null==l?i:wa(l),g=null==c?i:wa(c),(i=new u(m,f+"leave",l,n,a)).target=d,i.relatedTarget=g,m=null,va(a)===r&&((u=new u(p,f+"enter",c,n,a)).target=g,u.relatedTarget=d,m=u),d=m,l&&c)e:{for(p=c,f=0,g=u=l;g;g=Vr(g))f++;for(g=0,m=p;m;m=Vr(m))g++;for(;0<f-g;)u=Vr(u),f--;for(;0<g-f;)p=Vr(p),g--;for(;f--;){if(u===p||null!==p&&u===p.alternate)break e;u=Vr(u),p=Vr(p)}u=null}else u=null;null!==l&&Kr(s,i,l,u,!1),null!==c&&null!==d&&Kr(s,d,c,u,!0)}if("select"===(l=(i=r?wa(r):window).nodeName&&i.nodeName.toLowerCase())||"input"===l&&"file"===i.type)var h=Yn;else if(Hn(i))if(Zn)h=sr;else{h=ar;var b=rr}else(l=i.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===i.type||"radio"===i.type)&&(h=or);switch(h&&(h=h(e,r))?Gn(s,h,n,a):(b&&b(e,i,r),"focusout"===e&&(b=i._wrapperState)&&b.controlled&&"number"===i.type&&ee(i,"number",i.value)),b=r?wa(r):window,e){case"focusin":(Hn(b)||"true"===b.contentEditable)&&(hr=b,br=r,vr=null);break;case"focusout":vr=br=hr=null;break;case"mousedown":yr=!0;break;case"contextmenu":case"mouseup":case"dragend":yr=!1,wr(s,n,a);break;case"selectionchange":if(mr)break;case"keydown":case"keyup":wr(s,n,a)}var v;if(On)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Un?zn(e,n)&&(y="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(y="onCompositionStart");y&&(Mn&&"ko"!==n.locale&&(Un||"onCompositionStart"!==y?"onCompositionEnd"===y&&Un&&(v=en()):(Xt="value"in(Zt=a)?Zt.value:Zt.textContent,Un=!0)),0<(b=Wr(r,y)).length&&(y=new wn(y,e,null,n,a),s.push({event:y,listeners:b}),v?y.data=v:null!==(v=$n(n))&&(y.data=v))),(v=In?function(e,t){switch(e){case"compositionend":return $n(t);case"keypress":return 32!==t.which?null:(Bn=!0,Fn);case"textInput":return(e=t.data)===Fn&&Bn?null:e;default:return null}}(e,n):function(e,t){if(Un)return"compositionend"===e||!On&&zn(e,t)?(e=en(),Jt=Xt=Zt=null,Un=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Mn&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=Wr(r,"onBeforeInput")).length&&(a=new wn("onBeforeInput","beforeinput",null,n,a),s.push({event:a,listeners:r}),a.data=v))}Fr(s,t)}))}function Gr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Wr(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,o=a.stateNode;5===a.tag&&null!==o&&(a=o,null!=(o=Le(e,n))&&r.unshift(Gr(e,o,a)),null!=(o=Le(e,t))&&r.push(Gr(e,o,a))),e=e.return}return r}function Vr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Kr(e,t,n,r,a){for(var o=t._reactName,s=[];null!==n&&n!==r;){var i=n,l=i.alternate,c=i.stateNode;if(null!==l&&l===r)break;5===i.tag&&null!==c&&(i=c,a?null!=(l=Le(n,o))&&s.unshift(Gr(n,l,i)):a||null!=(l=Le(n,o))&&s.push(Gr(n,l,i))),n=n.return}0!==s.length&&e.push({event:t,listeners:s})}var Qr=/\r\n?/g,Yr=/\u0000|\uFFFD/g;function Zr(e){return("string"==typeof e?e:""+e).replace(Qr,"\n").replace(Yr,"")}function Xr(e,t,n){if(t=Zr(t),Zr(e)!==t&&n)throw Error(o(425))}function Jr(){}var ea=null,ta=null;function na(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ra="function"==typeof setTimeout?setTimeout:void 0,aa="function"==typeof clearTimeout?clearTimeout:void 0,oa="function"==typeof Promise?Promise:void 0,sa="function"==typeof queueMicrotask?queueMicrotask:void 0!==oa?function(e){return oa.resolve(null).then(e).catch(ia)}:ra;function ia(e){setTimeout((function(){throw e}))}function la(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&8===a.nodeType)if("/$"===(n=a.data)){if(0===r)return e.removeChild(a),void Ut(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=a}while(n);Ut(t)}function ca(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function ua(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var da=Math.random().toString(36).slice(2),pa="__reactFiber$"+da,ga="__reactProps$"+da,fa="__reactContainer$"+da,ma="__reactEvents$"+da,ha="__reactListeners$"+da,ba="__reactHandles$"+da;function va(e){var t=e[pa];if(t)return t;for(var n=e.parentNode;n;){if(t=n[fa]||n[pa]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=ua(e);null!==e;){if(n=e[pa])return n;e=ua(e)}return t}n=(e=n).parentNode}return null}function ya(e){return!(e=e[pa]||e[fa])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function wa(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(o(33))}function xa(e){return e[ga]||null}var ka=[],ja=-1;function _a(e){return{current:e}}function Sa(e){0>ja||(e.current=ka[ja],ka[ja]=null,ja--)}function Ea(e,t){ja++,ka[ja]=e.current,e.current=t}var Ca={},Ta=_a(Ca),Aa=_a(!1),Pa=Ca;function Ra(e,t){var n=e.type.contextTypes;if(!n)return Ca;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a,o={};for(a in n)o[a]=t[a];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function La(e){return null!=(e=e.childContextTypes)}function Na(){Sa(Aa),Sa(Ta)}function Oa(e,t,n){if(Ta.current!==Ca)throw Error(o(168));Ea(Ta,t),Ea(Aa,n)}function Da(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in t))throw Error(o(108,q(e)||"Unknown",a));return M({},n,r)}function Ia(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ca,Pa=Ta.current,Ea(Ta,e),Ea(Aa,Aa.current),!0}function Ma(e,t,n){var r=e.stateNode;if(!r)throw Error(o(169));n?(e=Da(e,t,Pa),r.__reactInternalMemoizedMergedChildContext=e,Sa(Aa),Sa(Ta),Ea(Ta,e)):Sa(Aa),Ea(Aa,n)}var Fa=null,Ba=!1,za=!1;function $a(e){null===Fa?Fa=[e]:Fa.push(e)}function Ua(){if(!za&&null!==Fa){za=!0;var e=0,t=yt;try{var n=Fa;for(yt=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Fa=null,Ba=!1}catch(a){throw null!==Fa&&(Fa=Fa.slice(e+1)),Ve(Je,Ua),a}finally{yt=t,za=!1}}return null}var qa=[],Ha=0,Ga=null,Wa=0,Va=[],Ka=0,Qa=null,Ya=1,Za="";function Xa(e,t){qa[Ha++]=Wa,qa[Ha++]=Ga,Ga=e,Wa=t}function Ja(e,t,n){Va[Ka++]=Ya,Va[Ka++]=Za,Va[Ka++]=Qa,Qa=e;var r=Ya;e=Za;var a=32-st(r)-1;r&=~(1<<a),n+=1;var o=32-st(t)+a;if(30<o){var s=a-a%5;o=(r&(1<<s)-1).toString(32),r>>=s,a-=s,Ya=1<<32-st(t)+a|n<<a|r,Za=o+e}else Ya=1<<o|n<<a|r,Za=e}function eo(e){null!==e.return&&(Xa(e,1),Ja(e,1,0))}function to(e){for(;e===Ga;)Ga=qa[--Ha],qa[Ha]=null,Wa=qa[--Ha],qa[Ha]=null;for(;e===Qa;)Qa=Va[--Ka],Va[Ka]=null,Za=Va[--Ka],Va[Ka]=null,Ya=Va[--Ka],Va[Ka]=null}var no=null,ro=null,ao=!1,oo=null;function so(e,t){var n=Lc(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function io(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,no=e,ro=ca(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,no=e,ro=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Qa?{id:Ya,overflow:Za}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=Lc(18,null,null,0)).stateNode=t,n.return=e,e.child=n,no=e,ro=null,!0);default:return!1}}function lo(e){return 0!=(1&e.mode)&&0==(128&e.flags)}function co(e){if(ao){var t=ro;if(t){var n=t;if(!io(e,t)){if(lo(e))throw Error(o(418));t=ca(n.nextSibling);var r=no;t&&io(e,t)?so(r,n):(e.flags=-4097&e.flags|2,ao=!1,no=e)}}else{if(lo(e))throw Error(o(418));e.flags=-4097&e.flags|2,ao=!1,no=e}}}function uo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;no=e}function po(e){if(e!==no)return!1;if(!ao)return uo(e),ao=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!na(e.type,e.memoizedProps)),t&&(t=ro)){if(lo(e))throw go(),Error(o(418));for(;t;)so(e,t),t=ca(t.nextSibling)}if(uo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){ro=ca(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}ro=null}}else ro=no?ca(e.stateNode.nextSibling):null;return!0}function go(){for(var e=ro;e;)e=ca(e.nextSibling)}function fo(){ro=no=null,ao=!1}function mo(e){null===oo?oo=[e]:oo.push(e)}var ho=w.ReactCurrentBatchConfig;function bo(e,t){if(e&&e.defaultProps){for(var n in t=M({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var vo=_a(null),yo=null,wo=null,xo=null;function ko(){xo=wo=yo=null}function jo(e){var t=vo.current;Sa(vo),e._currentValue=t}function _o(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function So(e,t){yo=e,xo=wo=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(wi=!0),e.firstContext=null)}function Eo(e){var t=e._currentValue;if(xo!==e)if(e={context:e,memoizedValue:t,next:null},null===wo){if(null===yo)throw Error(o(308));wo=e,yo.dependencies={lanes:0,firstContext:e}}else wo=wo.next=e;return t}var Co=null;function To(e){null===Co?Co=[e]:Co.push(e)}function Ao(e,t,n,r){var a=t.interleaved;return null===a?(n.next=n,To(t)):(n.next=a.next,a.next=n),t.interleaved=n,Po(e,r)}function Po(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var Ro=!1;function Lo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function No(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Oo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Do(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,0!=(2&Al)){var a=r.pending;return null===a?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Po(e,n)}return null===(a=r.interleaved)?(t.next=t,To(r)):(t.next=a.next,a.next=t),r.interleaved=t,Po(e,n)}function Io(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,0!=(4194240&n))){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,vt(e,n)}}function Mo(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?a=o=s:o=o.next=s,n=n.next}while(null!==n);null===o?a=o=t:o=o.next=t}else a=o=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Fo(e,t,n,r){var a=e.updateQueue;Ro=!1;var o=a.firstBaseUpdate,s=a.lastBaseUpdate,i=a.shared.pending;if(null!==i){a.shared.pending=null;var l=i,c=l.next;l.next=null,null===s?o=c:s.next=c,s=l;var u=e.alternate;null!==u&&((i=(u=u.updateQueue).lastBaseUpdate)!==s&&(null===i?u.firstBaseUpdate=c:i.next=c,u.lastBaseUpdate=l))}if(null!==o){var d=a.baseState;for(s=0,u=c=l=null,i=o;;){var p=i.lane,g=i.eventTime;if((r&p)===p){null!==u&&(u=u.next={eventTime:g,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var f=e,m=i;switch(p=t,g=n,m.tag){case 1:if("function"==typeof(f=m.payload)){d=f.call(g,d,p);break e}d=f;break e;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(p="function"==typeof(f=m.payload)?f.call(g,d,p):f))break e;d=M({},d,p);break e;case 2:Ro=!0}}null!==i.callback&&0!==i.lane&&(e.flags|=64,null===(p=a.effects)?a.effects=[i]:p.push(i))}else g={eventTime:g,lane:p,tag:i.tag,payload:i.payload,callback:i.callback,next:null},null===u?(c=u=g,l=d):u=u.next=g,s|=p;if(null===(i=i.next)){if(null===(i=a.shared.pending))break;i=(p=i).next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}if(null===u&&(l=d),a.baseState=l,a.firstBaseUpdate=c,a.lastBaseUpdate=u,null!==(t=a.shared.interleaved)){a=t;do{s|=a.lane,a=a.next}while(a!==t)}else null===o&&(a.shared.lanes=0);Ml|=s,e.lanes=s,e.memoizedState=d}}function Bo(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(null!==a){if(r.callback=null,r=n,"function"!=typeof a)throw Error(o(191,a));a.call(r)}}}var zo=(new r.Component).refs;function $o(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:M({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var Uo={isMounted:function(e){return!!(e=e._reactInternals)&&Ue(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=tc(),a=nc(e),o=Oo(r,a);o.payload=t,null!=n&&(o.callback=n),null!==(t=Do(e,o,a))&&(rc(t,e,a,r),Io(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=tc(),a=nc(e),o=Oo(r,a);o.tag=1,o.payload=t,null!=n&&(o.callback=n),null!==(t=Do(e,o,a))&&(rc(t,e,a,r),Io(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=tc(),r=nc(e),a=Oo(n,r);a.tag=2,null!=t&&(a.callback=t),null!==(t=Do(e,a,r))&&(rc(t,e,r,n),Io(t,e,r))}};function qo(e,t,n,r,a,o,s){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,s):!t.prototype||!t.prototype.isPureReactComponent||(!lr(n,r)||!lr(a,o))}function Ho(e,t,n){var r=!1,a=Ca,o=t.contextType;return"object"==typeof o&&null!==o?o=Eo(o):(a=La(t)?Pa:Ta.current,o=(r=null!=(r=t.contextTypes))?Ra(e,a):Ca),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Uo,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function Go(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Uo.enqueueReplaceState(t,t.state,null)}function Wo(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs=zo,Lo(e);var o=t.contextType;"object"==typeof o&&null!==o?a.context=Eo(o):(o=La(t)?Pa:Ta.current,a.context=Ra(e,o)),a.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&($o(e,t,o,n),a.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(t=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),t!==a.state&&Uo.enqueueReplaceState(a,a.state,null),Fo(e,n,a,r),a.state=e.memoizedState),"function"==typeof a.componentDidMount&&(e.flags|=4194308)}function Vo(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(o(309));var r=n.stateNode}if(!r)throw Error(o(147,e));var a=r,s=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===s?t.ref:(t=function(e){var t=a.refs;t===zo&&(t=a.refs={}),null===e?delete t[s]:t[s]=e},t._stringRef=s,t)}if("string"!=typeof e)throw Error(o(284));if(!n._owner)throw Error(o(290,e))}return e}function Ko(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Qo(e){return(0,e._init)(e._payload)}function Yo(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function a(e,t){return(e=Oc(e,t)).index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function i(t){return e&&null===t.alternate&&(t.flags|=2),t}function l(e,t,n,r){return null===t||6!==t.tag?((t=Fc(n,e.mode,r)).return=e,t):((t=a(t,n)).return=e,t)}function c(e,t,n,r){var o=n.type;return o===j?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===L&&Qo(o)===t.type)?((r=a(t,n.props)).ref=Vo(e,t,n),r.return=e,r):((r=Dc(n.type,n.key,n.props,null,e.mode,r)).ref=Vo(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Bc(n,e.mode,r)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function d(e,t,n,r,o){return null===t||7!==t.tag?((t=Ic(n,e.mode,r,o)).return=e,t):((t=a(t,n)).return=e,t)}function p(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Fc(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case x:return(n=Dc(t.type,t.key,t.props,null,e.mode,n)).ref=Vo(e,null,t),n.return=e,n;case k:return(t=Bc(t,e.mode,n)).return=e,t;case L:return p(e,(0,t._init)(t._payload),n)}if(te(t)||D(t))return(t=Ic(t,e.mode,n,null)).return=e,t;Ko(e,t)}return null}function g(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==a?null:l(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case x:return n.key===a?c(e,t,n,r):null;case k:return n.key===a?u(e,t,n,r):null;case L:return g(e,t,(a=n._init)(n._payload),r)}if(te(n)||D(n))return null!==a?null:d(e,t,n,r,null);Ko(e,n)}return null}function f(e,t,n,r,a){if("string"==typeof r&&""!==r||"number"==typeof r)return l(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case x:return c(t,e=e.get(null===r.key?n:r.key)||null,r,a);case k:return u(t,e=e.get(null===r.key?n:r.key)||null,r,a);case L:return f(e,t,n,(0,r._init)(r._payload),a)}if(te(r)||D(r))return d(t,e=e.get(n)||null,r,a,null);Ko(t,r)}return null}function m(a,o,i,l){for(var c=null,u=null,d=o,m=o=0,h=null;null!==d&&m<i.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var b=g(a,d,i[m],l);if(null===b){null===d&&(d=h);break}e&&d&&null===b.alternate&&t(a,d),o=s(b,o,m),null===u?c=b:u.sibling=b,u=b,d=h}if(m===i.length)return n(a,d),ao&&Xa(a,m),c;if(null===d){for(;m<i.length;m++)null!==(d=p(a,i[m],l))&&(o=s(d,o,m),null===u?c=d:u.sibling=d,u=d);return ao&&Xa(a,m),c}for(d=r(a,d);m<i.length;m++)null!==(h=f(d,a,m,i[m],l))&&(e&&null!==h.alternate&&d.delete(null===h.key?m:h.key),o=s(h,o,m),null===u?c=h:u.sibling=h,u=h);return e&&d.forEach((function(e){return t(a,e)})),ao&&Xa(a,m),c}function h(a,i,l,c){var u=D(l);if("function"!=typeof u)throw Error(o(150));if(null==(l=u.call(l)))throw Error(o(151));for(var d=u=null,m=i,h=i=0,b=null,v=l.next();null!==m&&!v.done;h++,v=l.next()){m.index>h?(b=m,m=null):b=m.sibling;var y=g(a,m,v.value,c);if(null===y){null===m&&(m=b);break}e&&m&&null===y.alternate&&t(a,m),i=s(y,i,h),null===d?u=y:d.sibling=y,d=y,m=b}if(v.done)return n(a,m),ao&&Xa(a,h),u;if(null===m){for(;!v.done;h++,v=l.next())null!==(v=p(a,v.value,c))&&(i=s(v,i,h),null===d?u=v:d.sibling=v,d=v);return ao&&Xa(a,h),u}for(m=r(a,m);!v.done;h++,v=l.next())null!==(v=f(m,a,h,v.value,c))&&(e&&null!==v.alternate&&m.delete(null===v.key?h:v.key),i=s(v,i,h),null===d?u=v:d.sibling=v,d=v);return e&&m.forEach((function(e){return t(a,e)})),ao&&Xa(a,h),u}return function e(r,o,s,l){if("object"==typeof s&&null!==s&&s.type===j&&null===s.key&&(s=s.props.children),"object"==typeof s&&null!==s){switch(s.$$typeof){case x:e:{for(var c=s.key,u=o;null!==u;){if(u.key===c){if((c=s.type)===j){if(7===u.tag){n(r,u.sibling),(o=a(u,s.props.children)).return=r,r=o;break e}}else if(u.elementType===c||"object"==typeof c&&null!==c&&c.$$typeof===L&&Qo(c)===u.type){n(r,u.sibling),(o=a(u,s.props)).ref=Vo(r,u,s),o.return=r,r=o;break e}n(r,u);break}t(r,u),u=u.sibling}s.type===j?((o=Ic(s.props.children,r.mode,l,s.key)).return=r,r=o):((l=Dc(s.type,s.key,s.props,null,r.mode,l)).ref=Vo(r,o,s),l.return=r,r=l)}return i(r);case k:e:{for(u=s.key;null!==o;){if(o.key===u){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){n(r,o.sibling),(o=a(o,s.children||[])).return=r,r=o;break e}n(r,o);break}t(r,o),o=o.sibling}(o=Bc(s,r.mode,l)).return=r,r=o}return i(r);case L:return e(r,o,(u=s._init)(s._payload),l)}if(te(s))return m(r,o,s,l);if(D(s))return h(r,o,s,l);Ko(r,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==o&&6===o.tag?(n(r,o.sibling),(o=a(o,s)).return=r,r=o):(n(r,o),(o=Fc(s,r.mode,l)).return=r,r=o),i(r)):n(r,o)}}var Zo=Yo(!0),Xo=Yo(!1),Jo={},es=_a(Jo),ts=_a(Jo),ns=_a(Jo);function rs(e){if(e===Jo)throw Error(o(174));return e}function as(e,t){switch(Ea(ns,t),Ea(ts,e),Ea(es,Jo),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:le(null,"");break;default:t=le(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Sa(es),Ea(es,t)}function os(){Sa(es),Sa(ts),Sa(ns)}function ss(e){rs(ns.current);var t=rs(es.current),n=le(t,e.type);t!==n&&(Ea(ts,e),Ea(es,n))}function is(e){ts.current===e&&(Sa(es),Sa(ts))}var ls=_a(0);function cs(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var us=[];function ds(){for(var e=0;e<us.length;e++)us[e]._workInProgressVersionPrimary=null;us.length=0}var ps=w.ReactCurrentDispatcher,gs=w.ReactCurrentBatchConfig,fs=0,ms=null,hs=null,bs=null,vs=!1,ys=!1,ws=0,xs=0;function ks(){throw Error(o(321))}function js(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ir(e[n],t[n]))return!1;return!0}function _s(e,t,n,r,a,s){if(fs=s,ms=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ps.current=null===e||null===e.memoizedState?ii:li,e=n(r,a),ys){s=0;do{if(ys=!1,ws=0,25<=s)throw Error(o(301));s+=1,bs=hs=null,t.updateQueue=null,ps.current=ci,e=n(r,a)}while(ys)}if(ps.current=si,t=null!==hs&&null!==hs.next,fs=0,bs=hs=ms=null,vs=!1,t)throw Error(o(300));return e}function Ss(){var e=0!==ws;return ws=0,e}function Es(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===bs?ms.memoizedState=bs=e:bs=bs.next=e,bs}function Cs(){if(null===hs){var e=ms.alternate;e=null!==e?e.memoizedState:null}else e=hs.next;var t=null===bs?ms.memoizedState:bs.next;if(null!==t)bs=t,hs=e;else{if(null===e)throw Error(o(310));e={memoizedState:(hs=e).memoizedState,baseState:hs.baseState,baseQueue:hs.baseQueue,queue:hs.queue,next:null},null===bs?ms.memoizedState=bs=e:bs=bs.next=e}return bs}function Ts(e,t){return"function"==typeof t?t(e):t}function As(e){var t=Cs(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=hs,a=r.baseQueue,s=n.pending;if(null!==s){if(null!==a){var i=a.next;a.next=s.next,s.next=i}r.baseQueue=a=s,n.pending=null}if(null!==a){s=a.next,r=r.baseState;var l=i=null,c=null,u=s;do{var d=u.lane;if((fs&d)===d)null!==c&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var p={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===c?(l=c=p,i=r):c=c.next=p,ms.lanes|=d,Ml|=d}u=u.next}while(null!==u&&u!==s);null===c?i=r:c.next=l,ir(r,t.memoizedState)||(wi=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=c,n.lastRenderedState=r}if(null!==(e=n.interleaved)){a=e;do{s=a.lane,ms.lanes|=s,Ml|=s,a=a.next}while(a!==e)}else null===a&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ps(e){var t=Cs(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,s=t.memoizedState;if(null!==a){n.pending=null;var i=a=a.next;do{s=e(s,i.action),i=i.next}while(i!==a);ir(s,t.memoizedState)||(wi=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Rs(){}function Ls(e,t){var n=ms,r=Cs(),a=t(),s=!ir(r.memoizedState,a);if(s&&(r.memoizedState=a,wi=!0),r=r.queue,Hs(Ds.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||null!==bs&&1&bs.memoizedState.tag){if(n.flags|=2048,Bs(9,Os.bind(null,n,r,a,t),void 0,null),null===Pl)throw Error(o(349));0!=(30&fs)||Ns(n,t,a)}return a}function Ns(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=ms.updateQueue)?(t={lastEffect:null,stores:null},ms.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Os(e,t,n,r){t.value=n,t.getSnapshot=r,Is(t)&&Ms(e)}function Ds(e,t,n){return n((function(){Is(t)&&Ms(e)}))}function Is(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ir(e,n)}catch(r){return!0}}function Ms(e){var t=Po(e,1);null!==t&&rc(t,e,1,-1)}function Fs(e){var t=Es();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ts,lastRenderedState:e},t.queue=e,e=e.dispatch=ni.bind(null,ms,e),[t.memoizedState,e]}function Bs(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=ms.updateQueue)?(t={lastEffect:null,stores:null},ms.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function zs(){return Cs().memoizedState}function $s(e,t,n,r){var a=Es();ms.flags|=e,a.memoizedState=Bs(1|t,n,void 0,void 0===r?null:r)}function Us(e,t,n,r){var a=Cs();r=void 0===r?null:r;var o=void 0;if(null!==hs){var s=hs.memoizedState;if(o=s.destroy,null!==r&&js(r,s.deps))return void(a.memoizedState=Bs(t,n,o,r))}ms.flags|=e,a.memoizedState=Bs(1|t,n,o,r)}function qs(e,t){return $s(8390656,8,e,t)}function Hs(e,t){return Us(2048,8,e,t)}function Gs(e,t){return Us(4,2,e,t)}function Ws(e,t){return Us(4,4,e,t)}function Vs(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Ks(e,t,n){return n=null!=n?n.concat([e]):null,Us(4,4,Vs.bind(null,t,e),n)}function Qs(){}function Ys(e,t){var n=Cs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&js(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Zs(e,t){var n=Cs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&js(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Xs(e,t,n){return 0==(21&fs)?(e.baseState&&(e.baseState=!1,wi=!0),e.memoizedState=n):(ir(n,t)||(n=mt(),ms.lanes|=n,Ml|=n,e.baseState=!0),t)}function Js(e,t){var n=yt;yt=0!==n&&4>n?n:4,e(!0);var r=gs.transition;gs.transition={};try{e(!1),t()}finally{yt=n,gs.transition=r}}function ei(){return Cs().memoizedState}function ti(e,t,n){var r=nc(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ri(e))ai(t,n);else if(null!==(n=Ao(e,t,n,r))){rc(n,e,r,tc()),oi(n,t,r)}}function ni(e,t,n){var r=nc(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ri(e))ai(t,a);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var s=t.lastRenderedState,i=o(s,n);if(a.hasEagerState=!0,a.eagerState=i,ir(i,s)){var l=t.interleaved;return null===l?(a.next=a,To(t)):(a.next=l.next,l.next=a),void(t.interleaved=a)}}catch(c){}null!==(n=Ao(e,t,a,r))&&(rc(n,e,r,a=tc()),oi(n,t,r))}}function ri(e){var t=e.alternate;return e===ms||null!==t&&t===ms}function ai(e,t){ys=vs=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function oi(e,t,n){if(0!=(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,vt(e,n)}}var si={readContext:Eo,useCallback:ks,useContext:ks,useEffect:ks,useImperativeHandle:ks,useInsertionEffect:ks,useLayoutEffect:ks,useMemo:ks,useReducer:ks,useRef:ks,useState:ks,useDebugValue:ks,useDeferredValue:ks,useTransition:ks,useMutableSource:ks,useSyncExternalStore:ks,useId:ks,unstable_isNewReconciler:!1},ii={readContext:Eo,useCallback:function(e,t){return Es().memoizedState=[e,void 0===t?null:t],e},useContext:Eo,useEffect:qs,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,$s(4194308,4,Vs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $s(4194308,4,e,t)},useInsertionEffect:function(e,t){return $s(4,2,e,t)},useMemo:function(e,t){var n=Es();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Es();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ti.bind(null,ms,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Es().memoizedState=e},useState:Fs,useDebugValue:Qs,useDeferredValue:function(e){return Es().memoizedState=e},useTransition:function(){var e=Fs(!1),t=e[0];return e=Js.bind(null,e[1]),Es().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ms,a=Es();if(ao){if(void 0===n)throw Error(o(407));n=n()}else{if(n=t(),null===Pl)throw Error(o(349));0!=(30&fs)||Ns(r,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,qs(Ds.bind(null,r,s,e),[e]),r.flags|=2048,Bs(9,Os.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Es(),t=Pl.identifierPrefix;if(ao){var n=Za;t=":"+t+"R"+(n=(Ya&~(1<<32-st(Ya)-1)).toString(32)+n),0<(n=ws++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=xs++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},li={readContext:Eo,useCallback:Ys,useContext:Eo,useEffect:Hs,useImperativeHandle:Ks,useInsertionEffect:Gs,useLayoutEffect:Ws,useMemo:Zs,useReducer:As,useRef:zs,useState:function(){return As(Ts)},useDebugValue:Qs,useDeferredValue:function(e){return Xs(Cs(),hs.memoizedState,e)},useTransition:function(){return[As(Ts)[0],Cs().memoizedState]},useMutableSource:Rs,useSyncExternalStore:Ls,useId:ei,unstable_isNewReconciler:!1},ci={readContext:Eo,useCallback:Ys,useContext:Eo,useEffect:Hs,useImperativeHandle:Ks,useInsertionEffect:Gs,useLayoutEffect:Ws,useMemo:Zs,useReducer:Ps,useRef:zs,useState:function(){return Ps(Ts)},useDebugValue:Qs,useDeferredValue:function(e){var t=Cs();return null===hs?t.memoizedState=e:Xs(t,hs.memoizedState,e)},useTransition:function(){return[Ps(Ts)[0],Cs().memoizedState]},useMutableSource:Rs,useSyncExternalStore:Ls,useId:ei,unstable_isNewReconciler:!1};function ui(e,t){try{var n="",r=t;do{n+=$(r),r=r.return}while(r);var a=n}catch(o){a="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:a,digest:null}}function di(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function pi(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}var gi="function"==typeof WeakMap?WeakMap:Map;function fi(e,t,n){(n=Oo(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Gl||(Gl=!0,Wl=r),pi(0,t)},n}function mi(e,t,n){(n=Oo(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){pi(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){pi(0,t),"function"!=typeof r&&(null===Vl?Vl=new Set([this]):Vl.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function hi(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new gi;var a=new Set;r.set(t,a)}else void 0===(a=r.get(t))&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=Ec.bind(null,e,t,n),t.then(e,e))}function bi(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function vi(e,t,n,r,a){return 0==(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Oo(-1,1)).tag=2,Do(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=a,e)}var yi=w.ReactCurrentOwner,wi=!1;function xi(e,t,n,r){t.child=null===e?Xo(t,null,n,r):Zo(t,e.child,n,r)}function ki(e,t,n,r,a){n=n.render;var o=t.ref;return So(t,a),r=_s(e,t,n,r,o,a),n=Ss(),null===e||wi?(ao&&n&&eo(t),t.flags|=1,xi(e,t,r,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Gi(e,t,a))}function ji(e,t,n,r,a){if(null===e){var o=n.type;return"function"!=typeof o||Nc(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Dc(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,_i(e,t,o,r,a))}if(o=e.child,0==(e.lanes&a)){var s=o.memoizedProps;if((n=null!==(n=n.compare)?n:lr)(s,r)&&e.ref===t.ref)return Gi(e,t,a)}return t.flags|=1,(e=Oc(o,r)).ref=t.ref,e.return=t,t.child=e}function _i(e,t,n,r,a){if(null!==e){var o=e.memoizedProps;if(lr(o,r)&&e.ref===t.ref){if(wi=!1,t.pendingProps=r=o,0==(e.lanes&a))return t.lanes=e.lanes,Gi(e,t,a);0!=(131072&e.flags)&&(wi=!0)}}return Ci(e,t,n,r,a)}function Si(e,t,n){var r=t.pendingProps,a=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ea(Ol,Nl),Nl|=n;else{if(0==(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ea(Ol,Nl),Nl|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,Ea(Ol,Nl),Nl|=r}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,Ea(Ol,Nl),Nl|=r;return xi(e,t,a,n),t.child}function Ei(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ci(e,t,n,r,a){var o=La(n)?Pa:Ta.current;return o=Ra(t,o),So(t,a),n=_s(e,t,n,r,o,a),r=Ss(),null===e||wi?(ao&&r&&eo(t),t.flags|=1,xi(e,t,n,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Gi(e,t,a))}function Ti(e,t,n,r,a){if(La(n)){var o=!0;Ia(t)}else o=!1;if(So(t,a),null===t.stateNode)Hi(e,t),Ho(t,n,r),Wo(t,n,r,a),r=!0;else if(null===e){var s=t.stateNode,i=t.memoizedProps;s.props=i;var l=s.context,c=n.contextType;"object"==typeof c&&null!==c?c=Eo(c):c=Ra(t,c=La(n)?Pa:Ta.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof s.getSnapshotBeforeUpdate;d||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(i!==r||l!==c)&&Go(t,s,r,c),Ro=!1;var p=t.memoizedState;s.state=p,Fo(t,r,s,a),l=t.memoizedState,i!==r||p!==l||Aa.current||Ro?("function"==typeof u&&($o(t,n,u,r),l=t.memoizedState),(i=Ro||qo(t,n,i,r,p,l,c))?(d||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.flags|=4194308)):("function"==typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=i):("function"==typeof s.componentDidMount&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,No(e,t),i=t.memoizedProps,c=t.type===t.elementType?i:bo(t.type,i),s.props=c,d=t.pendingProps,p=s.context,"object"==typeof(l=n.contextType)&&null!==l?l=Eo(l):l=Ra(t,l=La(n)?Pa:Ta.current);var g=n.getDerivedStateFromProps;(u="function"==typeof g||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(i!==d||p!==l)&&Go(t,s,r,l),Ro=!1,p=t.memoizedState,s.state=p,Fo(t,r,s,a);var f=t.memoizedState;i!==d||p!==f||Aa.current||Ro?("function"==typeof g&&($o(t,n,g,r),f=t.memoizedState),(c=Ro||qo(t,n,c,r,p,f,l)||!1)?(u||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(r,f,l),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(r,f,l)),"function"==typeof s.componentDidUpdate&&(t.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof s.componentDidUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),s.props=r,s.state=f,s.context=l,r=c):("function"!=typeof s.componentDidUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Ai(e,t,n,r,o,a)}function Ai(e,t,n,r,a,o){Ei(e,t);var s=0!=(128&t.flags);if(!r&&!s)return a&&Ma(t,n,!1),Gi(e,t,o);r=t.stateNode,yi.current=t;var i=s&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&s?(t.child=Zo(t,e.child,null,o),t.child=Zo(t,null,i,o)):xi(e,t,i,o),t.memoizedState=r.state,a&&Ma(t,n,!0),t.child}function Pi(e){var t=e.stateNode;t.pendingContext?Oa(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Oa(0,t.context,!1),as(e,t.containerInfo)}function Ri(e,t,n,r,a){return fo(),mo(a),t.flags|=256,xi(e,t,n,r),t.child}var Li,Ni,Oi,Di,Ii={dehydrated:null,treeContext:null,retryLane:0};function Mi(e){return{baseLanes:e,cachePool:null,transitions:null}}function Fi(e,t,n){var r,a=t.pendingProps,s=ls.current,i=!1,l=0!=(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&0!=(2&s)),r?(i=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(s|=1),Ea(ls,1&s),null===e)return co(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0==(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(l=a.children,e=a.fallback,i?(a=t.mode,i=t.child,l={mode:"hidden",children:l},0==(1&a)&&null!==i?(i.childLanes=0,i.pendingProps=l):i=Mc(l,a,0,null),e=Ic(e,a,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Mi(n),t.memoizedState=Ii,e):Bi(t,l));if(null!==(s=e.memoizedState)&&null!==(r=s.dehydrated))return function(e,t,n,r,a,s,i){if(n)return 256&t.flags?(t.flags&=-257,zi(e,t,i,r=di(Error(o(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(s=r.fallback,a=t.mode,r=Mc({mode:"visible",children:r.children},a,0,null),(s=Ic(s,a,i,null)).flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,0!=(1&t.mode)&&Zo(t,e.child,null,i),t.child.memoizedState=Mi(i),t.memoizedState=Ii,s);if(0==(1&t.mode))return zi(e,t,i,null);if("$!"===a.data){if(r=a.nextSibling&&a.nextSibling.dataset)var l=r.dgst;return r=l,zi(e,t,i,r=di(s=Error(o(419)),r,void 0))}if(l=0!=(i&e.childLanes),wi||l){if(null!==(r=Pl)){switch(i&-i){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}0!==(a=0!=(a&(r.suspendedLanes|i))?0:a)&&a!==s.retryLane&&(s.retryLane=a,Po(e,a),rc(r,e,a,-1))}return hc(),zi(e,t,i,r=di(Error(o(421))))}return"$?"===a.data?(t.flags|=128,t.child=e.child,t=Tc.bind(null,e),a._reactRetry=t,null):(e=s.treeContext,ro=ca(a.nextSibling),no=t,ao=!0,oo=null,null!==e&&(Va[Ka++]=Ya,Va[Ka++]=Za,Va[Ka++]=Qa,Ya=e.id,Za=e.overflow,Qa=t),t=Bi(t,r.children),t.flags|=4096,t)}(e,t,l,a,r,s,n);if(i){i=a.fallback,l=t.mode,r=(s=e.child).sibling;var c={mode:"hidden",children:a.children};return 0==(1&l)&&t.child!==s?((a=t.child).childLanes=0,a.pendingProps=c,t.deletions=null):(a=Oc(s,c)).subtreeFlags=14680064&s.subtreeFlags,null!==r?i=Oc(r,i):(i=Ic(i,l,n,null)).flags|=2,i.return=t,a.return=t,a.sibling=i,t.child=a,a=i,i=t.child,l=null===(l=e.child.memoizedState)?Mi(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},i.memoizedState=l,i.childLanes=e.childLanes&~n,t.memoizedState=Ii,a}return e=(i=e.child).sibling,a=Oc(i,{mode:"visible",children:a.children}),0==(1&t.mode)&&(a.lanes=n),a.return=t,a.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=a,t.memoizedState=null,a}function Bi(e,t){return(t=Mc({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function zi(e,t,n,r){return null!==r&&mo(r),Zo(t,e.child,null,n),(e=Bi(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function $i(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),_o(e.return,t,n)}function Ui(e,t,n,r,a){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=a)}function qi(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(xi(e,t,r.children,n),0!=(2&(r=ls.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&$i(e,n,t);else if(19===e.tag)$i(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ea(ls,r),0==(1&t.mode))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===cs(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Ui(t,!1,a,n,o);break;case"backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===cs(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Ui(t,!0,n,null,o);break;case"together":Ui(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Hi(e,t){0==(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Gi(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Ml|=t.lanes,0==(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(n=Oc(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Oc(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Wi(e,t){if(!ao)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Vi(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=14680064&a.subtreeFlags,r|=14680064&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ki(e,t,n){var r=t.pendingProps;switch(to(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vi(t),null;case 1:case 17:return La(t.type)&&Na(),Vi(t),null;case 3:return r=t.stateNode,os(),Sa(Aa),Sa(Ta),ds(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(po(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,null!==oo&&(ic(oo),oo=null))),Ni(e,t),Vi(t),null;case 5:is(t);var a=rs(ns.current);if(n=t.type,null!==e&&null!=t.stateNode)Oi(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(o(166));return Vi(t),null}if(e=rs(es.current),po(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[pa]=t,r[ga]=s,e=0!=(1&t.mode),n){case"dialog":Br("cancel",r),Br("close",r);break;case"iframe":case"object":case"embed":Br("load",r);break;case"video":case"audio":for(a=0;a<Dr.length;a++)Br(Dr[a],r);break;case"source":Br("error",r);break;case"img":case"image":case"link":Br("error",r),Br("load",r);break;case"details":Br("toggle",r);break;case"input":Y(r,s),Br("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Br("invalid",r);break;case"textarea":ae(r,s),Br("invalid",r)}for(var l in ve(n,s),a=null,s)if(s.hasOwnProperty(l)){var c=s[l];"children"===l?"string"==typeof c?r.textContent!==c&&(!0!==s.suppressHydrationWarning&&Xr(r.textContent,c,e),a=["children",c]):"number"==typeof c&&r.textContent!==""+c&&(!0!==s.suppressHydrationWarning&&Xr(r.textContent,c,e),a=["children",""+c]):i.hasOwnProperty(l)&&null!=c&&"onScroll"===l&&Br("scroll",r)}switch(n){case"input":W(r),J(r,s,!0);break;case"textarea":W(r),se(r);break;case"select":case"option":break;default:"function"==typeof s.onClick&&(r.onclick=Jr)}r=a,t.updateQueue=r,null!==r&&(t.flags|=4)}else{l=9===a.nodeType?a:a.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=ie(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=l.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),"select"===n&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[pa]=t,e[ga]=r,Li(e,t,!1,!1),t.stateNode=e;e:{switch(l=ye(n,r),n){case"dialog":Br("cancel",e),Br("close",e),a=r;break;case"iframe":case"object":case"embed":Br("load",e),a=r;break;case"video":case"audio":for(a=0;a<Dr.length;a++)Br(Dr[a],e);a=r;break;case"source":Br("error",e),a=r;break;case"img":case"image":case"link":Br("error",e),Br("load",e),a=r;break;case"details":Br("toggle",e),a=r;break;case"input":Y(e,r),a=Q(e,r),Br("invalid",e);break;case"option":default:a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=M({},r,{value:void 0}),Br("invalid",e);break;case"textarea":ae(e,r),a=re(e,r),Br("invalid",e)}for(s in ve(n,a),c=a)if(c.hasOwnProperty(s)){var u=c[s];"style"===s?he(e,u):"dangerouslySetInnerHTML"===s?null!=(u=u?u.__html:void 0)&&de(e,u):"children"===s?"string"==typeof u?("textarea"!==n||""!==u)&&pe(e,u):"number"==typeof u&&pe(e,""+u):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(i.hasOwnProperty(s)?null!=u&&"onScroll"===s&&Br("scroll",e):null!=u&&y(e,s,u,l))}switch(n){case"input":W(e),J(e,r,!1);break;case"textarea":W(e),se(e);break;case"option":null!=r.value&&e.setAttribute("value",""+H(r.value));break;case"select":e.multiple=!!r.multiple,null!=(s=r.value)?ne(e,!!r.multiple,s,!1):null!=r.defaultValue&&ne(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=Jr)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Vi(t),null;case 6:if(e&&null!=t.stateNode)Di(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(o(166));if(n=rs(ns.current),rs(es.current),po(t)){if(r=t.stateNode,n=t.memoizedProps,r[pa]=t,(s=r.nodeValue!==n)&&null!==(e=no))switch(e.tag){case 3:Xr(r.nodeValue,n,0!=(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Xr(r.nodeValue,n,0!=(1&e.mode))}s&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[pa]=t,t.stateNode=r}return Vi(t),null;case 13:if(Sa(ls),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(ao&&null!==ro&&0!=(1&t.mode)&&0==(128&t.flags))go(),fo(),t.flags|=98560,s=!1;else if(s=po(t),null!==r&&null!==r.dehydrated){if(null===e){if(!s)throw Error(o(318));if(!(s=null!==(s=t.memoizedState)?s.dehydrated:null))throw Error(o(317));s[pa]=t}else fo(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Vi(t),s=!1}else null!==oo&&(ic(oo),oo=null),s=!0;if(!s)return 65536&t.flags?t:null}return 0!=(128&t.flags)?(t.lanes=n,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,0!=(1&t.mode)&&(null===e||0!=(1&ls.current)?0===Dl&&(Dl=3):hc())),null!==t.updateQueue&&(t.flags|=4),Vi(t),null);case 4:return os(),Ni(e,t),null===e&&Ur(t.stateNode.containerInfo),Vi(t),null;case 10:return jo(t.type._context),Vi(t),null;case 19:if(Sa(ls),null===(s=t.memoizedState))return Vi(t),null;if(r=0!=(128&t.flags),null===(l=s.rendering))if(r)Wi(s,!1);else{if(0!==Dl||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(l=cs(e))){for(t.flags|=128,Wi(s,!1),null!==(r=l.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(s=n).flags&=14680066,null===(l=s.alternate)?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,e=l.dependencies,s.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ea(ls,1&ls.current|2),t.child}e=e.sibling}null!==s.tail&&Ze()>ql&&(t.flags|=128,r=!0,Wi(s,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=cs(l))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Wi(s,!0),null===s.tail&&"hidden"===s.tailMode&&!l.alternate&&!ao)return Vi(t),null}else 2*Ze()-s.renderingStartTime>ql&&1073741824!==n&&(t.flags|=128,r=!0,Wi(s,!1),t.lanes=4194304);s.isBackwards?(l.sibling=t.child,t.child=l):(null!==(n=s.last)?n.sibling=l:t.child=l,s.last=l)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ze(),t.sibling=null,n=ls.current,Ea(ls,r?1&n|2:1&n),t):(Vi(t),null);case 22:case 23:return pc(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&0!=(1&t.mode)?0!=(1073741824&Nl)&&(Vi(t),6&t.subtreeFlags&&(t.flags|=8192)):Vi(t),null;case 24:case 25:return null}throw Error(o(156,t.tag))}function Qi(e,t){switch(to(t),t.tag){case 1:return La(t.type)&&Na(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return os(),Sa(Aa),Sa(Ta),ds(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return is(t),null;case 13:if(Sa(ls),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(o(340));fo()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Sa(ls),null;case 4:return os(),null;case 10:return jo(t.type._context),null;case 22:case 23:return pc(),null;default:return null}}Li=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ni=function(){},Oi=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,rs(es.current);var o,s=null;switch(n){case"input":a=Q(e,a),r=Q(e,r),s=[];break;case"select":a=M({},a,{value:void 0}),r=M({},r,{value:void 0}),s=[];break;case"textarea":a=re(e,a),r=re(e,r),s=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(e.onclick=Jr)}for(u in ve(n,r),n=null,a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&null!=a[u])if("style"===u){var l=a[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(i.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=null!=a?a[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(null!=c||null!=l))if("style"===u)if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(s||(s=[]),s.push(u,n)),n=c;else"dangerouslySetInnerHTML"===u?(c=c?c.__html:void 0,l=l?l.__html:void 0,null!=c&&l!==c&&(s=s||[]).push(u,c)):"children"===u?"string"!=typeof c&&"number"!=typeof c||(s=s||[]).push(u,""+c):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(i.hasOwnProperty(u)?(null!=c&&"onScroll"===u&&Br("scroll",e),s||l===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}},Di=function(e,t,n,r){n!==r&&(t.flags|=4)};var Yi=!1,Zi=!1,Xi="function"==typeof WeakSet?WeakSet:Set,Ji=null;function el(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(r){Sc(e,t,r)}else n.current=null}function tl(e,t,n){try{n()}catch(r){Sc(e,t,r)}}var nl=!1;function rl(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var a=r=r.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,void 0!==o&&tl(t,n,o)}a=a.next}while(a!==r)}}function al(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ol(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function sl(e){var t=e.alternate;null!==t&&(e.alternate=null,sl(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[pa],delete t[ga],delete t[ma],delete t[ha],delete t[ba])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function il(e){return 5===e.tag||3===e.tag||4===e.tag}function ll(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||il(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function cl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Jr));else if(4!==r&&null!==(e=e.child))for(cl(e,t,n),e=e.sibling;null!==e;)cl(e,t,n),e=e.sibling}function ul(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(ul(e,t,n),e=e.sibling;null!==e;)ul(e,t,n),e=e.sibling}var dl=null,pl=!1;function gl(e,t,n){for(n=n.child;null!==n;)fl(e,t,n),n=n.sibling}function fl(e,t,n){if(ot&&"function"==typeof ot.onCommitFiberUnmount)try{ot.onCommitFiberUnmount(at,n)}catch(i){}switch(n.tag){case 5:Zi||el(n,t);case 6:var r=dl,a=pl;dl=null,gl(e,t,n),pl=a,null!==(dl=r)&&(pl?(e=dl,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):dl.removeChild(n.stateNode));break;case 18:null!==dl&&(pl?(e=dl,n=n.stateNode,8===e.nodeType?la(e.parentNode,n):1===e.nodeType&&la(e,n),Ut(e)):la(dl,n.stateNode));break;case 4:r=dl,a=pl,dl=n.stateNode.containerInfo,pl=!0,gl(e,t,n),dl=r,pl=a;break;case 0:case 11:case 14:case 15:if(!Zi&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){a=r=r.next;do{var o=a,s=o.destroy;o=o.tag,void 0!==s&&(0!=(2&o)||0!=(4&o))&&tl(n,t,s),a=a.next}while(a!==r)}gl(e,t,n);break;case 1:if(!Zi&&(el(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(i){Sc(n,t,i)}gl(e,t,n);break;case 21:gl(e,t,n);break;case 22:1&n.mode?(Zi=(r=Zi)||null!==n.memoizedState,gl(e,t,n),Zi=r):gl(e,t,n);break;default:gl(e,t,n)}}function ml(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Xi),t.forEach((function(t){var r=Ac.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function hl(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var a=n[r];try{var s=e,i=t,l=i;e:for(;null!==l;){switch(l.tag){case 5:dl=l.stateNode,pl=!1;break e;case 3:case 4:dl=l.stateNode.containerInfo,pl=!0;break e}l=l.return}if(null===dl)throw Error(o(160));fl(s,i,a),dl=null,pl=!1;var c=a.alternate;null!==c&&(c.return=null),a.return=null}catch(u){Sc(a,t,u)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)bl(t,e),t=t.sibling}function bl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(hl(t,e),vl(e),4&r){try{rl(3,e,e.return),al(3,e)}catch(h){Sc(e,e.return,h)}try{rl(5,e,e.return)}catch(h){Sc(e,e.return,h)}}break;case 1:hl(t,e),vl(e),512&r&&null!==n&&el(n,n.return);break;case 5:if(hl(t,e),vl(e),512&r&&null!==n&&el(n,n.return),32&e.flags){var a=e.stateNode;try{pe(a,"")}catch(h){Sc(e,e.return,h)}}if(4&r&&null!=(a=e.stateNode)){var s=e.memoizedProps,i=null!==n?n.memoizedProps:s,l=e.type,c=e.updateQueue;if(e.updateQueue=null,null!==c)try{"input"===l&&"radio"===s.type&&null!=s.name&&Z(a,s),ye(l,i);var u=ye(l,s);for(i=0;i<c.length;i+=2){var d=c[i],p=c[i+1];"style"===d?he(a,p):"dangerouslySetInnerHTML"===d?de(a,p):"children"===d?pe(a,p):y(a,d,p,u)}switch(l){case"input":X(a,s);break;case"textarea":oe(a,s);break;case"select":var g=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!s.multiple;var f=s.value;null!=f?ne(a,!!s.multiple,f,!1):g!==!!s.multiple&&(null!=s.defaultValue?ne(a,!!s.multiple,s.defaultValue,!0):ne(a,!!s.multiple,s.multiple?[]:"",!1))}a[ga]=s}catch(h){Sc(e,e.return,h)}}break;case 6:if(hl(t,e),vl(e),4&r){if(null===e.stateNode)throw Error(o(162));a=e.stateNode,s=e.memoizedProps;try{a.nodeValue=s}catch(h){Sc(e,e.return,h)}}break;case 3:if(hl(t,e),vl(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Ut(t.containerInfo)}catch(h){Sc(e,e.return,h)}break;case 4:default:hl(t,e),vl(e);break;case 13:hl(t,e),vl(e),8192&(a=e.child).flags&&(s=null!==a.memoizedState,a.stateNode.isHidden=s,!s||null!==a.alternate&&null!==a.alternate.memoizedState||(Ul=Ze())),4&r&&ml(e);break;case 22:if(d=null!==n&&null!==n.memoizedState,1&e.mode?(Zi=(u=Zi)||d,hl(t,e),Zi=u):hl(t,e),vl(e),8192&r){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!d&&0!=(1&e.mode))for(Ji=e,d=e.child;null!==d;){for(p=Ji=d;null!==Ji;){switch(f=(g=Ji).child,g.tag){case 0:case 11:case 14:case 15:rl(4,g,g.return);break;case 1:el(g,g.return);var m=g.stateNode;if("function"==typeof m.componentWillUnmount){r=g,n=g.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(h){Sc(r,n,h)}}break;case 5:el(g,g.return);break;case 22:if(null!==g.memoizedState){kl(p);continue}}null!==f?(f.return=g,Ji=f):kl(p)}d=d.sibling}e:for(d=null,p=e;;){if(5===p.tag){if(null===d){d=p;try{a=p.stateNode,u?"function"==typeof(s=a.style).setProperty?s.setProperty("display","none","important"):s.display="none":(l=p.stateNode,i=null!=(c=p.memoizedProps.style)&&c.hasOwnProperty("display")?c.display:null,l.style.display=me("display",i))}catch(h){Sc(e,e.return,h)}}}else if(6===p.tag){if(null===d)try{p.stateNode.nodeValue=u?"":p.memoizedProps}catch(h){Sc(e,e.return,h)}}else if((22!==p.tag&&23!==p.tag||null===p.memoizedState||p===e)&&null!==p.child){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;null===p.sibling;){if(null===p.return||p.return===e)break e;d===p&&(d=null),p=p.return}d===p&&(d=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:hl(t,e),vl(e),4&r&&ml(e);case 21:}}function vl(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(il(n)){var r=n;break e}n=n.return}throw Error(o(160))}switch(r.tag){case 5:var a=r.stateNode;32&r.flags&&(pe(a,""),r.flags&=-33),ul(e,ll(e),a);break;case 3:case 4:var s=r.stateNode.containerInfo;cl(e,ll(e),s);break;default:throw Error(o(161))}}catch(i){Sc(e,e.return,i)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function yl(e,t,n){Ji=e,wl(e,t,n)}function wl(e,t,n){for(var r=0!=(1&e.mode);null!==Ji;){var a=Ji,o=a.child;if(22===a.tag&&r){var s=null!==a.memoizedState||Yi;if(!s){var i=a.alternate,l=null!==i&&null!==i.memoizedState||Zi;i=Yi;var c=Zi;if(Yi=s,(Zi=l)&&!c)for(Ji=a;null!==Ji;)l=(s=Ji).child,22===s.tag&&null!==s.memoizedState?jl(a):null!==l?(l.return=s,Ji=l):jl(a);for(;null!==o;)Ji=o,wl(o,t,n),o=o.sibling;Ji=a,Yi=i,Zi=c}xl(e)}else 0!=(8772&a.subtreeFlags)&&null!==o?(o.return=a,Ji=o):xl(e)}}function xl(e){for(;null!==Ji;){var t=Ji;if(0!=(8772&t.flags)){var n=t.alternate;try{if(0!=(8772&t.flags))switch(t.tag){case 0:case 11:case 15:Zi||al(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!Zi)if(null===n)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:bo(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;null!==s&&Bo(t,s,r);break;case 3:var i=t.updateQueue;if(null!==i){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Bo(t,i,n)}break;case 5:var l=t.stateNode;if(null===n&&4&t.flags){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var d=u.memoizedState;if(null!==d){var p=d.dehydrated;null!==p&&Ut(p)}}}break;default:throw Error(o(163))}Zi||512&t.flags&&ol(t)}catch(g){Sc(t,t.return,g)}}if(t===e){Ji=null;break}if(null!==(n=t.sibling)){n.return=t.return,Ji=n;break}Ji=t.return}}function kl(e){for(;null!==Ji;){var t=Ji;if(t===e){Ji=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Ji=n;break}Ji=t.return}}function jl(e){for(;null!==Ji;){var t=Ji;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{al(4,t)}catch(l){Sc(t,n,l)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var a=t.return;try{r.componentDidMount()}catch(l){Sc(t,a,l)}}var o=t.return;try{ol(t)}catch(l){Sc(t,o,l)}break;case 5:var s=t.return;try{ol(t)}catch(l){Sc(t,s,l)}}}catch(l){Sc(t,t.return,l)}if(t===e){Ji=null;break}var i=t.sibling;if(null!==i){i.return=t.return,Ji=i;break}Ji=t.return}}var _l,Sl=Math.ceil,El=w.ReactCurrentDispatcher,Cl=w.ReactCurrentOwner,Tl=w.ReactCurrentBatchConfig,Al=0,Pl=null,Rl=null,Ll=0,Nl=0,Ol=_a(0),Dl=0,Il=null,Ml=0,Fl=0,Bl=0,zl=null,$l=null,Ul=0,ql=1/0,Hl=null,Gl=!1,Wl=null,Vl=null,Kl=!1,Ql=null,Yl=0,Zl=0,Xl=null,Jl=-1,ec=0;function tc(){return 0!=(6&Al)?Ze():-1!==Jl?Jl:Jl=Ze()}function nc(e){return 0==(1&e.mode)?1:0!=(2&Al)&&0!==Ll?Ll&-Ll:null!==ho.transition?(0===ec&&(ec=mt()),ec):0!==(e=yt)?e:e=void 0===(e=window.event)?16:Yt(e.type)}function rc(e,t,n,r){if(50<Zl)throw Zl=0,Xl=null,Error(o(185));bt(e,n,r),0!=(2&Al)&&e===Pl||(e===Pl&&(0==(2&Al)&&(Fl|=n),4===Dl&&lc(e,Ll)),ac(e,r),1===n&&0===Al&&0==(1&t.mode)&&(ql=Ze()+500,Ba&&Ua()))}function ac(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes;0<o;){var s=31-st(o),i=1<<s,l=a[s];-1===l?0!=(i&n)&&0==(i&r)||(a[s]=gt(i,t)):l<=t&&(e.expiredLanes|=i),o&=~i}}(e,t);var r=pt(e,e===Pl?Ll:0);if(0===r)null!==n&&Ke(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ke(n),1===t)0===e.tag?function(e){Ba=!0,$a(e)}(cc.bind(null,e)):$a(cc.bind(null,e)),sa((function(){0==(6&Al)&&Ua()})),n=null;else{switch(wt(r)){case 1:n=Je;break;case 4:n=et;break;case 16:default:n=tt;break;case 536870912:n=rt}n=Pc(n,oc.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function oc(e,t){if(Jl=-1,ec=0,0!=(6&Al))throw Error(o(327));var n=e.callbackNode;if(jc()&&e.callbackNode!==n)return null;var r=pt(e,e===Pl?Ll:0);if(0===r)return null;if(0!=(30&r)||0!=(r&e.expiredLanes)||t)t=bc(e,r);else{t=r;var a=Al;Al|=2;var s=mc();for(Pl===e&&Ll===t||(Hl=null,ql=Ze()+500,gc(e,t));;)try{yc();break}catch(l){fc(e,l)}ko(),El.current=s,Al=a,null!==Rl?t=0:(Pl=null,Ll=0,t=Dl)}if(0!==t){if(2===t&&(0!==(a=ft(e))&&(r=a,t=sc(e,a))),1===t)throw n=Il,gc(e,0),lc(e,r),ac(e,Ze()),n;if(6===t)lc(e,r);else{if(a=e.current.alternate,0==(30&r)&&!function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var a=n[r],o=a.getSnapshot;a=a.value;try{if(!ir(o(),a))return!1}catch(i){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(a)&&(2===(t=bc(e,r))&&(0!==(s=ft(e))&&(r=s,t=sc(e,s))),1===t))throw n=Il,gc(e,0),lc(e,r),ac(e,Ze()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(o(345));case 2:case 5:kc(e,$l,Hl);break;case 3:if(lc(e,r),(130023424&r)===r&&10<(t=Ul+500-Ze())){if(0!==pt(e,0))break;if(((a=e.suspendedLanes)&r)!==r){tc(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=ra(kc.bind(null,e,$l,Hl),t);break}kc(e,$l,Hl);break;case 4:if(lc(e,r),(4194240&r)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-st(r);s=1<<i,(i=t[i])>a&&(a=i),r&=~s}if(r=a,10<(r=(120>(r=Ze()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Sl(r/1960))-r)){e.timeoutHandle=ra(kc.bind(null,e,$l,Hl),r);break}kc(e,$l,Hl);break;default:throw Error(o(329))}}}return ac(e,Ze()),e.callbackNode===n?oc.bind(null,e):null}function sc(e,t){var n=zl;return e.current.memoizedState.isDehydrated&&(gc(e,t).flags|=256),2!==(e=bc(e,t))&&(t=$l,$l=n,null!==t&&ic(t)),e}function ic(e){null===$l?$l=e:$l.push.apply($l,e)}function lc(e,t){for(t&=~Bl,t&=~Fl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-st(t),r=1<<n;e[n]=-1,t&=~r}}function cc(e){if(0!=(6&Al))throw Error(o(327));jc();var t=pt(e,0);if(0==(1&t))return ac(e,Ze()),null;var n=bc(e,t);if(0!==e.tag&&2===n){var r=ft(e);0!==r&&(t=r,n=sc(e,r))}if(1===n)throw n=Il,gc(e,0),lc(e,t),ac(e,Ze()),n;if(6===n)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,kc(e,$l,Hl),ac(e,Ze()),null}function uc(e,t){var n=Al;Al|=1;try{return e(t)}finally{0===(Al=n)&&(ql=Ze()+500,Ba&&Ua())}}function dc(e){null!==Ql&&0===Ql.tag&&0==(6&Al)&&jc();var t=Al;Al|=1;var n=Tl.transition,r=yt;try{if(Tl.transition=null,yt=1,e)return e()}finally{yt=r,Tl.transition=n,0==(6&(Al=t))&&Ua()}}function pc(){Nl=Ol.current,Sa(Ol)}function gc(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,aa(n)),null!==Rl)for(n=Rl.return;null!==n;){var r=n;switch(to(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&Na();break;case 3:os(),Sa(Aa),Sa(Ta),ds();break;case 5:is(r);break;case 4:os();break;case 13:case 19:Sa(ls);break;case 10:jo(r.type._context);break;case 22:case 23:pc()}n=n.return}if(Pl=e,Rl=e=Oc(e.current,null),Ll=Nl=t,Dl=0,Il=null,Bl=Fl=Ml=0,$l=zl=null,null!==Co){for(t=0;t<Co.length;t++)if(null!==(r=(n=Co[t]).interleaved)){n.interleaved=null;var a=r.next,o=n.pending;if(null!==o){var s=o.next;o.next=a,r.next=s}n.pending=r}Co=null}return e}function fc(e,t){for(;;){var n=Rl;try{if(ko(),ps.current=si,vs){for(var r=ms.memoizedState;null!==r;){var a=r.queue;null!==a&&(a.pending=null),r=r.next}vs=!1}if(fs=0,bs=hs=ms=null,ys=!1,ws=0,Cl.current=null,null===n||null===n.return){Dl=1,Il=t,Rl=null;break}e:{var s=e,i=n.return,l=n,c=t;if(t=Ll,l.flags|=32768,null!==c&&"object"==typeof c&&"function"==typeof c.then){var u=c,d=l,p=d.tag;if(0==(1&d.mode)&&(0===p||11===p||15===p)){var g=d.alternate;g?(d.updateQueue=g.updateQueue,d.memoizedState=g.memoizedState,d.lanes=g.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=bi(i);if(null!==f){f.flags&=-257,vi(f,i,l,0,t),1&f.mode&&hi(s,u,t),c=u;var m=(t=f).updateQueue;if(null===m){var h=new Set;h.add(c),t.updateQueue=h}else m.add(c);break e}if(0==(1&t)){hi(s,u,t),hc();break e}c=Error(o(426))}else if(ao&&1&l.mode){var b=bi(i);if(null!==b){0==(65536&b.flags)&&(b.flags|=256),vi(b,i,l,0,t),mo(ui(c,l));break e}}s=c=ui(c,l),4!==Dl&&(Dl=2),null===zl?zl=[s]:zl.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t,Mo(s,fi(0,c,t));break e;case 1:l=c;var v=s.type,y=s.stateNode;if(0==(128&s.flags)&&("function"==typeof v.getDerivedStateFromError||null!==y&&"function"==typeof y.componentDidCatch&&(null===Vl||!Vl.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t,Mo(s,mi(s,l,t));break e}}s=s.return}while(null!==s)}xc(n)}catch(w){t=w,Rl===n&&null!==n&&(Rl=n=n.return);continue}break}}function mc(){var e=El.current;return El.current=si,null===e?si:e}function hc(){0!==Dl&&3!==Dl&&2!==Dl||(Dl=4),null===Pl||0==(268435455&Ml)&&0==(268435455&Fl)||lc(Pl,Ll)}function bc(e,t){var n=Al;Al|=2;var r=mc();for(Pl===e&&Ll===t||(Hl=null,gc(e,t));;)try{vc();break}catch(a){fc(e,a)}if(ko(),Al=n,El.current=r,null!==Rl)throw Error(o(261));return Pl=null,Ll=0,Dl}function vc(){for(;null!==Rl;)wc(Rl)}function yc(){for(;null!==Rl&&!Qe();)wc(Rl)}function wc(e){var t=_l(e.alternate,e,Nl);e.memoizedProps=e.pendingProps,null===t?xc(e):Rl=t,Cl.current=null}function xc(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(32768&t.flags)){if(null!==(n=Ki(n,t,Nl)))return void(Rl=n)}else{if(null!==(n=Qi(n,t)))return n.flags&=32767,void(Rl=n);if(null===e)return Dl=6,void(Rl=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(Rl=t);Rl=t=e}while(null!==t);0===Dl&&(Dl=5)}function kc(e,t,n){var r=yt,a=Tl.transition;try{Tl.transition=null,yt=1,function(e,t,n,r){do{jc()}while(null!==Ql);if(0!=(6&Al))throw Error(o(327));n=e.finishedWork;var a=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(o(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-st(n),o=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~o}}(e,s),e===Pl&&(Rl=Pl=null,Ll=0),0==(2064&n.subtreeFlags)&&0==(2064&n.flags)||Kl||(Kl=!0,Pc(tt,(function(){return jc(),null}))),s=0!=(15990&n.flags),0!=(15990&n.subtreeFlags)||s){s=Tl.transition,Tl.transition=null;var i=yt;yt=1;var l=Al;Al|=4,Cl.current=null,function(e,t){if(ea=Ht,gr(e=pr())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var a=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch(x){n=null;break e}var i=0,l=-1,c=-1,u=0,d=0,p=e,g=null;t:for(;;){for(var f;p!==n||0!==a&&3!==p.nodeType||(l=i+a),p!==s||0!==r&&3!==p.nodeType||(c=i+r),3===p.nodeType&&(i+=p.nodeValue.length),null!==(f=p.firstChild);)g=p,p=f;for(;;){if(p===e)break t;if(g===n&&++u===a&&(l=i),g===s&&++d===r&&(c=i),null!==(f=p.nextSibling))break;g=(p=g).parentNode}p=f}n=-1===l||-1===c?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ta={focusedElem:e,selectionRange:n},Ht=!1,Ji=t;null!==Ji;)if(e=(t=Ji).child,0!=(1028&t.subtreeFlags)&&null!==e)e.return=t,Ji=e;else for(;null!==Ji;){t=Ji;try{var m=t.alternate;if(0!=(1024&t.flags))switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==m){var h=m.memoizedProps,b=m.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?h:bo(t.type,h),b);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=t.stateNode.containerInfo;1===w.nodeType?w.textContent="":9===w.nodeType&&w.documentElement&&w.removeChild(w.documentElement);break;default:throw Error(o(163))}}catch(x){Sc(t,t.return,x)}if(null!==(e=t.sibling)){e.return=t.return,Ji=e;break}Ji=t.return}m=nl,nl=!1}(e,n),bl(n,e),fr(ta),Ht=!!ea,ta=ea=null,e.current=n,yl(n,e,a),Ye(),Al=l,yt=i,Tl.transition=s}else e.current=n;if(Kl&&(Kl=!1,Ql=e,Yl=a),s=e.pendingLanes,0===s&&(Vl=null),function(e){if(ot&&"function"==typeof ot.onCommitFiberRoot)try{ot.onCommitFiberRoot(at,e,void 0,128==(128&e.current.flags))}catch(t){}}(n.stateNode),ac(e,Ze()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(Gl)throw Gl=!1,e=Wl,Wl=null,e;0!=(1&Yl)&&0!==e.tag&&jc(),s=e.pendingLanes,0!=(1&s)?e===Xl?Zl++:(Zl=0,Xl=e):Zl=0,Ua()}(e,t,n,r)}finally{Tl.transition=a,yt=r}return null}function jc(){if(null!==Ql){var e=wt(Yl),t=Tl.transition,n=yt;try{if(Tl.transition=null,yt=16>e?16:e,null===Ql)var r=!1;else{if(e=Ql,Ql=null,Yl=0,0!=(6&Al))throw Error(o(331));var a=Al;for(Al|=4,Ji=e.current;null!==Ji;){var s=Ji,i=s.child;if(0!=(16&Ji.flags)){var l=s.deletions;if(null!==l){for(var c=0;c<l.length;c++){var u=l[c];for(Ji=u;null!==Ji;){var d=Ji;switch(d.tag){case 0:case 11:case 15:rl(8,d,s)}var p=d.child;if(null!==p)p.return=d,Ji=p;else for(;null!==Ji;){var g=(d=Ji).sibling,f=d.return;if(sl(d),d===u){Ji=null;break}if(null!==g){g.return=f,Ji=g;break}Ji=f}}}var m=s.alternate;if(null!==m){var h=m.child;if(null!==h){m.child=null;do{var b=h.sibling;h.sibling=null,h=b}while(null!==h)}}Ji=s}}if(0!=(2064&s.subtreeFlags)&&null!==i)i.return=s,Ji=i;else e:for(;null!==Ji;){if(0!=(2048&(s=Ji).flags))switch(s.tag){case 0:case 11:case 15:rl(9,s,s.return)}var v=s.sibling;if(null!==v){v.return=s.return,Ji=v;break e}Ji=s.return}}var y=e.current;for(Ji=y;null!==Ji;){var w=(i=Ji).child;if(0!=(2064&i.subtreeFlags)&&null!==w)w.return=i,Ji=w;else e:for(i=y;null!==Ji;){if(0!=(2048&(l=Ji).flags))try{switch(l.tag){case 0:case 11:case 15:al(9,l)}}catch(k){Sc(l,l.return,k)}if(l===i){Ji=null;break e}var x=l.sibling;if(null!==x){x.return=l.return,Ji=x;break e}Ji=l.return}}if(Al=a,Ua(),ot&&"function"==typeof ot.onPostCommitFiberRoot)try{ot.onPostCommitFiberRoot(at,e)}catch(k){}r=!0}return r}finally{yt=n,Tl.transition=t}}return!1}function _c(e,t,n){e=Do(e,t=fi(0,t=ui(n,t),1),1),t=tc(),null!==e&&(bt(e,1,t),ac(e,t))}function Sc(e,t,n){if(3===e.tag)_c(e,e,n);else for(;null!==t;){if(3===t.tag){_c(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Vl||!Vl.has(r))){t=Do(t,e=mi(t,e=ui(n,e),1),1),e=tc(),null!==t&&(bt(t,1,e),ac(t,e));break}}t=t.return}}function Ec(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=tc(),e.pingedLanes|=e.suspendedLanes&n,Pl===e&&(Ll&n)===n&&(4===Dl||3===Dl&&(130023424&Ll)===Ll&&500>Ze()-Ul?gc(e,0):Bl|=n),ac(e,t)}function Cc(e,t){0===t&&(0==(1&e.mode)?t=1:(t=ut,0==(130023424&(ut<<=1))&&(ut=4194304)));var n=tc();null!==(e=Po(e,t))&&(bt(e,t,n),ac(e,n))}function Tc(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Cc(e,n)}function Ac(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(o(314))}null!==r&&r.delete(t),Cc(e,n)}function Pc(e,t){return Ve(e,t)}function Rc(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Lc(e,t,n,r){return new Rc(e,t,n,r)}function Nc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Oc(e,t){var n=e.alternate;return null===n?((n=Lc(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Dc(e,t,n,r,a,s){var i=2;if(r=e,"function"==typeof e)Nc(e)&&(i=1);else if("string"==typeof e)i=5;else e:switch(e){case j:return Ic(n.children,a,s,t);case _:i=8,a|=8;break;case S:return(e=Lc(12,n,t,2|a)).elementType=S,e.lanes=s,e;case A:return(e=Lc(13,n,t,a)).elementType=A,e.lanes=s,e;case P:return(e=Lc(19,n,t,a)).elementType=P,e.lanes=s,e;case N:return Mc(n,a,s,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case E:i=10;break e;case C:i=9;break e;case T:i=11;break e;case R:i=14;break e;case L:i=16,r=null;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=Lc(i,n,t,a)).elementType=e,t.type=r,t.lanes=s,t}function Ic(e,t,n,r){return(e=Lc(7,e,r,t)).lanes=n,e}function Mc(e,t,n,r){return(e=Lc(22,e,r,t)).elementType=N,e.lanes=n,e.stateNode={isHidden:!1},e}function Fc(e,t,n){return(e=Lc(6,e,null,t)).lanes=n,e}function Bc(e,t,n){return(t=Lc(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function zc(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ht(0),this.expirationTimes=ht(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ht(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function $c(e,t,n,r,a,o,s,i,l){return e=new zc(e,t,n,i,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=Lc(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lo(o),e}function Uc(e){if(!e)return Ca;e:{if(Ue(e=e._reactInternals)!==e||1!==e.tag)throw Error(o(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(La(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(o(171))}if(1===e.tag){var n=e.type;if(La(n))return Da(e,n,t)}return t}function qc(e,t,n,r,a,o,s,i,l){return(e=$c(n,r,!0,e,0,o,0,i,l)).context=Uc(null),n=e.current,(o=Oo(r=tc(),a=nc(n))).callback=null!=t?t:null,Do(n,o,a),e.current.lanes=a,bt(e,a,r),ac(e,r),e}function Hc(e,t,n,r){var a=t.current,o=tc(),s=nc(a);return n=Uc(n),null===t.context?t.context=n:t.pendingContext=n,(t=Oo(o,s)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Do(a,t,s))&&(rc(e,a,s,o),Io(e,a,s)),s}function Gc(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Wc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Vc(e,t){Wc(e,t),(e=e.alternate)&&Wc(e,t)}_l=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||Aa.current)wi=!0;else{if(0==(e.lanes&n)&&0==(128&t.flags))return wi=!1,function(e,t,n){switch(t.tag){case 3:Pi(t),fo();break;case 5:ss(t);break;case 1:La(t.type)&&Ia(t);break;case 4:as(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;Ea(vo,r._currentValue),r._currentValue=a;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(Ea(ls,1&ls.current),t.flags|=128,null):0!=(n&t.child.childLanes)?Fi(e,t,n):(Ea(ls,1&ls.current),null!==(e=Gi(e,t,n))?e.sibling:null);Ea(ls,1&ls.current);break;case 19:if(r=0!=(n&t.childLanes),0!=(128&e.flags)){if(r)return qi(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),Ea(ls,ls.current),r)break;return null;case 22:case 23:return t.lanes=0,Si(e,t,n)}return Gi(e,t,n)}(e,t,n);wi=0!=(131072&e.flags)}else wi=!1,ao&&0!=(1048576&t.flags)&&Ja(t,Wa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hi(e,t),e=t.pendingProps;var a=Ra(t,Ta.current);So(t,n),a=_s(null,t,r,e,a,n);var s=Ss();return t.flags|=1,"object"==typeof a&&null!==a&&"function"==typeof a.render&&void 0===a.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,La(r)?(s=!0,Ia(t)):s=!1,t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,Lo(t),a.updater=Uo,t.stateNode=a,a._reactInternals=t,Wo(t,r,e,n),t=Ai(null,t,r,!0,s,n)):(t.tag=0,ao&&s&&eo(t),xi(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hi(e,t),e=t.pendingProps,r=(a=r._init)(r._payload),t.type=r,a=t.tag=function(e){if("function"==typeof e)return Nc(e)?1:0;if(null!=e){if((e=e.$$typeof)===T)return 11;if(e===R)return 14}return 2}(r),e=bo(r,e),a){case 0:t=Ci(null,t,r,e,n);break e;case 1:t=Ti(null,t,r,e,n);break e;case 11:t=ki(null,t,r,e,n);break e;case 14:t=ji(null,t,r,bo(r.type,e),n);break e}throw Error(o(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,Ci(e,t,r,a=t.elementType===r?a:bo(r,a),n);case 1:return r=t.type,a=t.pendingProps,Ti(e,t,r,a=t.elementType===r?a:bo(r,a),n);case 3:e:{if(Pi(t),null===e)throw Error(o(387));r=t.pendingProps,a=(s=t.memoizedState).element,No(e,t),Fo(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated){if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,256&t.flags){t=Ri(e,t,r,n,a=ui(Error(o(423)),t));break e}if(r!==a){t=Ri(e,t,r,n,a=ui(Error(o(424)),t));break e}for(ro=ca(t.stateNode.containerInfo.firstChild),no=t,ao=!0,oo=null,n=Xo(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(fo(),r===a){t=Gi(e,t,n);break e}xi(e,t,r,n)}t=t.child}return t;case 5:return ss(t),null===e&&co(t),r=t.type,a=t.pendingProps,s=null!==e?e.memoizedProps:null,i=a.children,na(r,a)?i=null:null!==s&&na(r,s)&&(t.flags|=32),Ei(e,t),xi(e,t,i,n),t.child;case 6:return null===e&&co(t),null;case 13:return Fi(e,t,n);case 4:return as(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Zo(t,null,r,n):xi(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,ki(e,t,r,a=t.elementType===r?a:bo(r,a),n);case 7:return xi(e,t,t.pendingProps,n),t.child;case 8:case 12:return xi(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,s=t.memoizedProps,i=a.value,Ea(vo,r._currentValue),r._currentValue=i,null!==s)if(ir(s.value,i)){if(s.children===a.children&&!Aa.current){t=Gi(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var l=s.dependencies;if(null!==l){i=s.child;for(var c=l.firstContext;null!==c;){if(c.context===r){if(1===s.tag){(c=Oo(-1,n&-n)).tag=2;var u=s.updateQueue;if(null!==u){var d=(u=u.shared).pending;null===d?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,null!==(c=s.alternate)&&(c.lanes|=n),_o(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(10===s.tag)i=s.type===t.type?null:s.child;else if(18===s.tag){if(null===(i=s.return))throw Error(o(341));i.lanes|=n,null!==(l=i.alternate)&&(l.lanes|=n),_o(i,n,t),i=s.sibling}else i=s.child;if(null!==i)i.return=s;else for(i=s;null!==i;){if(i===t){i=null;break}if(null!==(s=i.sibling)){s.return=i.return,i=s;break}i=i.return}s=i}xi(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,So(t,n),r=r(a=Eo(a)),t.flags|=1,xi(e,t,r,n),t.child;case 14:return a=bo(r=t.type,t.pendingProps),ji(e,t,r,a=bo(r.type,a),n);case 15:return _i(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:bo(r,a),Hi(e,t),t.tag=1,La(r)?(e=!0,Ia(t)):e=!1,So(t,n),Ho(t,r,a),Wo(t,r,a,n),Ai(null,t,r,!0,e,n);case 19:return qi(e,t,n);case 22:return Si(e,t,n)}throw Error(o(156,t.tag))};var Kc="function"==typeof reportError?reportError:function(e){console.error(e)};function Qc(e){this._internalRoot=e}function Yc(e){this._internalRoot=e}function Zc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Xc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Jc(){}function eu(e,t,n,r,a){var o=n._reactRootContainer;if(o){var s=o;if("function"==typeof a){var i=a;a=function(){var e=Gc(s);i.call(e)}}Hc(t,s,e,a)}else s=function(e,t,n,r,a){if(a){if("function"==typeof r){var o=r;r=function(){var e=Gc(s);o.call(e)}}var s=qc(t,r,e,0,null,!1,0,"",Jc);return e._reactRootContainer=s,e[fa]=s.current,Ur(8===e.nodeType?e.parentNode:e),dc(),s}for(;a=e.lastChild;)e.removeChild(a);if("function"==typeof r){var i=r;r=function(){var e=Gc(l);i.call(e)}}var l=$c(e,0,!1,null,0,!1,0,"",Jc);return e._reactRootContainer=l,e[fa]=l.current,Ur(8===e.nodeType?e.parentNode:e),dc((function(){Hc(t,l,n,r)})),l}(n,t,e,a,r);return Gc(s)}Yc.prototype.render=Qc.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(o(409));Hc(e,t,null,null)},Yc.prototype.unmount=Qc.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;dc((function(){Hc(null,e,null,null)})),t[fa]=null}},Yc.prototype.unstable_scheduleHydration=function(e){if(e){var t=_t();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Nt.length&&0!==t&&t<Nt[n].priority;n++);Nt.splice(n,0,e),0===n&&Mt(e)}},xt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=dt(t.pendingLanes);0!==n&&(vt(t,1|n),ac(t,Ze()),0==(6&Al)&&(ql=Ze()+500,Ua()))}break;case 13:dc((function(){var t=Po(e,1);if(null!==t){var n=tc();rc(t,e,1,n)}})),Vc(e,1)}},kt=function(e){if(13===e.tag){var t=Po(e,134217728);if(null!==t)rc(t,e,134217728,tc());Vc(e,134217728)}},jt=function(e){if(13===e.tag){var t=nc(e),n=Po(e,t);if(null!==n)rc(n,e,t,tc());Vc(e,t)}},_t=function(){return yt},St=function(e,t){var n=yt;try{return yt=e,t()}finally{yt=n}},ke=function(e,t,n){switch(t){case"input":if(X(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=xa(r);if(!a)throw Error(o(90));V(r),X(r,a)}}}break;case"textarea":oe(e,n);break;case"select":null!=(t=n.value)&&ne(e,!!n.multiple,t,!1)}},Te=uc,Ae=dc;var tu={usingClientEntryPoint:!1,Events:[ya,wa,xa,Ee,Ce,uc]},nu={findFiberByHostInstance:va,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},ru={bundleType:nu.bundleType,version:nu.version,rendererPackageName:nu.rendererPackageName,rendererConfig:nu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:w.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Ge(e))?null:e.stateNode},findFiberByHostInstance:nu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var au=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!au.isDisabled&&au.supportsFiber)try{at=au.inject(ru),ot=au}catch(ue){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tu,t.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Zc(t))throw Error(o(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:k,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},t.createRoot=function(e,t){if(!Zc(e))throw Error(o(299));var n=!1,r="",a=Kc;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(a=t.onRecoverableError)),t=$c(e,1,!1,null,0,n,0,r,a),e[fa]=t.current,Ur(8===e.nodeType?e.parentNode:e),new Qc(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(o(188));throw e=Object.keys(e).join(","),Error(o(268,e))}return e=null===(e=Ge(t))?null:e.stateNode},t.flushSync=function(e){return dc(e)},t.hydrate=function(e,t,n){if(!Xc(t))throw Error(o(200));return eu(null,e,t,!0,n)},t.hydrateRoot=function(e,t,n){if(!Zc(e))throw Error(o(405));var r=null!=n&&n.hydratedSources||null,a=!1,s="",i=Kc;if(null!=n&&(!0===n.unstable_strictMode&&(a=!0),void 0!==n.identifierPrefix&&(s=n.identifierPrefix),void 0!==n.onRecoverableError&&(i=n.onRecoverableError)),t=qc(t,null,e,1,null!=n?n:null,a,0,s,i),e[fa]=t.current,Ur(e),r)for(e=0;e<r.length;e++)a=(a=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new Yc(t)},t.render=function(e,t,n){if(!Xc(t))throw Error(o(200));return eu(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Xc(e))throw Error(o(40));return!!e._reactRootContainer&&(dc((function(){eu(null,null,e,!1,(function(){e._reactRootContainer=null,e[fa]=null}))})),!0)},t.unstable_batchedUpdates=uc,t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Xc(n))throw Error(o(200));if(null==e||void 0===e._reactInternals)throw Error(o(38));return eu(e,t,n,!1,r)},t.version="18.2.0-next-9e3b772b8-20220608"},5338:(e,t,n)=>{"use strict";var r=n(961);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},961:(e,t,n)=>{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(2551)},115:e=>{var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,a="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function o(e,s){if(e===s)return!0;if(e&&s&&"object"==typeof e&&"object"==typeof s){if(e.constructor!==s.constructor)return!1;var i,l,c,u;if(Array.isArray(e)){if((i=e.length)!=s.length)return!1;for(l=i;0!=l--;)if(!o(e[l],s[l]))return!1;return!0}if(n&&e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;for(u=e.entries();!(l=u.next()).done;)if(!o(l.value[1],s.get(l.value[0])))return!1;return!0}if(r&&e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(s)){if((i=e.length)!=s.length)return!1;for(l=i;0!=l--;)if(e[l]!==s[l])return!1;return!0}if(e.constructor===RegExp)return e.source===s.source&&e.flags===s.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===s.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===s.toString();if((i=(c=Object.keys(e)).length)!==Object.keys(s).length)return!1;for(l=i;0!=l--;)if(!Object.prototype.hasOwnProperty.call(s,c[l]))return!1;if(t&&e instanceof Element)return!1;for(l=i;0!=l--;)if(("_owner"!==c[l]&&"__v"!==c[l]&&"__o"!==c[l]||!e.$$typeof)&&!o(e[c[l]],s[c[l]]))return!1;return!0}return e!=e&&s!=s}e.exports=function(e,t){try{return o(e,t)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},545:(e,t,n)=>{"use strict";n.d(t,{mg:()=>J,vd:()=>G});var r=n(6540),a=n(5556),o=n.n(a),s=n(115),i=n.n(s),l=n(311),c=n.n(l),u=n(2833),d=n.n(u);function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(this,arguments)}function g(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,f(e,t)}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function m(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(a[n]=e[n]);return a}var h={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},b={rel:["amphtml","canonical","alternate"]},v={type:["application/ld+json"]},y={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},w=Object.keys(h).map((function(e){return h[e]})),x={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},k=Object.keys(x).reduce((function(e,t){return e[x[t]]=t,e}),{}),j=function(e,t){for(var n=e.length-1;n>=0;n-=1){var r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},_=function(e){var t=j(e,h.TITLE),n=j(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,(function(){return t}));var r=j(e,"defaultTitle");return t||r||void 0},S=function(e){return j(e,"onChangeClientState")||function(){}},E=function(e,t){return t.filter((function(t){return void 0!==t[e]})).map((function(t){return t[e]})).reduce((function(e,t){return p({},e,t)}),{})},C=function(e,t){return t.filter((function(e){return void 0!==e[h.BASE]})).map((function(e){return e[h.BASE]})).reverse().reduce((function(t,n){if(!t.length)for(var r=Object.keys(n),a=0;a<r.length;a+=1){var o=r[a].toLowerCase();if(-1!==e.indexOf(o)&&n[o])return t.concat(n)}return t}),[])},T=function(e,t,n){var r={};return n.filter((function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)})).map((function(t){return t[e]})).reverse().reduce((function(e,n){var a={};n.filter((function(e){for(var n,o=Object.keys(e),s=0;s<o.length;s+=1){var i=o[s],l=i.toLowerCase();-1===t.indexOf(l)||"rel"===n&&"canonical"===e[n].toLowerCase()||"rel"===l&&"stylesheet"===e[l].toLowerCase()||(n=l),-1===t.indexOf(i)||"innerHTML"!==i&&"cssText"!==i&&"itemprop"!==i||(n=i)}if(!n||!e[n])return!1;var c=e[n].toLowerCase();return r[n]||(r[n]={}),a[n]||(a[n]={}),!r[n][c]&&(a[n][c]=!0,!0)})).reverse().forEach((function(t){return e.push(t)}));for(var o=Object.keys(a),s=0;s<o.length;s+=1){var i=o[s],l=p({},r[i],a[i]);r[i]=l}return e}),[]).reverse()},A=function(e,t){if(Array.isArray(e)&&e.length)for(var n=0;n<e.length;n+=1)if(e[n][t])return!0;return!1},P=function(e){return Array.isArray(e)?e.join(""):e},R=function(e,t){return Array.isArray(e)?e.reduce((function(e,n){return function(e,t){for(var n=Object.keys(e),r=0;r<n.length;r+=1)if(t[n[r]]&&t[n[r]].includes(e[n[r]]))return!0;return!1}(n,t)?e.priority.push(n):e.default.push(n),e}),{priority:[],default:[]}):{default:e}},L=function(e,t){var n;return p({},e,((n={})[t]=void 0,n))},N=[h.NOSCRIPT,h.SCRIPT,h.STYLE],O=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},D=function(e){return Object.keys(e).reduce((function(t,n){var r=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+r:r}),"")},I=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce((function(t,n){return t[x[n]||n]=e[n],t}),t)},M=function(e,t){return t.map((function(t,n){var a,o=((a={key:n})["data-rh"]=!0,a);return Object.keys(t).forEach((function(e){var n=x[e]||e;"innerHTML"===n||"cssText"===n?o.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:o[n]=t[e]})),r.createElement(e,o)}))},F=function(e,t,n){switch(e){case h.TITLE:return{toComponent:function(){return n=t.titleAttributes,(a={key:e=t.title})["data-rh"]=!0,o=I(n,a),[r.createElement(h.TITLE,o,e)];var e,n,a,o},toString:function(){return function(e,t,n,r){var a=D(n),o=P(t);return a?"<"+e+' data-rh="true" '+a+">"+O(o,r)+"</"+e+">":"<"+e+' data-rh="true">'+O(o,r)+"</"+e+">"}(e,t.title,t.titleAttributes,n)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return I(t)},toString:function(){return D(t)}};default:return{toComponent:function(){return M(e,t)},toString:function(){return function(e,t,n){return t.reduce((function(t,r){var a=Object.keys(r).filter((function(e){return!("innerHTML"===e||"cssText"===e)})).reduce((function(e,t){var a=void 0===r[t]?t:t+'="'+O(r[t],n)+'"';return e?e+" "+a:a}),""),o=r.innerHTML||r.cssText||"",s=-1===N.indexOf(e);return t+"<"+e+' data-rh="true" '+a+(s?"/>":">"+o+"</"+e+">")}),"")}(e,t,n)}}}},B=function(e){var t=e.baseTag,n=e.bodyAttributes,r=e.encode,a=e.htmlAttributes,o=e.noscriptTags,s=e.styleTags,i=e.title,l=void 0===i?"":i,c=e.titleAttributes,u=e.linkTags,d=e.metaTags,p=e.scriptTags,g={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var f=function(e){var t=e.linkTags,n=e.scriptTags,r=e.encode,a=R(e.metaTags,y),o=R(t,b),s=R(n,v);return{priorityMethods:{toComponent:function(){return[].concat(M(h.META,a.priority),M(h.LINK,o.priority),M(h.SCRIPT,s.priority))},toString:function(){return F(h.META,a.priority,r)+" "+F(h.LINK,o.priority,r)+" "+F(h.SCRIPT,s.priority,r)}},metaTags:a.default,linkTags:o.default,scriptTags:s.default}}(e);g=f.priorityMethods,u=f.linkTags,d=f.metaTags,p=f.scriptTags}return{priority:g,base:F(h.BASE,t,r),bodyAttributes:F("bodyAttributes",n,r),htmlAttributes:F("htmlAttributes",a,r),link:F(h.LINK,u,r),meta:F(h.META,d,r),noscript:F(h.NOSCRIPT,o,r),script:F(h.SCRIPT,p,r),style:F(h.STYLE,s,r),title:F(h.TITLE,{title:l,titleAttributes:c},r)}},z=[],$=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?z:n.instances},add:function(e){(n.canUseDOM?z:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?z:n.instances).indexOf(e);(n.canUseDOM?z:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=B({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},U=r.createContext({}),q=o().shape({setHelmet:o().func,helmetInstances:o().shape({get:o().func,add:o().func,remove:o().func})}),H="undefined"!=typeof document,G=function(e){function t(n){var r;return(r=e.call(this,n)||this).helmetData=new $(r.props.context,t.canUseDOM),r}return g(t,e),t.prototype.render=function(){return r.createElement(U.Provider,{value:this.helmetData.value},this.props.children)},t}(r.Component);G.canUseDOM=H,G.propTypes={context:o().shape({helmet:o().shape()}),children:o().node.isRequired},G.defaultProps={context:{}},G.displayName="HelmetProvider";var W=function(e,t){var n,r=document.head||document.querySelector(h.HEAD),a=r.querySelectorAll(e+"[data-rh]"),o=[].slice.call(a),s=[];return t&&t.length&&t.forEach((function(t){var r=document.createElement(e);for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&("innerHTML"===a?r.innerHTML=t.innerHTML:"cssText"===a?r.styleSheet?r.styleSheet.cssText=t.cssText:r.appendChild(document.createTextNode(t.cssText)):r.setAttribute(a,void 0===t[a]?"":t[a]));r.setAttribute("data-rh","true"),o.some((function(e,t){return n=t,r.isEqualNode(e)}))?o.splice(n,1):s.push(r)})),o.forEach((function(e){return e.parentNode.removeChild(e)})),s.forEach((function(e){return r.appendChild(e)})),{oldTags:o,newTags:s}},V=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var r=n.getAttribute("data-rh"),a=r?r.split(","):[],o=[].concat(a),s=Object.keys(t),i=0;i<s.length;i+=1){var l=s[i],c=t[l]||"";n.getAttribute(l)!==c&&n.setAttribute(l,c),-1===a.indexOf(l)&&a.push(l);var u=o.indexOf(l);-1!==u&&o.splice(u,1)}for(var d=o.length-1;d>=0;d-=1)n.removeAttribute(o[d]);a.length===o.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==s.join(",")&&n.setAttribute("data-rh",s.join(","))}},K=function(e,t){var n=e.baseTag,r=e.htmlAttributes,a=e.linkTags,o=e.metaTags,s=e.noscriptTags,i=e.onChangeClientState,l=e.scriptTags,c=e.styleTags,u=e.title,d=e.titleAttributes;V(h.BODY,e.bodyAttributes),V(h.HTML,r),function(e,t){void 0!==e&&document.title!==e&&(document.title=P(e)),V(h.TITLE,t)}(u,d);var p={baseTag:W(h.BASE,n),linkTags:W(h.LINK,a),metaTags:W(h.META,o),noscriptTags:W(h.NOSCRIPT,s),scriptTags:W(h.SCRIPT,l),styleTags:W(h.STYLE,c)},g={},f={};Object.keys(p).forEach((function(e){var t=p[e],n=t.newTags,r=t.oldTags;n.length&&(g[e]=n),r.length&&(f[e]=p[e].oldTags)})),t&&t(),i(e,g,f)},Q=null,Y=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(t=e.call.apply(e,[this].concat(r))||this).rendered=!1,t}g(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!d()(e,this.props)},n.componentDidUpdate=function(){this.emitChange()},n.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},n.emitChange=function(){var e,t,n=this.props.context,r=n.setHelmet,a=null,o=(e=n.helmetInstances.get().map((function(e){var t=p({},e.props);return delete t.context,t})),{baseTag:C(["href"],e),bodyAttributes:E("bodyAttributes",e),defer:j(e,"defer"),encode:j(e,"encodeSpecialCharacters"),htmlAttributes:E("htmlAttributes",e),linkTags:T(h.LINK,["rel","href"],e),metaTags:T(h.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:T(h.NOSCRIPT,["innerHTML"],e),onChangeClientState:S(e),scriptTags:T(h.SCRIPT,["src","innerHTML"],e),styleTags:T(h.STYLE,["cssText"],e),title:_(e),titleAttributes:E("titleAttributes",e),prioritizeSeoTags:A(e,"prioritizeSeoTags")});G.canUseDOM?(t=o,Q&&cancelAnimationFrame(Q),t.defer?Q=requestAnimationFrame((function(){K(t,(function(){Q=null}))})):(K(t),Q=null)):B&&(a=B(o)),r(a)},n.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},n.render=function(){return this.init(),null},t}(r.Component);Y.propTypes={context:q.isRequired},Y.displayName="HelmetDispatcher";var Z=["children"],X=["children"],J=function(e){function t(){return e.apply(this,arguments)||this}g(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!i()(L(this.props,"helmetData"),L(e,"helmetData"))},n.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case h.SCRIPT:case h.NOSCRIPT:return{innerHTML:t};case h.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,r=e.arrayTypeChildren;return p({},r,((t={})[n.type]=[].concat(r[n.type]||[],[p({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,r=e.child,a=e.newProps,o=e.newChildProps,s=e.nestedChildren;switch(r.type){case h.TITLE:return p({},a,((t={})[r.type]=s,t.titleAttributes=p({},o),t));case h.BODY:return p({},a,{bodyAttributes:p({},o)});case h.HTML:return p({},a,{htmlAttributes:p({},o)});default:return p({},a,((n={})[r.type]=p({},o),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=p({},t);return Object.keys(e).forEach((function(t){var r;n=p({},n,((r={})[t]=e[t],r))})),n},n.warnOnInvalidChildren=function(e,t){return c()(w.some((function(t){return e.type===t})),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+w.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),c()(!t||"string"==typeof t||Array.isArray(t)&&!t.some((function(e){return"string"!=typeof e})),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,a={};return r.Children.forEach(e,(function(e){if(e&&e.props){var r=e.props,o=r.children,s=m(r,Z),i=Object.keys(s).reduce((function(e,t){return e[k[t]||t]=s[t],e}),{}),l=e.type;switch("symbol"==typeof l?l=l.toString():n.warnOnInvalidChildren(e,o),l){case h.FRAGMENT:t=n.mapChildrenToProps(o,t);break;case h.LINK:case h.META:case h.NOSCRIPT:case h.SCRIPT:case h.STYLE:a=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:a,newChildProps:i,nestedChildren:o});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:i,nestedChildren:o})}}})),this.mapArrayTypeChildrenToProps(a,t)},n.render=function(){var e=this.props,t=e.children,n=m(e,X),a=p({},n),o=n.helmetData;return t&&(a=this.mapChildrenToProps(t,a)),!o||o instanceof $||(o=new $(o.context,o.instances)),o?r.createElement(Y,p({},a,{context:o.value,helmetData:void 0})):r.createElement(U.Consumer,null,(function(e){return r.createElement(Y,p({},a,{context:e}))}))},t}(r.Component);J.propTypes={base:o().object,bodyAttributes:o().object,children:o().oneOfType([o().arrayOf(o().node),o().node]),defaultTitle:o().string,defer:o().bool,encodeSpecialCharacters:o().bool,htmlAttributes:o().object,link:o().arrayOf(o().object),meta:o().arrayOf(o().object),noscript:o().arrayOf(o().object),onChangeClientState:o().func,script:o().arrayOf(o().object),style:o().arrayOf(o().object),title:o().string,titleAttributes:o().object,titleTemplate:o().string,prioritizeSeoTags:o().bool,helmetData:o().object},J.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},J.displayName="Helmet"},2799:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,a=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,i=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,d=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,g=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,h=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case d:case o:case i:case s:case g:return e;default:switch(e=e&&e.$$typeof){case c:case p:case h:case m:case l:return e;default:return t}}case a:return t}}}function k(e){return x(e)===d}t.AsyncMode=u,t.ConcurrentMode=d,t.ContextConsumer=c,t.ContextProvider=l,t.Element=r,t.ForwardRef=p,t.Fragment=o,t.Lazy=h,t.Memo=m,t.Portal=a,t.Profiler=i,t.StrictMode=s,t.Suspense=g,t.isAsyncMode=function(e){return k(e)||x(e)===u},t.isConcurrentMode=k,t.isContextConsumer=function(e){return x(e)===c},t.isContextProvider=function(e){return x(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return x(e)===p},t.isFragment=function(e){return x(e)===o},t.isLazy=function(e){return x(e)===h},t.isMemo=function(e){return x(e)===m},t.isPortal=function(e){return x(e)===a},t.isProfiler=function(e){return x(e)===i},t.isStrictMode=function(e){return x(e)===s},t.isSuspense=function(e){return x(e)===g},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===d||e===i||e===s||e===g||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===l||e.$$typeof===c||e.$$typeof===p||e.$$typeof===v||e.$$typeof===y||e.$$typeof===w||e.$$typeof===b)},t.typeOf=x},4363:(e,t,n)=>{"use strict";e.exports=n(2799)},3259:(e,t,n)=>{"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}var i=n(6540),l=[],c=[];var u=i.createContext(null);function d(e){var t=e(),n={loading:!0,loaded:null,error:null};return n.promise=t.then((function(e){return n.loading=!1,n.loaded=e,e})).catch((function(e){throw n.loading=!1,n.error=e,e})),n}function p(e){var t={loading:!1,loaded:{},error:null},n=[];try{Object.keys(e).forEach((function(r){var a=d(e[r]);a.loading?t.loading=!0:(t.loaded[r]=a.loaded,t.error=a.error),n.push(a.promise),a.promise.then((function(e){t.loaded[r]=e})).catch((function(e){t.error=e}))}))}catch(r){t.error=r}return t.promise=Promise.all(n).then((function(e){return t.loading=!1,e})).catch((function(e){throw t.loading=!1,e})),t}function g(e,t){return i.createElement((n=e)&&n.__esModule?n.default:n,t);var n}function f(e,t){var d,p;if(!t.loading)throw new Error("react-loadable requires a `loading` component");var f=s({loader:null,loading:null,delay:200,timeout:null,render:g,webpack:null,modules:null},t),m=null;function h(){return m||(m=e(f.loader)),m.promise}return l.push(h),"function"==typeof f.webpack&&c.push((function(){if((0,f.webpack)().every((function(e){return void 0!==e&&void 0!==n.m[e]})))return h()})),p=d=function(t){function n(n){var r;return o(a(a(r=t.call(this,n)||this)),"retry",(function(){r.setState({error:null,loading:!0,timedOut:!1}),m=e(f.loader),r._loadModule()})),h(),r.state={error:m.error,pastDelay:!1,timedOut:!1,loading:m.loading,loaded:m.loaded},r}r(n,t),n.preload=function(){return h()};var s=n.prototype;return s.UNSAFE_componentWillMount=function(){this._loadModule()},s.componentDidMount=function(){this._mounted=!0},s._loadModule=function(){var e=this;if(this.context&&Array.isArray(f.modules)&&f.modules.forEach((function(t){e.context.report(t)})),m.loading){var t=function(t){e._mounted&&e.setState(t)};"number"==typeof f.delay&&(0===f.delay?this.setState({pastDelay:!0}):this._delay=setTimeout((function(){t({pastDelay:!0})}),f.delay)),"number"==typeof f.timeout&&(this._timeout=setTimeout((function(){t({timedOut:!0})}),f.timeout));var n=function(){t({error:m.error,loaded:m.loaded,loading:m.loading}),e._clearTimeouts()};m.promise.then((function(){return n(),null})).catch((function(e){return n(),null}))}},s.componentWillUnmount=function(){this._mounted=!1,this._clearTimeouts()},s._clearTimeouts=function(){clearTimeout(this._delay),clearTimeout(this._timeout)},s.render=function(){return this.state.loading||this.state.error?i.createElement(f.loading,{isLoading:this.state.loading,pastDelay:this.state.pastDelay,timedOut:this.state.timedOut,error:this.state.error,retry:this.retry}):this.state.loaded?f.render(this.state.loaded,this.props):null},n}(i.Component),o(d,"contextType",u),p}function m(e){return f(d,e)}m.Map=function(e){if("function"!=typeof e.render)throw new Error("LoadableMap requires a `render(loaded, props)` function");return f(p,e)};var h=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.prototype.render=function(){return i.createElement(u.Provider,{value:{report:this.props.report}},i.Children.only(this.props.children))},t}(i.Component);function b(e){for(var t=[];e.length;){var n=e.pop();t.push(n())}return Promise.all(t).then((function(){if(e.length)return b(e)}))}m.Capture=h,m.preloadAll=function(){return new Promise((function(e,t){b(l).then(e,t)}))},m.preloadReady=function(){return new Promise((function(e,t){b(c).then(e,e)}))},e.exports=m},2831:(e,t,n)=>{"use strict";n.d(t,{u:()=>s,v:()=>i});var r=n(6347),a=n(8168),o=n(6540);function s(e,t,n){return void 0===n&&(n=[]),e.some((function(e){var a=e.path?(0,r.B6)(t,e):n.length?n[n.length-1].match:r.Ix.computeRootMatch(t);return a&&(n.push({route:e,match:a}),e.routes&&s(e.routes,t,n)),a})),n}function i(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e?o.createElement(r.dO,n,e.map((function(e,n){return o.createElement(r.qh,{key:e.key||n,path:e.path,exact:e.exact,strict:e.strict,render:function(n){return e.render?e.render((0,a.A)({},n,{},t,{route:e})):o.createElement(e.component,(0,a.A)({},n,t,{route:e}))}})}))):null}},4625:(e,t,n)=>{"use strict";n.d(t,{I9:()=>d,Kd:()=>u,N_:()=>b,k2:()=>w});var r=n(6347),a=n(2892),o=n(6540),s=n(1513),i=n(8168),l=n(8587),c=n(8997),u=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(t=e.call.apply(e,[this].concat(r))||this).history=(0,s.zR)(t.props),t}return(0,a.A)(t,e),t.prototype.render=function(){return o.createElement(r.Ix,{history:this.history,children:this.props.children})},t}(o.Component);var d=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(t=e.call.apply(e,[this].concat(r))||this).history=(0,s.TM)(t.props),t}return(0,a.A)(t,e),t.prototype.render=function(){return o.createElement(r.Ix,{history:this.history,children:this.props.children})},t}(o.Component);var p=function(e,t){return"function"==typeof e?e(t):e},g=function(e,t){return"string"==typeof e?(0,s.yJ)(e,null,null,t):e},f=function(e){return e},m=o.forwardRef;void 0===m&&(m=f);var h=m((function(e,t){var n=e.innerRef,r=e.navigate,a=e.onClick,s=(0,l.A)(e,["innerRef","navigate","onClick"]),c=s.target,u=(0,i.A)({},s,{onClick:function(e){try{a&&a(e)}catch(t){throw e.preventDefault(),t}e.defaultPrevented||0!==e.button||c&&"_self"!==c||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||(e.preventDefault(),r())}});return u.ref=f!==m&&t||n,o.createElement("a",u)}));var b=m((function(e,t){var n=e.component,a=void 0===n?h:n,u=e.replace,d=e.to,b=e.innerRef,v=(0,l.A)(e,["component","replace","to","innerRef"]);return o.createElement(r.XZ.Consumer,null,(function(e){e||(0,c.A)(!1);var n=e.history,r=g(p(d,e.location),e.location),l=r?n.createHref(r):"",h=(0,i.A)({},v,{href:l,navigate:function(){var t=p(d,e.location),r=(0,s.AO)(e.location)===(0,s.AO)(g(t));(u||r?n.replace:n.push)(t)}});return f!==m?h.ref=t||b:h.innerRef=b,o.createElement(a,h)}))})),v=function(e){return e},y=o.forwardRef;void 0===y&&(y=v);var w=y((function(e,t){var n=e["aria-current"],a=void 0===n?"page":n,s=e.activeClassName,u=void 0===s?"active":s,d=e.activeStyle,f=e.className,m=e.exact,h=e.isActive,w=e.location,x=e.sensitive,k=e.strict,j=e.style,_=e.to,S=e.innerRef,E=(0,l.A)(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return o.createElement(r.XZ.Consumer,null,(function(e){e||(0,c.A)(!1);var n=w||e.location,s=g(p(_,n),n),l=s.pathname,C=l&&l.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),T=C?(0,r.B6)(n.pathname,{path:C,exact:m,sensitive:x,strict:k}):null,A=!!(h?h(T,n):T),P="function"==typeof f?f(A):f,R="function"==typeof j?j(A):j;A&&(P=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((function(e){return e})).join(" ")}(P,u),R=(0,i.A)({},R,d));var L=(0,i.A)({"aria-current":A&&a||null,className:P,style:R,to:s},E);return v!==y?L.ref=t||S:L.innerRef=S,o.createElement(b,L)}))}))},6347:(e,t,n)=>{"use strict";n.d(t,{B6:()=>j,Ix:()=>y,W6:()=>L,XZ:()=>v,dO:()=>P,qh:()=>_,zy:()=>N});var r=n(2892),a=n(6540),o=n(5556),s=n.n(o),i=n(1513),l=n(8997),c=n(8168),u=n(8505),d=n.n(u),p=(n(4363),n(8587)),g=(n(4146),1073741823),f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:{};var m=a.createContext||function(e,t){var n,o,i="__create-react-context-"+function(){var e="__global_unique_id__";return f[e]=(f[e]||0)+1}()+"__",l=function(e){function n(){for(var t,n,r,a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];return(t=e.call.apply(e,[this].concat(o))||this).emitter=(n=t.props.value,r=[],{on:function(e){r.push(e)},off:function(e){r=r.filter((function(t){return t!==e}))},get:function(){return n},set:function(e,t){n=e,r.forEach((function(e){return e(n,t)}))}}),t}(0,r.A)(n,e);var a=n.prototype;return a.getChildContext=function(){var e;return(e={})[i]=this.emitter,e},a.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n,r=this.props.value,a=e.value;((o=r)===(s=a)?0!==o||1/o==1/s:o!=o&&s!=s)?n=0:(n="function"==typeof t?t(r,a):g,0!==(n|=0)&&this.emitter.set(e.value,n))}var o,s},a.render=function(){return this.props.children},n}(a.Component);l.childContextTypes=((n={})[i]=s().object.isRequired,n);var c=function(t){function n(){for(var e,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(e=t.call.apply(t,[this].concat(r))||this).observedBits=void 0,e.state={value:e.getValue()},e.onUpdate=function(t,n){0!=((0|e.observedBits)&n)&&e.setState({value:e.getValue()})},e}(0,r.A)(n,t);var a=n.prototype;return a.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?g:t},a.componentDidMount=function(){this.context[i]&&this.context[i].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?g:e},a.componentWillUnmount=function(){this.context[i]&&this.context[i].off(this.onUpdate)},a.getValue=function(){return this.context[i]?this.context[i].get():e},a.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},n}(a.Component);return c.contextTypes=((o={})[i]=s().object,o),{Provider:l,Consumer:c}},h=function(e){var t=m();return t.displayName=e,t},b=h("Router-History"),v=h("Router"),y=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._pendingLocation=e}))),n}(0,r.A)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){var e=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen((function(t){e._isMounted&&e.setState({location:t})}))),this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},n.render=function(){return a.createElement(v.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},a.createElement(b.Provider,{children:this.props.children||null,value:this.props.history}))},t}(a.Component);a.Component;a.Component;var w={},x=1e4,k=0;function j(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var n=t,r=n.path,a=n.exact,o=void 0!==a&&a,s=n.strict,i=void 0!==s&&s,l=n.sensitive,c=void 0!==l&&l;return[].concat(r).reduce((function(t,n){if(!n&&""!==n)return null;if(t)return t;var r=function(e,t){var n=""+t.end+t.strict+t.sensitive,r=w[n]||(w[n]={});if(r[e])return r[e];var a=[],o={regexp:d()(e,a,t),keys:a};return k<x&&(r[e]=o,k++),o}(n,{end:o,strict:i,sensitive:c}),a=r.regexp,s=r.keys,l=a.exec(e);if(!l)return null;var u=l[0],p=l.slice(1),g=e===u;return o&&!g?null:{path:n,url:"/"===n&&""===u?"/":u,isExact:g,params:s.reduce((function(e,t,n){return e[t.name]=p[n],e}),{})}}),null)}var _=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.A)(t,e),t.prototype.render=function(){var e=this;return a.createElement(v.Consumer,null,(function(t){t||(0,l.A)(!1);var n=e.props.location||t.location,r=e.props.computedMatch?e.props.computedMatch:e.props.path?j(n.pathname,e.props):t.match,o=(0,c.A)({},t,{location:n,match:r}),s=e.props,i=s.children,u=s.component,d=s.render;return Array.isArray(i)&&function(e){return 0===a.Children.count(e)}(i)&&(i=null),a.createElement(v.Provider,{value:o},o.match?i?"function"==typeof i?i(o):i:u?a.createElement(u,o):d?d(o):null:"function"==typeof i?i(o):null)}))},t}(a.Component);function S(e){return"/"===e.charAt(0)?e:"/"+e}function E(e,t){if(!e)return t;var n=S(e);return 0!==t.pathname.indexOf(n)?t:(0,c.A)({},t,{pathname:t.pathname.substr(n.length)})}function C(e){return"string"==typeof e?e:(0,i.AO)(e)}function T(e){return function(){(0,l.A)(!1)}}function A(){}a.Component;var P=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.A)(t,e),t.prototype.render=function(){var e=this;return a.createElement(v.Consumer,null,(function(t){t||(0,l.A)(!1);var n,r,o=e.props.location||t.location;return a.Children.forEach(e.props.children,(function(e){if(null==r&&a.isValidElement(e)){n=e;var s=e.props.path||e.props.from;r=s?j(o.pathname,(0,c.A)({},e.props,{path:s})):t.match}})),r?a.cloneElement(n,{location:o,computedMatch:r}):null}))},t}(a.Component);var R=a.useContext;function L(){return R(b)}function N(){return R(v).location}},8505:(e,t,n)=>{var r=n(4634);e.exports=g,e.exports.parse=o,e.exports.compile=function(e,t){return i(o(e,t),t)},e.exports.tokensToFunction=i,e.exports.tokensToRegExp=p;var a=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function o(e,t){for(var n,r=[],o=0,s=0,i="",u=t&&t.delimiter||"/";null!=(n=a.exec(e));){var d=n[0],p=n[1],g=n.index;if(i+=e.slice(s,g),s=g+d.length,p)i+=p[1];else{var f=e[s],m=n[2],h=n[3],b=n[4],v=n[5],y=n[6],w=n[7];i&&(r.push(i),i="");var x=null!=m&&null!=f&&f!==m,k="+"===y||"*"===y,j="?"===y||"*"===y,_=n[2]||u,S=b||v;r.push({name:h||o++,prefix:m||"",delimiter:_,optional:j,repeat:k,partial:x,asterisk:!!w,pattern:S?c(S):w?".*":"[^"+l(_)+"]+?"})}}return s<e.length&&(i+=e.substr(s)),i&&r.push(i),r}function s(e){return encodeURI(e).replace(/[\/?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function i(e,t){for(var n=new Array(e.length),a=0;a<e.length;a++)"object"==typeof e[a]&&(n[a]=new RegExp("^(?:"+e[a].pattern+")$",d(t)));return function(t,a){for(var o="",i=t||{},l=(a||{}).pretty?s:encodeURIComponent,c=0;c<e.length;c++){var u=e[c];if("string"!=typeof u){var d,p=i[u.name];if(null==p){if(u.optional){u.partial&&(o+=u.prefix);continue}throw new TypeError('Expected "'+u.name+'" to be defined')}if(r(p)){if(!u.repeat)throw new TypeError('Expected "'+u.name+'" to not repeat, but received `'+JSON.stringify(p)+"`");if(0===p.length){if(u.optional)continue;throw new TypeError('Expected "'+u.name+'" to not be empty')}for(var g=0;g<p.length;g++){if(d=l(p[g]),!n[c].test(d))throw new TypeError('Expected all "'+u.name+'" to match "'+u.pattern+'", but received `'+JSON.stringify(d)+"`");o+=(0===g?u.prefix:u.delimiter)+d}}else{if(d=u.asterisk?encodeURI(p).replace(/[?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):l(p),!n[c].test(d))throw new TypeError('Expected "'+u.name+'" to match "'+u.pattern+'", but received "'+d+'"');o+=u.prefix+d}}else o+=u}return o}}function l(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function c(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function u(e,t){return e.keys=t,e}function d(e){return e&&e.sensitive?"":"i"}function p(e,t,n){r(t)||(n=t||n,t=[]);for(var a=(n=n||{}).strict,o=!1!==n.end,s="",i=0;i<e.length;i++){var c=e[i];if("string"==typeof c)s+=l(c);else{var p=l(c.prefix),g="(?:"+c.pattern+")";t.push(c),c.repeat&&(g+="(?:"+p+g+")*"),s+=g=c.optional?c.partial?p+"("+g+")?":"(?:"+p+"("+g+"))?":p+"("+g+")"}}var f=l(n.delimiter||"/"),m=s.slice(-f.length)===f;return a||(s=(m?s.slice(0,-f.length):s)+"(?:"+f+"(?=$))?"),s+=o?"$":a&&m?"":"(?="+f+"|$)",u(new RegExp("^"+s,d(n)),t)}function g(e,t,n){return r(t)||(n=t||n,t=[]),n=n||{},e instanceof RegExp?function(e,t){var n=e.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)t.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return u(e,t)}(e,t):r(e)?function(e,t,n){for(var r=[],a=0;a<e.length;a++)r.push(g(e[a],t,n).source);return u(new RegExp("(?:"+r.join("|")+")",d(n)),t)}(e,t,n):function(e,t,n){return p(o(e,n),t,n)}(e,t,n)}},1020:(e,t,n)=>{"use strict";var r=n(6540),a=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,o={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,r)&&!l.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:a,type:e,key:c,ref:u,props:o,_owner:i.current}}t.Fragment=o,t.jsx=c,t.jsxs=c},5287:(e,t)=>{"use strict";var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,h={};function b(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||f}function v(){}function y(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||f}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=b.prototype;var w=y.prototype=new v;w.constructor=y,m(w,b.prototype),w.isPureReactComponent=!0;var x=Array.isArray,k=Object.prototype.hasOwnProperty,j={current:null},_={key:!0,ref:!0,__self:!0,__source:!0};function S(e,t,r){var a,o={},s=null,i=null;if(null!=t)for(a in void 0!==t.ref&&(i=t.ref),void 0!==t.key&&(s=""+t.key),t)k.call(t,a)&&!_.hasOwnProperty(a)&&(o[a]=t[a]);var l=arguments.length-2;if(1===l)o.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];o.children=c}if(e&&e.defaultProps)for(a in l=e.defaultProps)void 0===o[a]&&(o[a]=l[a]);return{$$typeof:n,type:e,key:s,ref:i,props:o,_owner:j.current}}function E(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var C=/\/+/g;function T(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function A(e,t,a,o,s){var i=typeof e;"undefined"!==i&&"boolean"!==i||(e=null);var l=!1;if(null===e)l=!0;else switch(i){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case n:case r:l=!0}}if(l)return s=s(l=e),e=""===o?"."+T(l,0):o,x(s)?(a="",null!=e&&(a=e.replace(C,"$&/")+"/"),A(s,t,a,"",(function(e){return e}))):null!=s&&(E(s)&&(s=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,a+(!s.key||l&&l.key===s.key?"":(""+s.key).replace(C,"$&/")+"/")+e)),t.push(s)),1;if(l=0,o=""===o?".":o+":",x(e))for(var c=0;c<e.length;c++){var u=o+T(i=e[c],c);l+=A(i,t,a,u,s)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=g&&e[g]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(i=e.next()).done;)l+=A(i=i.value,t,a,u=o+T(i,c++),s);else if("object"===i)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return l}function P(e,t,n){if(null==e)return e;var r=[],a=0;return A(e,r,"","",(function(e){return t.call(n,e,a++)})),r}function R(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var L={current:null},N={transition:null},O={ReactCurrentDispatcher:L,ReactCurrentBatchConfig:N,ReactCurrentOwner:j};t.Children={map:P,forEach:function(e,t,n){P(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return P(e,(function(){t++})),t},toArray:function(e){return P(e,(function(e){return e}))||[]},only:function(e){if(!E(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=b,t.Fragment=a,t.Profiler=s,t.PureComponent=y,t.StrictMode=o,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,t.cloneElement=function(e,t,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var a=m({},e.props),o=e.key,s=e.ref,i=e._owner;if(null!=t){if(void 0!==t.ref&&(s=t.ref,i=j.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)k.call(t,c)&&!_.hasOwnProperty(c)&&(a[c]=void 0===t[c]&&void 0!==l?l[c]:t[c])}var c=arguments.length-2;if(1===c)a.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}return{$$typeof:n,type:e.type,key:o,ref:s,props:a,_owner:i}},t.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:i,_context:e},e.Consumer=e},t.createElement=S,t.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=E,t.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:R}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=N.transition;N.transition={};try{e()}finally{N.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return L.current.useCallback(e,t)},t.useContext=function(e){return L.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return L.current.useDeferredValue(e)},t.useEffect=function(e,t){return L.current.useEffect(e,t)},t.useId=function(){return L.current.useId()},t.useImperativeHandle=function(e,t,n){return L.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return L.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return L.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return L.current.useMemo(e,t)},t.useReducer=function(e,t,n){return L.current.useReducer(e,t,n)},t.useRef=function(e){return L.current.useRef(e)},t.useState=function(e){return L.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return L.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return L.current.useTransition()},t.version="18.2.0"},6540:(e,t,n)=>{"use strict";e.exports=n(5287)},4848:(e,t,n)=>{"use strict";e.exports=n(1020)},7463:(e,t)=>{"use strict";function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,a=e[r];if(!(0<o(a,t)))break e;e[r]=t,e[n]=a,n=r}}function r(e){return 0===e.length?null:e[0]}function a(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length,s=a>>>1;r<s;){var i=2*(r+1)-1,l=e[i],c=i+1,u=e[c];if(0>o(l,n))c<a&&0>o(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[i]=n,r=i);else{if(!(c<a&&0>o(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function o(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var i=Date,l=i.now();t.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,p=null,g=3,f=!1,m=!1,h=!1,b="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var t=r(u);null!==t;){if(null===t.callback)a(u);else{if(!(t.startTime<=e))break;a(u),t.sortIndex=t.expirationTime,n(c,t)}t=r(u)}}function x(e){if(h=!1,w(e),!m)if(null!==r(c))m=!0,N(k);else{var t=r(u);null!==t&&O(x,t.startTime-e)}}function k(e,n){m=!1,h&&(h=!1,v(E),E=-1),f=!0;var o=g;try{for(w(n),p=r(c);null!==p&&(!(p.expirationTime>n)||e&&!A());){var s=p.callback;if("function"==typeof s){p.callback=null,g=p.priorityLevel;var i=s(p.expirationTime<=n);n=t.unstable_now(),"function"==typeof i?p.callback=i:p===r(c)&&a(c),w(n)}else a(c);p=r(c)}if(null!==p)var l=!0;else{var d=r(u);null!==d&&O(x,d.startTime-n),l=!1}return l}finally{p=null,g=o,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var j,_=!1,S=null,E=-1,C=5,T=-1;function A(){return!(t.unstable_now()-T<C)}function P(){if(null!==S){var e=t.unstable_now();T=e;var n=!0;try{n=S(!0,e)}finally{n?j():(_=!1,S=null)}}else _=!1}if("function"==typeof y)j=function(){y(P)};else if("undefined"!=typeof MessageChannel){var R=new MessageChannel,L=R.port2;R.port1.onmessage=P,j=function(){L.postMessage(null)}}else j=function(){b(P,0)};function N(e){S=e,_||(_=!0,j())}function O(e,n){E=b((function(){e(t.unstable_now())}),n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){m||f||(m=!0,N(k))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(e){switch(g){case 1:case 2:case 3:var t=3;break;default:t=g}var n=g;g=t;try{return e()}finally{g=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=g;g=e;try{return t()}finally{g=n}},t.unstable_scheduleCallback=function(e,a,o){var s=t.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?s+o:s:o=s,e){case 1:var i=-1;break;case 2:i=250;break;case 5:i=1073741823;break;case 4:i=1e4;break;default:i=5e3}return e={id:d++,callback:a,priorityLevel:e,startTime:o,expirationTime:i=o+i,sortIndex:-1},o>s?(e.sortIndex=o,n(u,e),null===r(c)&&e===r(u)&&(h?(v(E),E=-1):h=!0,O(x,o-s))):(e.sortIndex=i,n(c,e),m||f||(m=!0,N(k))),e},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(e){var t=g;return function(){var n=g;g=t;try{return e.apply(this,arguments)}finally{g=n}}}},9982:(e,t,n)=>{"use strict";e.exports=n(7463)},2833:e=>{e.exports=function(e,t,n,r){var a=n?n.call(r,e,t):void 0;if(void 0!==a)return!!a;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(var i=Object.prototype.hasOwnProperty.bind(t),l=0;l<o.length;l++){var c=o[l];if(!i(c))return!1;var u=e[c],d=t[c];if(!1===(a=n?n.call(r,u,d,c):void 0)||void 0===a&&u!==d)return!1}return!0}},8997:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=!0,a="Invariant failed";function o(e,t){if(!e){if(r)throw new Error(a);var n="function"==typeof t?t():t;throw new Error(n?a+": "+n:a)}}},4784:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={title:"jest-preset-angular",tagline:"Jest preset configuration for Angular projects.",url:"https://thymikee.github.io",baseUrl:"/jest-preset-angular/",baseUrlIssueBanner:!0,onBrokenLinks:"throw",onBrokenMarkdownLinks:"warn",favicon:"img/logo.svg",organizationName:"thymikee",projectName:"jest-preset-angular",plugins:[["@docusaurus/plugin-ideal-image",{quality:70,max:1030,min:640,steps:2}],["@docusaurus/plugin-pwa",{debug:!1,offlineModeActivationStrategies:["appInstalled","queryString"],pwaHead:[{tagName:"link",rel:"icon",href:"img/logo.svg"},{tagName:"link",rel:"manifest",href:"/jest-preset-angular/manifest.json"},{tagName:"meta",name:"theme-color",content:"rgb(37, 194, 160)"},{tagName:"meta",name:"apple-mobile-web-app-capable",content:"yes"},{tagName:"meta",name:"apple-mobile-web-app-status-bar-style",content:"#000"},{tagName:"link",rel:"apple-touch-icon",href:"img/logo.png"},{tagName:"link",rel:"mask-icon",href:"img/logo.svg",color:"rgb(62, 204, 94)"},{tagName:"meta",name:"msapplication-TileImage",content:"img/logo.png"},{tagName:"meta",name:"msapplication-TileColor",content:"#000"}]}]],presets:[["@docusaurus/preset-classic",{docs:{showLastUpdateAuthor:!0,showLastUpdateTime:!0,sidebarPath:"/home/runner/work/jest-preset-angular/jest-preset-angular/website/sidebars.json",editUrl:"https://github.com/thymikee/jest-preset-angular/edit/main/website",remarkPlugins:[[null,{sync:!0}],null]},theme:{customCss:"/home/runner/work/jest-preset-angular/jest-preset-angular/website/src/css/custom.css"}}]],themeConfig:{algolia:{appId:"2L8AIIEZVK",apiKey:"3b46e8c83d66424bede0e97b3de3bc11",indexName:"jest-preset-angular",contextualSearch:!0,searchParameters:{},searchPagePath:"search"},docs:{sidebar:{hideable:!0,autoCollapseCategories:!1},versionPersistence:"localStorage"},colorMode:{defaultMode:"light",disableSwitch:!1,respectPrefersColorScheme:!0},announcementBar:{id:"supportus",content:'\u2b50\ufe0f If you like jest-preset-angular, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/thymikee/jest-preset-angular">GitHub</a>! \u2b50\ufe0f',isCloseable:!0},prism:{theme:{plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},darkTheme:{plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},additionalLanguages:[],magicComments:[{className:"theme-code-block-highlighted-line",line:"highlight-next-line",block:{start:"highlight-start",end:"highlight-end"}}]},navbar:{hideOnScroll:!0,title:"jest-preset-angular",logo:{alt:"jest-preset-angular logo",src:"img/logo.svg"},items:[{to:"docs/",activeBasePath:"docs",label:"Docs",position:"left"},{type:"docsVersionDropdown",position:"right",dropdownActiveClassDisabled:!0,dropdownItemsAfter:[{to:"/versions",label:"All versions"}],dropdownItemsBefore:[]},{href:"https://github.com/thymikee/jest-preset-angular",position:"right",className:"header-github-link","aria-label":"GitHub repository"}]},footer:{style:"dark",links:[{title:"Learn",items:[{label:"Introduction",to:"docs/"},{label:"Installation",to:"docs/getting-started/installation"},{label:"Angular Ivy",to:"docs/guides/angular-ivy"}]},{title:"Community",items:[{label:"Jest",href:"https://stackoverflow.com/questions/tagged/jest"},{label:"Discord",href:"https://discord.gg/j6FKKQQrW9"}]},{title:"More",items:[{label:"GitHub",href:"https://github.com/thymikee/jest-preset-angular/"}]}],copyright:"Copyright \xa9 2025 jest-preset-angular. Built with Docusaurus."},blog:{sidebar:{groupByYear:!0}},metadata:[],tableOfContents:{minHeadingLevel:2,maxHeadingLevel:3}},i18n:{defaultLocale:"en",path:"i18n",locales:["en"],localeConfigs:{}},future:{experimental_faster:{swcJsLoader:!1,swcJsMinimizer:!1,swcHtmlMinimizer:!1,lightningCssMinimizer:!1,mdxCrossCompilerCache:!1,rspackBundler:!1},experimental_storage:{type:"localStorage",namespace:!1},experimental_router:"browser"},onBrokenAnchors:"warn",onDuplicateRoutes:"warn",staticDirectories:["static"],customFields:{},themes:[],scripts:[],headTags:[],stylesheets:[],clientModules:[],titleDelimiter:"|",noIndex:!1,markdown:{format:"mdx",mermaid:!1,mdx1Compat:{comments:!0,admonitions:!0,headingIds:!0},anchors:{maintainCase:!1}}}},8168:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(null,arguments)}n.d(t,{A:()=>r})},2892:(e,t,n)=>{"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}n.d(t,{A:()=>a})},8587:(e,t,n)=>{"use strict";function r(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}n.d(t,{A:()=>r})},4164:(e,t,n)=>{"use strict";function r(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=r(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}n.d(t,{A:()=>a});const a=function(){for(var e,t,n=0,a="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=r(e))&&(a&&(a+=" "),a+=t);return a}},1765:(e,t,n)=>{"use strict";n.d(t,{My:()=>C,f4:()=>ee});var r,a,o,s,i,l,c,u=n(6540),d=n(4164),p=Object.create,g=Object.defineProperty,f=Object.defineProperties,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertyNames,v=Object.getOwnPropertySymbols,y=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,k=(e,t,n)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t)=>{for(var n in t||(t={}))w.call(t,n)&&k(e,n,t[n]);if(v)for(var n of v(t))x.call(t,n)&&k(e,n,t[n]);return e},_=(e,t)=>f(e,h(t)),S=(e,t)=>{var n={};for(var r in e)w.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&v)for(var r of v(e))t.indexOf(r)<0&&x.call(e,r)&&(n[r]=e[r]);return n},E=(r={"../../node_modules/.pnpm/prismjs@1.29.0_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(e,t){var n=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(t,n){var a,o;switch(n=n||{},r.util.type(t)){case"Object":if(o=r.util.objId(t),n[o])return n[o];for(var s in a={},n[o]=a,t)t.hasOwnProperty(s)&&(a[s]=e(t[s],n));return a;case"Array":return o=r.util.objId(t),n[o]?n[o]:(a=[],n[o]=a,t.forEach((function(t,r){a[r]=e(t,n)})),a);default:return t}},getLanguage:function(t){for(;t;){var n=e.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement}return"none"},setLanguage:function(t,n){t.className=t.className.replace(RegExp(e,"gi"),""),t.classList.add("language-"+n)},isActive:function(e,t,n){for(var r="no-"+t;e;){var a=e.classList;if(a.contains(t))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){var o=(a=a||r.languages)[e],s={};for(var i in o)if(o.hasOwnProperty(i)){if(i==t)for(var l in n)n.hasOwnProperty(l)&&(s[l]=n[l]);n.hasOwnProperty(i)||(s[i]=o[i])}var c=a[e];return a[e]=s,r.languages.DFS(r.languages,(function(t,n){n===c&&t!=e&&(this[t]=s)})),s},DFS:function e(t,n,a,o){o=o||{};var s=r.util.objId;for(var i in t)if(t.hasOwnProperty(i)){n.call(t,i,t[i],a||i);var l=t[i],c=r.util.type(l);"Object"!==c||o[s(l)]?"Array"!==c||o[s(l)]||(o[s(l)]=!0,e(l,n,i,o)):(o[s(l)]=!0,e(l,n,null,o))}}},plugins:{},highlight:function(e,t,n){var o={code:e,grammar:t,language:n};if(r.hooks.run("before-tokenize",o),!o.grammar)throw new Error('The language "'+o.language+'" has no grammar.');return o.tokens=r.tokenize(o.code,o.grammar),r.hooks.run("after-tokenize",o),a.stringify(r.util.encode(o.tokens),o.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new i;return l(a,a.head,e),s(e,a,t,a.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(a)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var a,o=0;a=n[o++];)a(t)}},Token:a};function a(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function o(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var o=a[1].length;a.index+=o,a[0]=a[0].slice(o)}return a}function s(e,t,n,i,u,d){for(var p in n)if(n.hasOwnProperty(p)&&n[p]){var g=n[p];g=Array.isArray(g)?g:[g];for(var f=0;f<g.length;++f){if(d&&d.cause==p+","+f)return;var m=g[f],h=m.inside,b=!!m.lookbehind,v=!!m.greedy,y=m.alias;if(v&&!m.pattern.global){var w=m.pattern.toString().match(/[imsuy]*$/)[0];m.pattern=RegExp(m.pattern.source,w+"g")}for(var x=m.pattern||m,k=i.next,j=u;k!==t.tail&&!(d&&j>=d.reach);j+=k.value.length,k=k.next){var _=k.value;if(t.length>e.length)return;if(!(_ instanceof a)){var S,E=1;if(v){if(!(S=o(x,j,e,b))||S.index>=e.length)break;var C=S.index,T=S.index+S[0].length,A=j;for(A+=k.value.length;C>=A;)A+=(k=k.next).value.length;if(j=A-=k.value.length,k.value instanceof a)continue;for(var P=k;P!==t.tail&&(A<T||"string"==typeof P.value);P=P.next)E++,A+=P.value.length;E--,_=e.slice(j,A),S.index-=j}else if(!(S=o(x,0,_,b)))continue;C=S.index;var R=S[0],L=_.slice(0,C),N=_.slice(C+R.length),O=j+_.length;d&&O>d.reach&&(d.reach=O);var D=k.prev;if(L&&(D=l(t,D,L),j+=L.length),c(t,D,E),k=l(t,D,new a(p,h?r.tokenize(R,h):R,y,R)),N&&l(t,k,N),E>1){var I={cause:p+","+f,reach:O};s(e,t,n,k.prev,j,I),d&&I.reach>d.reach&&(d.reach=I.reach)}}}}}}function i(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function c(e,t,n){for(var r=t.next,a=0;a<n&&r!==e.tail;a++)r=r.next;t.next=r,r.prev=t,e.length-=a}return a.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var a="";return t.forEach((function(t){a+=e(t,n)})),a}var o={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(o.classes,s):o.classes.push(s)),r.hooks.run("wrap",o);var i="";for(var l in o.attributes)i+=" "+l+'="'+(o.attributes[l]||"").replace(/"/g,""")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+i+">"+o.content+"</"+o.tag+">"},r}();t.exports=n,n.default=n}},function(){return a||(0,r[b(r)[0]])((a={exports:{}}).exports,a),a.exports}),C=((e,t,n)=>(n=null!=e?p(y(e)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of b(t))w.call(e,a)||a===n||g(e,a,{get:()=>t[a],enumerable:!(r=m(t,a))||r.enumerable});return e})(!t&&e&&e.__esModule?n:g(n,"default",{value:e,enumerable:!0}),e)))(E());C.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},C.languages.markup.tag.inside["attr-value"].inside.entity=C.languages.markup.entity,C.languages.markup.doctype.inside["internal-subset"].inside=C.languages.markup,C.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(C.languages.markup.tag,"addInlined",{value:function(e,t){var n;(t=((n=((n={})["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:C.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}}))["language-"+t]={pattern:/[\s\S]+/,inside:C.languages[t]},{}))[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:n},C.languages.insertBefore("markup","cdata",t)}}),Object.defineProperty(C.languages.markup.tag,"addAttribute",{value:function(e,t){C.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:C.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),C.languages.html=C.languages.markup,C.languages.mathml=C.languages.markup,C.languages.svg=C.languages.markup,C.languages.xml=C.languages.extend("markup",{}),C.languages.ssml=C.languages.xml,C.languages.atom=C.languages.xml,C.languages.rss=C.languages.xml,o=C,s={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},l="(?:[^\\\\-]|"+(i=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/).source+")",l=RegExp(l+"-"+l),c={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"},o.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:l,inside:{escape:i,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":s,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},escape:i}},"special-escape":s,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":c}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:i,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:"punctuation",inside:{"group-name":c}},{pattern:/\)/,alias:"punctuation"}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:"number"},alternation:{pattern:/\|/,alias:"keyword"}},C.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},C.languages.javascript=C.languages.extend("clike",{"class-name":[C.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),C.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,C.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:C.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:C.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:C.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:C.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:C.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),C.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:C.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),C.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),C.languages.markup&&(C.languages.markup.tag.addInlined("script","javascript"),C.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),C.languages.js=C.languages.javascript,C.languages.actionscript=C.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),C.languages.actionscript["class-name"].alias="function",delete C.languages.actionscript.parameter,delete C.languages.actionscript["literal-property"],C.languages.markup&&C.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:C.languages.markup}}),function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(C),function(e){var t=e.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(t,"addSupport",{value:function(t,n){(t="string"==typeof t?[t]:t).forEach((function(t){var r=function(e){e.inside||(e.inside={}),e.inside.rest=n},a="doc-comment";if(o=e.languages[t]){var o,s=o[a];if((s=s||(o=e.languages.insertBefore(t,"comment",{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:"comment"}}))[a])instanceof RegExp&&(s=o[a]={pattern:s}),Array.isArray(s))for(var i=0,l=s.length;i<l;i++)s[i]instanceof RegExp&&(s[i]={pattern:s[i]}),r(s[i]);else r(s)}}))}}),t.addSupport(["java","javascript","php"],t)}(C),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;(t=(e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup))&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))}(C),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,n=(t=(e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+t.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),{pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0});e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,number:n})}(C),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function s(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<value>>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<key>>/g,(function(){return"(?:"+a+"|"+o+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:s(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:s(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:s(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:s(o),lookbehind:!0,greedy:!0},number:{pattern:s(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(C),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source,s=(e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+o+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+o+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n<r;n++){var a,o=t[n];"code"!==o.type?e(o.content):(a=o.content[1],o=o.content[3],a&&o&&"code-language"===a.type&&"code-block"===o.type&&"string"==typeof a.content&&(a=a.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),a="language-"+(a=(/[a-z][\w-]*/i.exec(a)||[""])[0].toLowerCase()),o.alias?"string"==typeof o.alias?o.alias=[o.alias,a]:o.alias.push(a):o.alias=[a]))}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,a=t.classes.length;r<a;r++){var o=t.classes[r];if(o=/language-(.+)/.exec(o)){n=o[1];break}}var c,u=e.languages[n];u?t.content=e.highlight(t.content.replace(s,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;return"#"===(t=t.toLowerCase())[0]?(n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),l(n)):i[t]||e})),u,n):n&&"none"!==n&&e.plugins.autoloader&&(c="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random()),t.attributes.id=c,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(c);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))})))}})),RegExp(e.languages.markup.tag.pattern.source,"gi")),i={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(C),C.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:C.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},C.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),n=0;n<t.length;){var r=t[n++];if("keyword"===r.type&&"mutation"===r.content){var a=[];if(d(["definition-mutation","punctuation"])&&"("===u(1).content){n+=2;var o=p(/^\($/,/^\)$/);if(-1===o)continue;for(;n<o;n++){var s=u(0);"variable"===s.type&&(g(s,"variable-input"),a.push(s.content))}n=o+1}if(d(["punctuation","property-query"])&&"{"===u(0).content&&(n++,g(u(0),"property-mutation"),0<a.length)){var i=p(/^\{$/,/^\}$/);if(-1!==i)for(var l=n;l<i;l++){var c=t[l];"variable"===c.type&&0<=a.indexOf(c.content)&&g(c,"variable-input")}}}}function u(e){return t[n+e]}function d(e,t){t=t||0;for(var n=0;n<e.length;n++){var r=u(n+t);if(!r||r.type!==e[n])return}return 1}function p(e,r){for(var a=1,o=n;o<t.length;o++){var s=t[o],i=s.content;if("punctuation"===s.type&&"string"==typeof i)if(e.test(i))a++;else if(r.test(i)&&0==--a)return o}return-1}function g(e,t){var n=e.alias;n?Array.isArray(n)||(e.alias=n=[n]):e.alias=n=[],n.push(t)}})),C.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,a=r.inside["interpolation-punctuation"],o=r.pattern.source;function s(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function i(t,n,r){return t={code:t,grammar:n,language:r},e.hooks.run("before-tokenize",t),t.tokens=e.tokenize(t.code,t.grammar),e.hooks.run("after-tokenize",t),t.tokens}function l(t,n,s){var l=e.tokenize(t,{interpolation:{pattern:RegExp(o),lookbehind:!0}}),c=0,u={},d=(l=i(l.map((function(e){if("string"==typeof e)return e;var n,r;for(e=e.content;-1!==t.indexOf((r=c++,n="___"+s.toUpperCase()+"_"+r+"___")););return u[n]=e,n})).join(""),n,s),Object.keys(u));return c=0,function t(n){for(var o=0;o<n.length;o++){if(c>=d.length)return;var s,l,p,g,f,m,h,b=n[o];"string"==typeof b||"string"==typeof b.content?(s=d[c],-1!==(h=(m="string"==typeof b?b:b.content).indexOf(s))&&(++c,l=m.substring(0,h),f=u[s],p=void 0,(g={})["interpolation-punctuation"]=a,3===(g=e.tokenize(f,g)).length&&((p=[1,1]).push.apply(p,i(g[1],e.languages.javascript,"javascript")),g.splice.apply(g,p)),p=new e.Token("interpolation",g,r.alias,f),g=m.substring(h+s.length),f=[],l&&f.push(l),f.push(p),g&&(t(m=[g]),f.push.apply(f,m)),"string"==typeof b?(n.splice.apply(n,[o,1].concat(f)),o+=f.length-1):b.content=f)):(h=b.content,Array.isArray(h)?t(h):t([h]))}}(l),new e.Token(s,l,"language-"+s,t)}e.languages.javascript["template-string"]=[s("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),s("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),s("svg",/\bsvg/.source),s("markdown",/\b(?:markdown|md)/.source),s("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),s("sql",/\bsql/.source),t].filter(Boolean);var c={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function u(e){return"string"==typeof e?e:Array.isArray(e)?e.map(u).join(""):u(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in c&&function t(n){for(var r=0,a=n.length;r<a;r++){var o,s,i,c=n[r];"string"!=typeof c&&(o=c.content,Array.isArray(o)?"template-string"===c.type?(c=o[1],3===o.length&&"string"!=typeof c&&"embedded-code"===c.type&&(s=u(c),c=c.alias,c=Array.isArray(c)?c[0]:c,i=e.languages[c])&&(o[1]=l(s,i,c))):t(o):"string"!=typeof o&&t([o]))}}(t.tokens)}))}(C),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(C),function(e){var t=e.languages.javascript,n=/\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})+\}/.source,r="(@(?:arg|argument|param|property)\\s+(?:"+n+"\\s+)?)";e.languages.jsdoc=e.languages.extend("javadoclike",{parameter:{pattern:RegExp(r+/(?:(?!\s)[$\w\xA0-\uFFFF.])+(?=\s|$)/.source),lookbehind:!0,inside:{punctuation:/\./}}}),e.languages.insertBefore("jsdoc","keyword",{"optional-parameter":{pattern:RegExp(r+/\[(?:(?!\s)[$\w\xA0-\uFFFF.])+(?:=[^[\]]+)?\](?=\s|$)/.source),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:t,alias:"language-javascript"},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(/(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\s+(?:<TYPE>\s+)?)[A-Z]\w*(?:\.[A-Z]\w*)*/.source.replace(/<TYPE>/g,(function(){return n}))),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp("(@[a-z]+\\s+)"+n),lookbehind:!0,inside:{string:t.string,number:t.number,boolean:t.boolean,keyword:e.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:t,alias:"language-javascript"}}}}),e.languages.javadoclike.addSupport("javascript",e.languages.jsdoc)}(C),function(e){e.languages.flow=e.languages.extend("javascript",{}),e.languages.insertBefore("flow","keyword",{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:"class-name"}]}),e.languages.flow["function-variable"].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete e.languages.flow.parameter,e.languages.insertBefore("flow","operator",{"flow-punctuation":{pattern:/\{\||\|\}/,alias:"punctuation"}}),Array.isArray(e.languages.flow.keyword)||(e.languages.flow.keyword=[e.languages.flow.keyword]),e.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0})}(C),C.languages.n4js=C.languages.extend("javascript",{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),C.languages.insertBefore("n4js","constant",{annotation:{pattern:/@+\w+/,alias:"operator"}}),C.languages.n4jsd=C.languages.n4js,function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r<n.length;r++){var a=n[r],o=e.languages.javascript[a];a=(o="RegExp"===e.util.type(o)?e.languages.javascript[a]={pattern:o}:o).inside||{};(o.inside=a)["maybe-class-name"]=/^[A-Z][\s\S]*/}}(C),function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,a=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function o(e,t){return e=e.replace(/<S>/g,(function(){return n})).replace(/<BRACES>/g,(function(){return r})).replace(/<SPREAD>/g,(function(){return a})),RegExp(e,t)}function s(t){for(var n=[],r=0;r<t.length;r++){var a=t[r],o=!1;"string"!=typeof a&&("tag"===a.type&&a.content[0]&&"tag"===a.content[0].type?"</"===a.content[0].content[0].content?0<n.length&&n[n.length-1].tagName===i(a.content[0].content[1])&&n.pop():"/>"!==a.content[a.content.length-1].content&&n.push({tagName:i(a.content[0].content[1]),openedBraces:0}):0<n.length&&"punctuation"===a.type&&"{"===a.content?n[n.length-1].openedBraces++:0<n.length&&0<n[n.length-1].openedBraces&&"punctuation"===a.type&&"}"===a.content?n[n.length-1].openedBraces--:o=!0),(o||"string"==typeof a)&&0<n.length&&0===n[n.length-1].openedBraces&&(o=i(a),r<t.length-1&&("string"==typeof t[r+1]||"plain-text"===t[r+1].type)&&(o+=i(t[r+1]),t.splice(r+1,1)),0<r&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(o=i(t[r-1])+o,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",o,null,o)),a.content&&"string"!=typeof a.content&&s(a.content)}}a=o(a).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:o(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(i).join(""):""};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||s(e.tokens)}))}(C),function(e){var t=e.util.clone(e.languages.typescript);(t=(e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"],e.languages.tsx.tag)).pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+t.pattern.source+")",t.pattern.flags),t.lookbehind=!0}(C),C.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},C.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=C.languages.swift})),function(e){e.languages.kotlin=e.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin["class-name"];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),e.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(C),C.languages.c=C.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),C.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),C.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},C.languages.c.string],char:C.languages.c.char,comment:C.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:C.languages.c}}}}),C.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete C.languages.c.boolean,C.languages.objectivec=C.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete C.languages.objectivec["class-name"],C.languages.objc=C.languages.objectivec,C.languages.reason=C.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),C.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete C.languages.reason.function,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,(function(){return t}));t=t.replace(/<self>/g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(C),C.languages.go=C.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),C.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete C.languages.go["class-name"],function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(C),C.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},C.languages.python["string-interpolation"].inside.interpolation.inside.rest=C.languages.python,C.languages.py=C.languages.python;((e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})})({},{dracula:()=>T,duotoneDark:()=>A,duotoneLight:()=>P,github:()=>R,jettwaveDark:()=>H,jettwaveLight:()=>G,nightOwl:()=>L,nightOwlLight:()=>N,oceanicNext:()=>I,okaidia:()=>M,oneDark:()=>W,oneLight:()=>V,palenight:()=>F,shadesOfPurple:()=>B,synthwave84:()=>z,ultramin:()=>$,vsDark:()=>U,vsLight:()=>q});var T={plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},A={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]},P={plain:{backgroundColor:"#faf8f5",color:"#728fcb"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#b6ad9a"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#063289"}},{types:["property","function"],style:{color:"#b29762"}},{types:["tag-id","selector","atrule-id"],style:{color:"#2d2006"}},{types:["attr-name"],style:{color:"#896724"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule"],style:{color:"#728fcb"}},{types:["placeholder","variable"],style:{color:"#93abdc"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#896724"}}]},R={plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},L={plain:{color:"#d6deeb",backgroundColor:"#011627"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(99, 119, 119)",fontStyle:"italic"}},{types:["string","url"],style:{color:"rgb(173, 219, 103)"}},{types:["variable"],style:{color:"rgb(214, 222, 235)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation"],style:{color:"rgb(199, 146, 234)"}},{types:["selector","doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(255, 203, 139)"}},{types:["tag","operator","keyword"],style:{color:"rgb(127, 219, 202)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["property"],style:{color:"rgb(128, 203, 196)"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}}]},N={plain:{color:"#403f53",backgroundColor:"#FBFBFB"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(72, 118, 214)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(152, 159, 177)",fontStyle:"italic"}},{types:["string","builtin","char","constant","url"],style:{color:"rgb(72, 118, 214)"}},{types:["variable"],style:{color:"rgb(201, 103, 101)"}},{types:["number"],style:{color:"rgb(170, 9, 130)"}},{types:["punctuation"],style:{color:"rgb(153, 76, 195)"}},{types:["function","selector","doctype"],style:{color:"rgb(153, 76, 195)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(17, 17, 17)"}},{types:["tag"],style:{color:"rgb(153, 76, 195)"}},{types:["operator","property","keyword","namespace"],style:{color:"rgb(12, 150, 155)"}},{types:["boolean"],style:{color:"rgb(188, 84, 84)"}}]},O="#c5a5c5",D="#8dc891",I={plain:{backgroundColor:"#282c34",color:"#ffffff"},styles:[{types:["attr-name"],style:{color:O}},{types:["attr-value"],style:{color:D}},{types:["comment","block-comment","prolog","doctype","cdata","shebang"],style:{color:"#999999"}},{types:["property","number","function-name","constant","symbol","deleted"],style:{color:"#5a9bcf"}},{types:["boolean"],style:{color:"#ff8b50"}},{types:["tag"],style:{color:"#fc929e"}},{types:["string"],style:{color:D}},{types:["punctuation"],style:{color:D}},{types:["selector","char","builtin","inserted"],style:{color:"#D8DEE9"}},{types:["function"],style:{color:"#79b6f2"}},{types:["operator","entity","url","variable"],style:{color:"#d7deea"}},{types:["keyword"],style:{color:O}},{types:["atrule","class-name"],style:{color:"#FAC863"}},{types:["important"],style:{fontWeight:"400"}},{types:["bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}}]},M={plain:{color:"#f8f8f2",backgroundColor:"#272822"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"#f92672",fontStyle:"italic"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"#8292a2",fontStyle:"italic"}},{types:["string","url"],style:{color:"#a6e22e"}},{types:["variable"],style:{color:"#f8f8f2"}},{types:["number"],style:{color:"#ae81ff"}},{types:["builtin","char","constant","function","class-name"],style:{color:"#e6db74"}},{types:["punctuation"],style:{color:"#f8f8f2"}},{types:["selector","doctype"],style:{color:"#a6e22e",fontStyle:"italic"}},{types:["tag","operator","keyword"],style:{color:"#66d9ef"}},{types:["boolean"],style:{color:"#ae81ff"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)",opacity:.7}},{types:["tag","property"],style:{color:"#f92672"}},{types:["attr-name"],style:{color:"#a6e22e !important"}},{types:["doctype"],style:{color:"#8292a2"}},{types:["rule"],style:{color:"#e6db74"}}]},F={plain:{color:"#bfc7d5",backgroundColor:"#292d3e"},styles:[{types:["comment"],style:{color:"rgb(105, 112, 152)",fontStyle:"italic"}},{types:["string","inserted"],style:{color:"rgb(195, 232, 141)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation","selector"],style:{color:"rgb(199, 146, 234)"}},{types:["variable"],style:{color:"rgb(191, 199, 213)"}},{types:["class-name","attr-name"],style:{color:"rgb(255, 203, 107)"}},{types:["tag","deleted"],style:{color:"rgb(255, 85, 114)"}},{types:["operator"],style:{color:"rgb(137, 221, 255)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["keyword"],style:{fontStyle:"italic"}},{types:["doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}},{types:["url"],style:{color:"rgb(221, 221, 221)"}}]},B={plain:{color:"#9EFEFF",backgroundColor:"#2D2A55"},styles:[{types:["changed"],style:{color:"rgb(255, 238, 128)"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)"}},{types:["comment"],style:{color:"rgb(179, 98, 255)",fontStyle:"italic"}},{types:["punctuation"],style:{color:"rgb(255, 255, 255)"}},{types:["constant"],style:{color:"rgb(255, 98, 140)"}},{types:["string","url"],style:{color:"rgb(165, 255, 144)"}},{types:["variable"],style:{color:"rgb(255, 238, 128)"}},{types:["number","boolean"],style:{color:"rgb(255, 98, 140)"}},{types:["attr-name"],style:{color:"rgb(255, 180, 84)"}},{types:["keyword","operator","property","namespace","tag","selector","doctype"],style:{color:"rgb(255, 157, 0)"}},{types:["builtin","char","constant","function","class-name"],style:{color:"rgb(250, 208, 0)"}}]},z={plain:{backgroundColor:"linear-gradient(to bottom, #2a2139 75%, #34294f)",backgroundImage:"#34294f",color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"},styles:[{types:["comment","block-comment","prolog","doctype","cdata"],style:{color:"#495495",fontStyle:"italic"}},{types:["punctuation"],style:{color:"#ccc"}},{types:["tag","attr-name","namespace","number","unit","hexcode","deleted"],style:{color:"#e2777a"}},{types:["property","selector"],style:{color:"#72f1b8",textShadow:"0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475"}},{types:["function-name"],style:{color:"#6196cc"}},{types:["boolean","selector-id","function"],style:{color:"#fdfdfd",textShadow:"0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975"}},{types:["class-name","maybe-class-name","builtin"],style:{color:"#fff5f6",textShadow:"0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75"}},{types:["constant","symbol"],style:{color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"}},{types:["important","atrule","keyword","selector-class"],style:{color:"#f4eee4",textShadow:"0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575"}},{types:["string","char","attr-value","regex","variable"],style:{color:"#f87c32"}},{types:["parameter"],style:{fontStyle:"italic"}},{types:["entity","url"],style:{color:"#67cdcc"}},{types:["operator"],style:{color:"ffffffee"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["entity"],style:{cursor:"help"}},{types:["inserted"],style:{color:"green"}}]},$={plain:{color:"#282a2e",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(197, 200, 198)"}},{types:["string","number","builtin","variable"],style:{color:"rgb(150, 152, 150)"}},{types:["class-name","function","tag","attr-name"],style:{color:"rgb(40, 42, 46)"}}]},U={plain:{color:"#9CDCFE",backgroundColor:"#1E1E1E"},styles:[{types:["prolog"],style:{color:"rgb(0, 0, 128)"}},{types:["comment"],style:{color:"rgb(106, 153, 85)"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"rgb(86, 156, 214)"}},{types:["number","inserted"],style:{color:"rgb(181, 206, 168)"}},{types:["constant"],style:{color:"rgb(100, 102, 149)"}},{types:["attr-name","variable"],style:{color:"rgb(156, 220, 254)"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"rgb(206, 145, 120)"}},{types:["selector"],style:{color:"rgb(215, 186, 125)"}},{types:["tag"],style:{color:"rgb(78, 201, 176)"}},{types:["tag"],languages:["markup"],style:{color:"rgb(86, 156, 214)"}},{types:["punctuation","operator"],style:{color:"rgb(212, 212, 212)"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"rgb(220, 220, 170)"}},{types:["class-name"],style:{color:"rgb(78, 201, 176)"}},{types:["char"],style:{color:"rgb(209, 105, 105)"}}]},q={plain:{color:"#000000",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(0, 128, 0)"}},{types:["builtin"],style:{color:"rgb(0, 112, 193)"}},{types:["number","variable","inserted"],style:{color:"rgb(9, 134, 88)"}},{types:["operator"],style:{color:"rgb(0, 0, 0)"}},{types:["constant","char"],style:{color:"rgb(129, 31, 63)"}},{types:["tag"],style:{color:"rgb(128, 0, 0)"}},{types:["attr-name"],style:{color:"rgb(255, 0, 0)"}},{types:["deleted","string"],style:{color:"rgb(163, 21, 21)"}},{types:["changed","punctuation"],style:{color:"rgb(4, 81, 165)"}},{types:["function","keyword"],style:{color:"rgb(0, 0, 255)"}},{types:["class-name"],style:{color:"rgb(38, 127, 153)"}}]},H={plain:{color:"#f8fafc",backgroundColor:"#011627"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#569CD6"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#f8fafc"}},{types:["attr-name","variable"],style:{color:"#9CDCFE"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#cbd5e1"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#D4D4D4"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#7dd3fc"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},G={plain:{color:"#0f172a",backgroundColor:"#f1f5f9"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#0c4a6e"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#0f172a"}},{types:["attr-name","variable"],style:{color:"#0c4a6e"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#64748b"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#475569"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#0e7490"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},W={plain:{backgroundColor:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(220, 10%, 40%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(220, 14%, 71%)"}},{types:["attr-name","class-name","maybe-class-name","boolean","constant","number","atrule"],style:{color:"hsl(29, 54%, 61%)"}},{types:["keyword"],style:{color:"hsl(286, 60%, 67%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(355, 65%, 65%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value"],style:{color:"hsl(95, 38%, 62%)"}},{types:["variable","operator","function"],style:{color:"hsl(207, 82%, 66%)"}},{types:["url"],style:{color:"hsl(187, 47%, 55%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(220, 14%, 71%)"}}]},V={plain:{backgroundColor:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(230, 4%, 64%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(230, 8%, 24%)"}},{types:["attr-name","class-name","boolean","constant","number","atrule"],style:{color:"hsl(35, 99%, 36%)"}},{types:["keyword"],style:{color:"hsl(301, 63%, 40%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(5, 74%, 59%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value","punctuation"],style:{color:"hsl(119, 34%, 47%)"}},{types:["variable","operator","function"],style:{color:"hsl(221, 87%, 60%)"}},{types:["url"],style:{color:"hsl(198, 99%, 37%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(230, 8%, 24%)"}}]},K=(e,t)=>{const{plain:n}=e,r=e.styles.reduce(((e,n)=>{const{languages:r,style:a}=n;return r&&!r.includes(t)||n.types.forEach((t=>{const n=j(j({},e[t]),a);e[t]=n})),e}),{});return r.root=n,r.plain=_(j({},n),{backgroundColor:void 0}),r},Q=/\r\n|\r|\n/,Y=e=>{0===e.length?e.push({types:["plain"],content:"\n",empty:!0}):1===e.length&&""===e[0].content&&(e[0].content="\n",e[0].empty=!0)},Z=(e,t)=>{const n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},X=e=>{const t=[[]],n=[e],r=[0],a=[e.length];let o=0,s=0,i=[];const l=[i];for(;s>-1;){for(;(o=r[s]++)<a[s];){let e,c=t[s];const u=n[s][o];if("string"==typeof u?(c=s>0?c:["plain"],e=u):(c=Z(c,u.type),u.alias&&(c=Z(c,u.alias)),e=u.content),"string"!=typeof e){s++,t.push(c),n.push(e),r.push(0),a.push(e.length);continue}const d=e.split(Q),p=d.length;i.push({types:c,content:d[0]});for(let t=1;t<p;t++)Y(i),l.push(i=[]),i.push({types:c,content:d[t]})}s--,t.pop(),n.pop(),r.pop(),a.pop()}return Y(i),l},J=({children:e,language:t,code:n,theme:r,prism:a})=>{const o=t.toLowerCase(),s=((e,t)=>{const[n,r]=(0,u.useState)(K(t,e)),a=(0,u.useRef)(),o=(0,u.useRef)();return(0,u.useEffect)((()=>{t===a.current&&e===o.current||(a.current=t,o.current=e,r(K(t,e)))}),[e,t]),n})(o,r),i=(e=>(0,u.useCallback)((t=>{var n=t,{className:r,style:a,line:o}=n,s=S(n,["className","style","line"]);const i=_(j({},s),{className:(0,d.A)("token-line",r)});return"object"==typeof e&&"plain"in e&&(i.style=e.plain),"object"==typeof a&&(i.style=j(j({},i.style||{}),a)),i}),[e]))(s),l=(e=>{const t=(0,u.useCallback)((({types:t,empty:n})=>{if(null!=e)return 1===t.length&&"plain"===t[0]?null!=n?{display:"inline-block"}:void 0:1===t.length&&null!=n?e[t[0]]:Object.assign(null!=n?{display:"inline-block"}:{},...t.map((t=>e[t])))}),[e]);return(0,u.useCallback)((e=>{var n=e,{token:r,className:a,style:o}=n,s=S(n,["token","className","style"]);const i=_(j({},s),{className:(0,d.A)("token",...r.types,a),children:r.content,style:t(r)});return null!=o&&(i.style=j(j({},i.style||{}),o)),i}),[t])})(s),c=(({prism:e,code:t,grammar:n,language:r})=>{const a=(0,u.useRef)(e);return(0,u.useMemo)((()=>{if(null==n)return X([t]);const e={code:t,grammar:n,language:r,tokens:[]};return a.current.hooks.run("before-tokenize",e),e.tokens=a.current.tokenize(t,n),a.current.hooks.run("after-tokenize",e),X(e.tokens)}),[t,n,r])})({prism:a,language:o,code:n,grammar:a.languages[o]});return e({tokens:c,className:`prism-code language-${o}`,style:null!=s?s.root:{},getLineProps:i,getTokenProps:l})},ee=e=>(0,u.createElement)(J,_(j({},e),{prism:e.prism||C,theme:e.theme||U,code:e.code,language:e.language}))},1635:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__addDisposableResource:()=>O,__assign:()=>o,__asyncDelegator:()=>S,__asyncGenerator:()=>_,__asyncValues:()=>E,__await:()=>j,__awaiter:()=>f,__classPrivateFieldGet:()=>R,__classPrivateFieldIn:()=>N,__classPrivateFieldSet:()=>L,__createBinding:()=>h,__decorate:()=>i,__disposeResources:()=>I,__esDecorate:()=>c,__exportStar:()=>b,__extends:()=>a,__generator:()=>m,__importDefault:()=>P,__importStar:()=>A,__makeTemplateObject:()=>C,__metadata:()=>g,__param:()=>l,__propKey:()=>d,__read:()=>y,__rest:()=>s,__runInitializers:()=>u,__setFunctionName:()=>p,__spread:()=>w,__spreadArray:()=>k,__spreadArrays:()=>x,__values:()=>v,default:()=>M});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},o.apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}function i(e,t,n,r){var a,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var i=e.length-1;i>=0;i--)(a=e[i])&&(s=(o<3?a(s):o>3?a(t,n,s):a(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function l(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r,a,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?r.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),p=!1,g=n.length-1;g>=0;g--){var f={};for(var m in r)f[m]="access"===m?{}:r[m];for(var m in r.access)f.access[m]=r.access[m];f.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var h=(0,n[g])("accessor"===l?{get:d.get,set:d.set}:d[c],f);if("accessor"===l){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(i=s(h.get))&&(d.get=i),(i=s(h.set))&&(d.set=i),(i=s(h.init))&&a.unshift(i)}else(i=s(h))&&("field"===l?a.unshift(i):d[c]=i)}u&&Object.defineProperty(u,r.name,d),p=!0}function u(e,t,n){for(var r=arguments.length>2,a=0;a<t.length;a++)n=r?t[a].call(e,n):t[a].call(e);return r?n:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function p(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function g(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,n,r){return new(n||(n=Promise))((function(a,o){function s(e){try{l(r.next(e))}catch(t){o(t)}}function i(e){try{l(r.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,i)}l((r=r.apply(e,t||[])).next())}))}function m(e,t){var n,r,a,o,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(s=0)),s;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(a=s.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){s.label=i[1];break}if(6===i[0]&&s.label<a[1]){s.label=a[1],a=i;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(i);break}a[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(l){i=[6,l],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var h=Object.create?function(e,t,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function b(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||h(t,e,n)}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(i){a={error:i}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return s}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(y(arguments[t]));return e}function x(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),a=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,i=o.length;s<i;s++,a++)r[a]=o[s];return r}function k(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}function j(e){return this instanceof j?(this.v=e,this):new j(e)}function _(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,a=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){a[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||i(e,t)}))})}function i(e,t){try{(n=a[e](t)).value instanceof j?Promise.resolve(n.value.v).then(l,c):u(o[0][2],n)}catch(r){u(o[0][3],r)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function u(e,t){e(t),o.shift(),o.length&&i(o[0][0],o[0][1])}}function S(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,a){t[r]=e[r]?function(t){return(n=!n)?{value:j(e[r](t)),done:!1}:a?a(t):t}:a}}function E(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=v(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,a){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,a,(t=e[n](t)).done,t.value)}))}}}function C(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function A(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&h(t,e,n);return T(t,e),t}function P(e){return e&&e.__esModule?e:{default:e}}function R(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function L(e,t,n,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,n):a?a.value=n:t.set(e,n),n}function N(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function O(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose]}if("function"!=typeof r)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var D="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function I(e){function t(t){e.error=e.hasError?new D(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var r=e.stack.pop();try{var a=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(a).then(n,(function(e){return t(e),n()}))}catch(o){t(o)}}if(e.hasError)throw e.error}()}const M={__extends:a,__assign:o,__rest:s,__decorate:i,__param:l,__metadata:g,__awaiter:f,__generator:m,__createBinding:h,__exportStar:b,__values:v,__read:y,__spread:w,__spreadArrays:x,__spreadArray:k,__await:j,__asyncGenerator:_,__asyncDelegator:S,__asyncValues:E,__makeTemplateObject:C,__importStar:A,__importDefault:P,__classPrivateFieldGet:R,__classPrivateFieldSet:L,__classPrivateFieldIn:N,__addDisposableResource:O,__disposeResources:I}},2654:e=>{"use strict";e.exports={}},4054:e=>{"use strict";e.exports=JSON.parse('{"/jest-preset-angular/search-948":{"__comp":"1a4e3797","__context":{"plugin":"c141421f"}},"/jest-preset-angular/versions-4c3":{"__comp":"fa17a3e5","__context":{"plugin":"a7456010"},"config":"5e9f5e1a"},"/jest-preset-angular/docs-fe4":{"__comp":"5e95c892","__context":{"plugin":"aba21aa0"}},"/jest-preset-angular/docs/10.x-c5a":{"__comp":"a7bd4aaa","__props":"c9f7f11b"},"/jest-preset-angular/docs/10.x-33a":{"__comp":"a94703ab"},"/jest-preset-angular/docs/10.x/-b2c":{"__comp":"17896441","content":"6608151e"},"/jest-preset-angular/docs/10.x/getting-started/installation-60d":{"__comp":"17896441","content":"54071611"},"/jest-preset-angular/docs/10.x/getting-started/options-309":{"__comp":"17896441","content":"252e2b80"},"/jest-preset-angular/docs/10.x/getting-started/presets-df8":{"__comp":"17896441","content":"04b3fc6c"},"/jest-preset-angular/docs/10.x/getting-started/test-environment-f83":{"__comp":"17896441","content":"c00c612c"},"/jest-preset-angular/docs/10.x/guides/absolute-imports-9ce":{"__comp":"17896441","content":"cd9c57cb"},"/jest-preset-angular/docs/10.x/guides/angular-ivy-2ca":{"__comp":"17896441","content":"494f4f5e"},"/jest-preset-angular/docs/10.x/guides/esm-support-c9e":{"__comp":"17896441","content":"c49413db"},"/jest-preset-angular/docs/10.x/guides/jsdom-version-d6d":{"__comp":"17896441","content":"f3212b1e"},"/jest-preset-angular/docs/10.x/guides/troubleshooting-8eb":{"__comp":"17896441","content":"22e4d634"},"/jest-preset-angular/docs/10.x/guides/using-with-babel-e67":{"__comp":"17896441","content":"df70a34a"},"/jest-preset-angular/docs/10.x/processing-800":{"__comp":"17896441","content":"8afa1348"},"/jest-preset-angular/docs/11.0-0f1":{"__comp":"a7bd4aaa","__props":"dc033a20"},"/jest-preset-angular/docs/11.0-d0d":{"__comp":"a94703ab"},"/jest-preset-angular/docs/11.0/-92b":{"__comp":"17896441","content":"151633a5"},"/jest-preset-angular/docs/11.0/getting-started/installation-6f7":{"__comp":"17896441","content":"6916680a"},"/jest-preset-angular/docs/11.0/getting-started/options-a09":{"__comp":"17896441","content":"c7279284"},"/jest-preset-angular/docs/11.0/getting-started/presets-1f3":{"__comp":"17896441","content":"fa9f2ace"},"/jest-preset-angular/docs/11.0/getting-started/test-environment-e4e":{"__comp":"17896441","content":"afba4106"},"/jest-preset-angular/docs/11.0/guides/absolute-imports-6d4":{"__comp":"17896441","content":"d2df711a"},"/jest-preset-angular/docs/11.0/guides/angular-13+-dfe":{"__comp":"17896441","content":"d069ae84"},"/jest-preset-angular/docs/11.0/guides/angular-ivy-345":{"__comp":"17896441","content":"8b263414"},"/jest-preset-angular/docs/11.0/guides/esm-support-da9":{"__comp":"17896441","content":"9251a350"},"/jest-preset-angular/docs/11.0/guides/jsdom-version-133":{"__comp":"17896441","content":"710ad8a9"},"/jest-preset-angular/docs/11.0/guides/troubleshooting-3c7":{"__comp":"17896441","content":"ec1d9510"},"/jest-preset-angular/docs/11.0/guides/using-with-babel-635":{"__comp":"17896441","content":"51d67042"},"/jest-preset-angular/docs/11.0/processing-df5":{"__comp":"17896441","content":"ecfacc56"},"/jest-preset-angular/docs/11.1-d95":{"__comp":"a7bd4aaa","__props":"f67ebb5d"},"/jest-preset-angular/docs/11.1-d6c":{"__comp":"a94703ab"},"/jest-preset-angular/docs/11.1/-92d":{"__comp":"17896441","content":"5ae6b2db"},"/jest-preset-angular/docs/11.1/getting-started/installation-120":{"__comp":"17896441","content":"8665e647"},"/jest-preset-angular/docs/11.1/getting-started/options-aea":{"__comp":"17896441","content":"eae657ee"},"/jest-preset-angular/docs/11.1/getting-started/presets-950":{"__comp":"17896441","content":"29d26392"},"/jest-preset-angular/docs/11.1/getting-started/test-environment-bcf":{"__comp":"17896441","content":"5ee9d842"},"/jest-preset-angular/docs/11.1/guides/absolute-imports-b70":{"__comp":"17896441","content":"ea131d77"},"/jest-preset-angular/docs/11.1/guides/angular-13+-911":{"__comp":"17896441","content":"aad144a3"},"/jest-preset-angular/docs/11.1/guides/angular-ivy-5fe":{"__comp":"17896441","content":"f43def45"},"/jest-preset-angular/docs/11.1/guides/esm-support-bd0":{"__comp":"17896441","content":"e0a3f9c8"},"/jest-preset-angular/docs/11.1/guides/jsdom-version-66e":{"__comp":"17896441","content":"dd8b0175"},"/jest-preset-angular/docs/11.1/guides/troubleshooting-9ba":{"__comp":"17896441","content":"9fc1d339"},"/jest-preset-angular/docs/11.1/guides/using-with-babel-ebf":{"__comp":"17896441","content":"029bedf1"},"/jest-preset-angular/docs/11.1/processing-213":{"__comp":"17896441","content":"daab97c5"},"/jest-preset-angular/docs/12.0-47d":{"__comp":"a7bd4aaa","__props":"5d23d50c"},"/jest-preset-angular/docs/12.0-fc1":{"__comp":"a94703ab"},"/jest-preset-angular/docs/12.0/-f02":{"__comp":"17896441","content":"f14ecac0"},"/jest-preset-angular/docs/12.0/getting-started/installation-bc2":{"__comp":"17896441","content":"5f85402d"},"/jest-preset-angular/docs/12.0/getting-started/options-e20":{"__comp":"17896441","content":"48dd39e2"},"/jest-preset-angular/docs/12.0/getting-started/presets-1b2":{"__comp":"17896441","content":"04ae74d1"},"/jest-preset-angular/docs/12.0/getting-started/test-environment-728":{"__comp":"17896441","content":"80b4c599"},"/jest-preset-angular/docs/12.0/guides/absolute-imports-cf8":{"__comp":"17896441","content":"47cccd8d"},"/jest-preset-angular/docs/12.0/guides/angular-13+-50a":{"__comp":"17896441","content":"68e3f1d5"},"/jest-preset-angular/docs/12.0/guides/angular-ivy-299":{"__comp":"17896441","content":"433cefd8"},"/jest-preset-angular/docs/12.0/guides/esm-support-9d0":{"__comp":"17896441","content":"a389e28e"},"/jest-preset-angular/docs/12.0/guides/jsdom-version-c29":{"__comp":"17896441","content":"a7d61b99"},"/jest-preset-angular/docs/12.0/guides/troubleshooting-f19":{"__comp":"17896441","content":"fea96f18"},"/jest-preset-angular/docs/12.0/guides/using-with-babel-55f":{"__comp":"17896441","content":"0e35f71d"},"/jest-preset-angular/docs/12.0/processing-f76":{"__comp":"17896441","content":"13973f06"},"/jest-preset-angular/docs/13.0-6aa":{"__comp":"a7bd4aaa","__props":"d30d9744"},"/jest-preset-angular/docs/13.0-c9d":{"__comp":"a94703ab"},"/jest-preset-angular/docs/13.0/-e71":{"__comp":"17896441","content":"9bc9e25c"},"/jest-preset-angular/docs/13.0/getting-started/installation-caa":{"__comp":"17896441","content":"6059e070"},"/jest-preset-angular/docs/13.0/getting-started/options-8b9":{"__comp":"17896441","content":"aa079c8b"},"/jest-preset-angular/docs/13.0/getting-started/presets-857":{"__comp":"17896441","content":"5b1cb890"},"/jest-preset-angular/docs/13.0/getting-started/test-environment-955":{"__comp":"17896441","content":"732c3ce9"},"/jest-preset-angular/docs/13.0/guides/absolute-imports-64f":{"__comp":"17896441","content":"6d1ddfa7"},"/jest-preset-angular/docs/13.0/guides/angular-13+-66d":{"__comp":"17896441","content":"44b4d73b"},"/jest-preset-angular/docs/13.0/guides/angular-ivy-a5c":{"__comp":"17896441","content":"2e81e74f"},"/jest-preset-angular/docs/13.0/guides/esm-support-a12":{"__comp":"17896441","content":"d9330f66"},"/jest-preset-angular/docs/13.0/guides/jsdom-version-a9b":{"__comp":"17896441","content":"56acf0ae"},"/jest-preset-angular/docs/13.0/guides/troubleshooting-5d8":{"__comp":"17896441","content":"d1b207fe"},"/jest-preset-angular/docs/13.0/guides/using-with-babel-d5e":{"__comp":"17896441","content":"9a2fa73a"},"/jest-preset-angular/docs/13.0/processing-01b":{"__comp":"17896441","content":"30388853"},"/jest-preset-angular/docs/14.0-c74":{"__comp":"a7bd4aaa","__props":"c1865e7c"},"/jest-preset-angular/docs/14.0-95f":{"__comp":"a94703ab"},"/jest-preset-angular/docs/14.0/-ee9":{"__comp":"17896441","content":"c1bdbc58"},"/jest-preset-angular/docs/14.0/getting-started/installation-43c":{"__comp":"17896441","content":"85e14910"},"/jest-preset-angular/docs/14.0/getting-started/options-417":{"__comp":"17896441","content":"ebf39289"},"/jest-preset-angular/docs/14.0/getting-started/presets-eae":{"__comp":"17896441","content":"9798ce17"},"/jest-preset-angular/docs/14.0/getting-started/test-environment-99d":{"__comp":"17896441","content":"9d48492b"},"/jest-preset-angular/docs/14.0/guides/absolute-imports-23b":{"__comp":"17896441","content":"05916282"},"/jest-preset-angular/docs/14.0/guides/angular-13+-b8a":{"__comp":"17896441","content":"388d3430"},"/jest-preset-angular/docs/14.0/guides/angular-ivy-dc9":{"__comp":"17896441","content":"1a5572f6"},"/jest-preset-angular/docs/14.0/guides/esm-support-11f":{"__comp":"17896441","content":"26cb42b7"},"/jest-preset-angular/docs/14.0/guides/jsdom-version-0e5":{"__comp":"17896441","content":"0dc350cc"},"/jest-preset-angular/docs/14.0/guides/troubleshooting-bc2":{"__comp":"17896441","content":"c62dfc48"},"/jest-preset-angular/docs/14.0/guides/using-with-babel-37f":{"__comp":"17896441","content":"6f809103"},"/jest-preset-angular/docs/14.0/processing-886":{"__comp":"17896441","content":"b2161dc5"},"/jest-preset-angular/docs/14.2-bba":{"__comp":"a7bd4aaa","__props":"f2ed1a27"},"/jest-preset-angular/docs/14.2-3b9":{"__comp":"a94703ab"},"/jest-preset-angular/docs/14.2/-933":{"__comp":"17896441","content":"2ab18ce5"},"/jest-preset-angular/docs/14.2/getting-started/installation-e1d":{"__comp":"17896441","content":"3c7caf67"},"/jest-preset-angular/docs/14.2/getting-started/options-366":{"__comp":"17896441","content":"ef2f3ccd"},"/jest-preset-angular/docs/14.2/getting-started/presets-cfc":{"__comp":"17896441","content":"1e388ac9"},"/jest-preset-angular/docs/14.2/getting-started/test-environment-94e":{"__comp":"17896441","content":"6a6dcee7"},"/jest-preset-angular/docs/14.2/guides/absolute-imports-8dc":{"__comp":"17896441","content":"b83f237d"},"/jest-preset-angular/docs/14.2/guides/angular-13+-b38":{"__comp":"17896441","content":"a89007e0"},"/jest-preset-angular/docs/14.2/guides/angular-ivy-803":{"__comp":"17896441","content":"203fc93e"},"/jest-preset-angular/docs/14.2/guides/esm-support-c59":{"__comp":"17896441","content":"4b3f866b"},"/jest-preset-angular/docs/14.2/guides/jsdom-version-823":{"__comp":"17896441","content":"1438ea8f"},"/jest-preset-angular/docs/14.2/guides/snapshot-testing-61d":{"__comp":"17896441","content":"33a5adb4"},"/jest-preset-angular/docs/14.2/guides/troubleshooting-83d":{"__comp":"17896441","content":"dff5aaca"},"/jest-preset-angular/docs/14.2/guides/using-with-babel-b29":{"__comp":"17896441","content":"c4ba122c"},"/jest-preset-angular/docs/14.2/processing-178":{"__comp":"17896441","content":"b4c5bdfe"},"/jest-preset-angular/docs/14.3-6c0":{"__comp":"a7bd4aaa","__props":"8e1736e0"},"/jest-preset-angular/docs/14.3-ab5":{"__comp":"a94703ab"},"/jest-preset-angular/docs/14.3/-338":{"__comp":"17896441","content":"327b6d8e"},"/jest-preset-angular/docs/14.3/getting-started/installation-501":{"__comp":"17896441","content":"af572879"},"/jest-preset-angular/docs/14.3/getting-started/options-cb7":{"__comp":"17896441","content":"8f3baa16"},"/jest-preset-angular/docs/14.3/getting-started/presets-c5d":{"__comp":"17896441","content":"ec7d5e88"},"/jest-preset-angular/docs/14.3/getting-started/test-environment-bc7":{"__comp":"17896441","content":"2a474b18"},"/jest-preset-angular/docs/14.3/guides/absolute-imports-7e9":{"__comp":"17896441","content":"5465ebbc"},"/jest-preset-angular/docs/14.3/guides/angular-13+-0bc":{"__comp":"17896441","content":"4941928a"},"/jest-preset-angular/docs/14.3/guides/angular-ivy-e84":{"__comp":"17896441","content":"5253afba"},"/jest-preset-angular/docs/14.3/guides/esm-support-23e":{"__comp":"17896441","content":"27af8d7b"},"/jest-preset-angular/docs/14.3/guides/jsdom-version-c45":{"__comp":"17896441","content":"164a8de7"},"/jest-preset-angular/docs/14.3/guides/snapshot-testing-179":{"__comp":"17896441","content":"44821296"},"/jest-preset-angular/docs/14.3/guides/troubleshooting-ada":{"__comp":"17896441","content":"08804573"},"/jest-preset-angular/docs/14.3/guides/using-with-babel-54a":{"__comp":"17896441","content":"15a051c9"},"/jest-preset-angular/docs/14.3/processing-a28":{"__comp":"17896441","content":"097bb47a"},"/jest-preset-angular/docs/8.x-8a9":{"__comp":"a7bd4aaa","__props":"58f4fbf7"},"/jest-preset-angular/docs/8.x-4af":{"__comp":"a94703ab"},"/jest-preset-angular/docs/8.x/-0b7":{"__comp":"17896441","content":"651850eb"},"/jest-preset-angular/docs/8.x/getting-started/installation-def":{"__comp":"17896441","content":"02a1e558"},"/jest-preset-angular/docs/8.x/getting-started/options-157":{"__comp":"17896441","content":"6266f1ba"},"/jest-preset-angular/docs/8.x/getting-started/presets-ed1":{"__comp":"17896441","content":"c44fa306"},"/jest-preset-angular/docs/8.x/getting-started/test-environment-e7a":{"__comp":"17896441","content":"7aeeadd4"},"/jest-preset-angular/docs/8.x/guides/absolute-imports-1be":{"__comp":"17896441","content":"f97daad0"},"/jest-preset-angular/docs/8.x/guides/angular-ivy-2a9":{"__comp":"17896441","content":"9903dc99"},"/jest-preset-angular/docs/8.x/guides/esm-support-307":{"__comp":"17896441","content":"2ae17008"},"/jest-preset-angular/docs/8.x/guides/jsdom-version-665":{"__comp":"17896441","content":"f0447160"},"/jest-preset-angular/docs/8.x/guides/troubleshooting-431":{"__comp":"17896441","content":"72f058d3"},"/jest-preset-angular/docs/8.x/guides/using-with-babel-67d":{"__comp":"17896441","content":"b647df5a"},"/jest-preset-angular/docs/8.x/processing-4b6":{"__comp":"17896441","content":"adb64ee2"},"/jest-preset-angular/docs/9.x-da2":{"__comp":"a7bd4aaa","__props":"7d7dbec2"},"/jest-preset-angular/docs/9.x-94d":{"__comp":"a94703ab"},"/jest-preset-angular/docs/9.x/-b80":{"__comp":"17896441","content":"e1715838"},"/jest-preset-angular/docs/9.x/getting-started/installation-c83":{"__comp":"17896441","content":"27299a3b"},"/jest-preset-angular/docs/9.x/getting-started/options-278":{"__comp":"17896441","content":"63150b11"},"/jest-preset-angular/docs/9.x/getting-started/presets-7e4":{"__comp":"17896441","content":"79ea3e73"},"/jest-preset-angular/docs/9.x/getting-started/test-environment-470":{"__comp":"17896441","content":"0d71a3f1"},"/jest-preset-angular/docs/9.x/guides/absolute-imports-f80":{"__comp":"17896441","content":"a74b641e"},"/jest-preset-angular/docs/9.x/guides/angular-ivy-6a2":{"__comp":"17896441","content":"d720bb60"},"/jest-preset-angular/docs/9.x/guides/esm-support-b35":{"__comp":"17896441","content":"5635425a"},"/jest-preset-angular/docs/9.x/guides/jsdom-version-3c3":{"__comp":"17896441","content":"407f8801"},"/jest-preset-angular/docs/9.x/guides/troubleshooting-fcc":{"__comp":"17896441","content":"a9789633"},"/jest-preset-angular/docs/9.x/guides/using-with-babel-bef":{"__comp":"17896441","content":"93f0793d"},"/jest-preset-angular/docs/9.x/processing-e78":{"__comp":"17896441","content":"f546eb96"},"/jest-preset-angular/docs/next-d93":{"__comp":"a7bd4aaa","__props":"25e9e857"},"/jest-preset-angular/docs/next-16c":{"__comp":"a94703ab"},"/jest-preset-angular/docs/next/-dcf":{"__comp":"17896441","content":"a09c2993"},"/jest-preset-angular/docs/next/getting-started/installation-444":{"__comp":"17896441","content":"54f44165"},"/jest-preset-angular/docs/next/getting-started/options-542":{"__comp":"17896441","content":"4e0c07c5"},"/jest-preset-angular/docs/next/getting-started/presets-567":{"__comp":"17896441","content":"fc80686b"},"/jest-preset-angular/docs/next/getting-started/test-environment-3d5":{"__comp":"17896441","content":"1a421168"},"/jest-preset-angular/docs/next/guides/absolute-imports-b3d":{"__comp":"17896441","content":"d19b9e8a"},"/jest-preset-angular/docs/next/guides/angular-13+-e37":{"__comp":"17896441","content":"5b125e0e"},"/jest-preset-angular/docs/next/guides/angular-ivy-476":{"__comp":"17896441","content":"14b133ce"},"/jest-preset-angular/docs/next/guides/esm-support-c82":{"__comp":"17896441","content":"d4836a8e"},"/jest-preset-angular/docs/next/guides/jsdom-version-ad1":{"__comp":"17896441","content":"4351d34b"},"/jest-preset-angular/docs/next/guides/snapshot-testing-760":{"__comp":"17896441","content":"68240572"},"/jest-preset-angular/docs/next/guides/troubleshooting-241":{"__comp":"17896441","content":"03be7dae"},"/jest-preset-angular/docs/next/guides/using-with-babel-15c":{"__comp":"17896441","content":"47c825a2"},"/jest-preset-angular/docs/next/processing-87c":{"__comp":"17896441","content":"eabdbf07"},"/jest-preset-angular/docs-93b":{"__comp":"a7bd4aaa","__props":"bb70b9c8"},"/jest-preset-angular/docs-317":{"__comp":"a94703ab"},"/jest-preset-angular/docs/-ad3":{"__comp":"17896441","content":"915eea02"},"/jest-preset-angular/docs/getting-started/installation-8ea":{"__comp":"17896441","content":"09df063d"},"/jest-preset-angular/docs/getting-started/options-124":{"__comp":"17896441","content":"e5a27df7"},"/jest-preset-angular/docs/getting-started/presets-257":{"__comp":"17896441","content":"e59053ae"},"/jest-preset-angular/docs/getting-started/test-environment-f40":{"__comp":"17896441","content":"dd1da75d"},"/jest-preset-angular/docs/guides/absolute-imports-9aa":{"__comp":"17896441","content":"e36b815f"},"/jest-preset-angular/docs/guides/angular-13+-921":{"__comp":"17896441","content":"d957c22b"},"/jest-preset-angular/docs/guides/angular-ivy-79f":{"__comp":"17896441","content":"3b270bcb"},"/jest-preset-angular/docs/guides/esm-support-91e":{"__comp":"17896441","content":"357d33d4"},"/jest-preset-angular/docs/guides/jsdom-version-0db":{"__comp":"17896441","content":"1d8e39f8"},"/jest-preset-angular/docs/guides/snapshot-testing-067":{"__comp":"17896441","content":"a05464cd"},"/jest-preset-angular/docs/guides/troubleshooting-adf":{"__comp":"17896441","content":"a7d04da7"},"/jest-preset-angular/docs/guides/using-with-babel-7e1":{"__comp":"17896441","content":"fbd32610"},"/jest-preset-angular/docs/processing-585":{"__comp":"17896441","content":"95451dd5"},"/jest-preset-angular/-c4f":{"__comp":"1df93b7f","__context":{"plugin":"a7456010"},"config":"5e9f5e1a"}}')}},e=>{e.O(0,[1869],(()=>{return t=5022,e(e.s=t);var t}));e.O()}]); \ No newline at end of file diff --git a/assets/js/main.bef18837.js b/assets/js/main.bef18837.js new file mode 100644 index 0000000000..1437967353 --- /dev/null +++ b/assets/js/main.bef18837.js @@ -0,0 +1,2 @@ +/*! For license information please see main.bef18837.js.LICENSE.txt */ +(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8792],{3219:(e,t,n)=>{"use strict";n.d(t,{Bc:()=>C,E8:()=>Zn,a1:()=>Yn});var r=n(6540);n(961);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t,n,r,o,a,s){try{var i=e[a](s),l=i.value}catch(e){return void n(e)}i.done?t(l):Promise.resolve(l).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var s=e.apply(t,n);function i(e){a(s,r,o,i,l,"next",e)}function l(e){a(s,r,o,i,l,"throw",e)}i(void 0)}))}}function i(e,t,n){return t=p(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,g()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(null,arguments)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(g=function(){return!!e})()}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function b(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function v(){v=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof b?t:b,s=Object.create(a.prototype),i=new T(r||[]);return o(s,"_invoke",{value:O(e,n,i)}),s}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",g="executing",m="completed",h={};function b(){}function y(){}function w(){}var x={};c(x,s,(function(){return this}));var j=Object.getPrototypeOf,k=j&&j(j(I([])));k&&k!==n&&r.call(k,s)&&(x=k);var S=w.prototype=b.prototype=Object.create(x);function _(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(o,a,s,i){var l=d(e[o],e,a);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==typeof u&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,s,i)}),(function(e){n("throw",e,s,i)})):t.resolve(u).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,i)}))}i(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,s){if(o===g)throw Error("Generator is already running");if(o===m){if("throw"===a)throw s;return{value:e,done:!0}}for(r.method=a,r.arg=s;;){var i=r.delegate;if(i){var l=C(i,r);if(l){if(l===h)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?m:f,c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var a=d(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,h;var s=a.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,h):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return y.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:y,configurable:!0}),y.displayName=c(w,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,c(e,l,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},_(E.prototype),c(E.prototype,i,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var s=new E(u(e,n,r,o),a);return t.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},_(S),c(S,l,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),h}},t}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,s,i=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return i}}(e,t)||j(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function k(e){var t="function"==typeof Map?new Map:void 0;return k=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(g())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&y(o,n.prototype),o}(e,arguments,p(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,e)},k(e)}function S(){return r.createElement("svg",{width:"15",height:"15",className:"DocSearch-Control-Key-Icon"},r.createElement("path",{d:"M4.505 4.496h2M5.505 5.496v5M8.216 4.496l.055 5.993M10 7.5c.333.333.5.667.5 1v2M12.326 4.5v5.996M8.384 4.496c1.674 0 2.116 0 2.116 1.5s-.442 1.5-2.116 1.5M3.205 9.303c-.09.448-.277 1.21-1.241 1.203C1 10.5.5 9.513.5 8V7c0-1.57.5-2.5 1.464-2.494.964.006 1.134.598 1.24 1.342M12.553 10.5h1.953",strokeWidth:"1.2",stroke:"currentColor",fill:"none",strokeLinecap:"square"}))}function _(){return r.createElement("svg",{width:"20",height:"20",className:"DocSearch-Search-Icon",viewBox:"0 0 20 20","aria-hidden":"true"},r.createElement("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",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}var E=["translations"],O="Ctrl",C=r.forwardRef((function(e,t){var n=e.translations,o=void 0===n?{}:n,a=b(e,E),s=o.buttonText,i=void 0===s?"Search":s,l=o.buttonAriaLabel,c=void 0===l?"Search":l,u=w((0,r.useState)(null),2),p=u[0],f=u[1];(0,r.useEffect)((function(){"undefined"!=typeof navigator&&(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?f("\u2318"):f(O))}),[]);var g=w(p===O?[O,"Ctrl",r.createElement(S,null)]:["Meta","Command",p],3),m=g[0],h=g[1],v=g[2];return r.createElement("button",d({type:"button",className:"DocSearch DocSearch-Button","aria-label":"".concat(c," (").concat(h,"+K)")},a,{ref:t}),r.createElement("span",{className:"DocSearch-Button-Container"},r.createElement(_,null),r.createElement("span",{className:"DocSearch-Button-Placeholder"},i)),r.createElement("span",{className:"DocSearch-Button-Keys"},null!==p&&r.createElement(r.Fragment,null,r.createElement(A,{reactsToKey:m},v),r.createElement(A,{reactsToKey:"k"},"K"))))}));function A(e){var t=e.reactsToKey,n=e.children,o=w((0,r.useState)(!1),2),a=o[0],s=o[1];return(0,r.useEffect)((function(){if(t)return window.addEventListener("keydown",e),window.addEventListener("keyup",n),function(){window.removeEventListener("keydown",e),window.removeEventListener("keyup",n)};function e(e){e.key===t&&s(!0)}function n(e){e.key!==t&&"Meta"!==e.key||s(!1)}}),[t]),r.createElement("kbd",{className:a?"DocSearch-Button-Key DocSearch-Button-Key--pressed":"DocSearch-Button-Key"},n)}function P(e,t){var n=void 0;return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];n&&clearTimeout(n),n=setTimeout((function(){return e.apply(void 0,o)}),t)}}function T(e){return e.reduce((function(e,t){return e.concat(t)}),[])}var I=0;function R(e){return 0===e.collections.length?0:e.collections.reduce((function(e,t){return e+t.items.length}),0)}function N(e){return e!==Object(e)}function L(e,t){if(e===t)return!0;if(N(e)||N(t)||"function"==typeof e||"function"==typeof t)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];if(!(o in t))return!1;if(!L(e[o],t[o]))return!1}return!0}var D=function(){},M=[{segment:"autocomplete-core",version:"1.17.7"}];function F(e){var t=e.item,n=e.items,r=void 0===n?[]:n;return{index:t.__autocomplete_indexName,items:[t],positions:[1+r.findIndex((function(e){return e.objectID===t.objectID}))],queryID:t.__autocomplete_queryID,algoliaSource:["autocomplete"]}}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var z=["items"],U=["items"];function q(e){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(e)}function $(e){return function(e){if(Array.isArray(e))return H(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return H(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function V(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach((function(t){K(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function K(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==q(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==q(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===q(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q(e){return e.map((function(e){var t=e.items,n=V(e,z);return W(W({},n),{},{objectIDs:(null==t?void 0:t.map((function(e){return e.objectID})))||n.objectIDs})}))}function Y(e){var t,n,r,o=(t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,s,i=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t);else for(;!(l=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((e.version||"").split(".").map(Number),2),n=t[0],r=t[1],n>=3||2===n&&r>=4||1===n&&r>=10);function a(t,n,r){if(o&&void 0!==r){var a=r[0].__autocomplete_algoliaCredentials,s={"X-Algolia-Application-Id":a.appId,"X-Algolia-API-Key":a.apiKey};e.apply(void 0,[t].concat($(n),[{headers:s}]))}else e.apply(void 0,[t].concat($(n)))}return{init:function(t,n){e("init",{appId:t,apiKey:n})},setAuthenticatedUserToken:function(t){e("setAuthenticatedUserToken",t)},setUserToken:function(t){e("setUserToken",t)},clickedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&a("clickedObjectIDsAfterSearch",Q(t),t[0].items)},clickedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&a("clickedObjectIDs",Q(t),t[0].items)},clickedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,["clickedFilters"].concat(n))},convertedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&a("convertedObjectIDsAfterSearch",Q(t),t[0].items)},convertedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&a("convertedObjectIDs",Q(t),t[0].items)},convertedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,["convertedFilters"].concat(n))},viewedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length>0&&t.reduce((function(e,t){var n=t.items,r=V(t,U);return[].concat($(e),$(function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,n=[],r=0;r<e.objectIDs.length;r+=t)n.push(W(W({},e),{},{objectIDs:e.objectIDs.slice(r,r+t)}));return n}(W(W({},r),{},{objectIDs:(null==n?void 0:n.map((function(e){return e.objectID})))||r.objectIDs})).map((function(e){return{items:n,payload:e}}))))}),[]).forEach((function(e){var t=e.items;return a("viewedObjectIDs",[e.payload],t)}))},viewedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,["viewedFilters"].concat(n))}}}function Z(e){var t=e.items.reduce((function(e,t){var n;return e[t.__autocomplete_indexName]=(null!==(n=e[t.__autocomplete_indexName])&&void 0!==n?n:[]).concat(t),e}),{});return Object.keys(t).map((function(e){return{index:e,items:t[e],algoliaSource:["autocomplete"]}}))}function J(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function X(e){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(e)}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?te(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){oe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function oe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==X(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==X(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===X(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ae="2.15.0",se="https://cdn.jsdelivr.net/npm/search-insights@".concat(ae,"/dist/search-insights.min.js"),ie=P((function(e){var t=e.onItemsChange,n=e.items,r=e.insights,o=e.state;t({insights:r,insightsEvents:Z({items:n}).map((function(e){return re({eventName:"Items Viewed"},e)})),state:o})}),400);function le(e){var t=function(e){return re({onItemsChange:function(e){var t=e.insights,n=e.insightsEvents,r=e.state;t.viewedObjectIDs.apply(t,ee(n.map((function(e){return re(re({},e),{},{algoliaSource:ce(e.algoliaSource,r.context)})}))))},onSelect:function(e){var t=e.insights,n=e.insightsEvents,r=e.state;t.clickedObjectIDsAfterSearch.apply(t,ee(n.map((function(e){return re(re({},e),{},{algoliaSource:ce(e.algoliaSource,r.context)})}))))},onActive:D,__autocomplete_clickAnalytics:!0},e)}(e),n=t.insightsClient,r=t.insightsInitParams,o=t.onItemsChange,a=t.onSelect,s=t.onActive,i=t.__autocomplete_clickAnalytics,l=n;if(n||"undefined"!=typeof window&&function(e){var t=e.window,n=t.AlgoliaAnalyticsObject||"aa";"string"==typeof n&&(l=t[n]),l||(t.AlgoliaAnalyticsObject=n,t[n]||(t[n]=function(){t[n].queue||(t[n].queue=[]);for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];t[n].queue.push(r)}),t[n].version=ae,l=t[n],function(e){var t="[Autocomplete]: Could not load search-insights.js. Please load it manually following https://alg.li/insights-autocomplete";try{var n=e.document.createElement("script");n.async=!0,n.src=se,n.onerror=function(){console.error(t)},document.body.appendChild(n)}catch(e){console.error(t)}}(t))}({window:window}),!l)return{};r&&l("init",re({partial:!0},r));var c=Y(l),u={current:[]},d=P((function(e){var t=e.state;if(t.isOpen){var n=t.collections.reduce((function(e,t){return[].concat(ee(e),ee(t.items))}),[]).filter(J);L(u.current.map((function(e){return e.objectID})),n.map((function(e){return e.objectID})))||(u.current=n,n.length>0&&ie({onItemsChange:o,items:n,insights:c,state:t}))}}),0);return{name:"aa.algoliaInsightsPlugin",subscribe:function(e){var t=e.setContext,n=e.onSelect,r=e.onActive,o=!1;function u(e){t({algoliaInsightsPlugin:{__algoliaSearchParameters:re(re({},i?{clickAnalytics:!0}:{}),e?{userToken:ue(e)}:{}),insights:c}})}l("addAlgoliaAgent","insights-plugin"),u(),l("onUserTokenChange",(function(e){o||u(e)})),l("getUserToken",null,(function(e,t){o||u(t)})),l("onAuthenticatedUserTokenChange",(function(e){e?(o=!0,u(e)):(o=!1,l("getUserToken",null,(function(e,t){return u(t)})))})),l("getAuthenticatedUserToken",null,(function(e,t){t&&(o=!0,u(t))})),n((function(e){var t=e.item,n=e.state,r=e.event,o=e.source;J(t)&&a({state:n,event:r,insights:c,item:t,insightsEvents:[re({eventName:"Item Selected"},F({item:t,items:o.getItems().filter(J)}))]})})),r((function(e){var t=e.item,n=e.source,r=e.state,o=e.event;J(t)&&s({state:r,event:o,insights:c,item:t,insightsEvents:[re({eventName:"Item Active"},F({item:t,items:n.getItems().filter(J)}))]})}))},onStateChange:function(e){var t=e.state;d({state:t})},__autocomplete_pluginOptions:e}}function ce(){var e,t=arguments.length>1?arguments[1]:void 0;return[].concat(ee(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),["autocomplete-internal"],ee(null!==(e=t.algoliaInsightsPlugin)&&void 0!==e&&e.__automaticInsights?["autocomplete-automatic"]:[]))}function ue(e){return"number"==typeof e?e.toString():e}function de(e,t){var n=t;return{then:function(t,r){return de(e.then(fe(t,n,e),fe(r,n,e)),n)},catch:function(t){return de(e.catch(fe(t,n,e)),n)},finally:function(t){return t&&n.onCancelList.push(t),de(e.finally(fe(t&&function(){return n.onCancelList=[],t()},n,e)),n)},cancel:function(){n.isCanceled=!0;var e=n.onCancelList;n.onCancelList=[],e.forEach((function(e){e()}))},isCanceled:function(){return!0===n.isCanceled}}}function pe(e){return de(e,{isCanceled:!1,onCancelList:[]})}function fe(e,t,n){return e?function(n){return t.isCanceled?n:e(n)}:n}function ge(e,t,n,r){if(!n)return null;if(e<0&&(null===t||null!==r&&0===t))return n+e;var o=(null===t?-1:t)+e;return o<=-1||o>=n?null===r?null:0:o}function me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function he(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?me(Object(n),!0).forEach((function(t){be(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function be(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==ve(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==ve(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===ve(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ve(e){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ve(e)}function ye(e){var t=function(e){var t=e.collections.map((function(e){return e.items.length})).reduce((function(e,t,n){var r=(e[n-1]||0)+t;return e.push(r),e}),[]).reduce((function(t,n){return n<=e.activeItemId?t+1:t}),0);return e.collections[t]}(e);if(!t)return null;var n=t.items[function(e){for(var t=e.state,n=e.collection,r=!1,o=0,a=0;!1===r;){var s=t.collections[o];if(s===n){r=!0;break}a+=s.items.length,o++}return t.activeItemId-a}({state:e,collection:t})],r=t.source;return{item:n,itemInputValue:r.getItemInputValue({item:n,state:e}),itemUrl:r.getItemUrl({item:n,state:e}),source:r}}function we(e,t,n){return[e,null==n?void 0:n.sourceId,t].filter(Boolean).join("-").replace(/\s/g,"")}var xe=/((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i;function je(e){return e.nativeEvent||e}function ke(e){return ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ke(e)}function Se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _e(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==ke(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==ke(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===ke(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e){return Ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ee(e)}function Oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Oe(Object(n),!0).forEach((function(t){Ae(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ae(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Ee(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==Ee(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Ee(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pe(e){return Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pe(e)}function Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(n),!0).forEach((function(t){Ne(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ne(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Pe(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==Pe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Pe(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(e,t){var n,r="undefined"!=typeof window?window:{},o=e.plugins||[];return Re(Re({debug:!1,openOnFocus:!1,enterKeyHint:void 0,ignoreCompositionEvents:!1,placeholder:"",autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,insights:void 0,environment:r,shouldPanelOpen:function(e){return R(e.state)>0},reshape:function(e){return e.sources}},e),{},{id:null!==(n=e.id)&&void 0!==n?n:"autocomplete-".concat(I++),plugins:o,initialState:Re({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var n;null===(n=e.onStateChange)||void 0===n||n.call(e,t),o.forEach((function(e){var n;return null===(n=e.onStateChange)||void 0===n?void 0:n.call(e,t)}))},onSubmit:function(t){var n;null===(n=e.onSubmit)||void 0===n||n.call(e,t),o.forEach((function(e){var n;return null===(n=e.onSubmit)||void 0===n?void 0:n.call(e,t)}))},onReset:function(t){var n;null===(n=e.onReset)||void 0===n||n.call(e,t),o.forEach((function(e){var n;return null===(n=e.onReset)||void 0===n?void 0:n.call(e,t)}))},getSources:function(n){return Promise.all([].concat(function(e){return function(e){if(Array.isArray(e))return Te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Te(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(o.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,t){var n=[];return Promise.resolve(e(t)).then((function(e){return Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,n.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));n.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:D,onResolve:D};Object.keys(t).forEach((function(e){t[e].__default=!0}));var r=he(he({},t),e);return Promise.resolve(r)})))}))}(e,n)}))).then((function(e){return T(e)})).then((function(e){return e.map((function(e){return Re(Re({},e),{},{onSelect:function(n){e.onSelect(n),t.forEach((function(e){var t;return null===(t=e.onSelect)||void 0===t?void 0:t.call(e,n)}))},onActive:function(n){e.onActive(n),t.forEach((function(e){var t;return null===(t=e.onActive)||void 0===t?void 0:t.call(e,n)}))},onResolve:function(n){e.onResolve(n),t.forEach((function(e){var t;return null===(t=e.onResolve)||void 0===t?void 0:t.call(e,n)}))}})}))}))},navigator:Re({navigate:function(e){var t=e.itemUrl;r.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=r.open(t,"_blank","noopener");null==n||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;r.open(t,"_blank","noopener")}},e.navigator)})}function De(e){return De="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},De(e)}function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach((function(t){Be(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Be(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==De(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==De(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===De(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ze(e){return ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ze(e)}function Ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(n),!0).forEach((function(t){$e(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $e(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==ze(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==ze(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===ze(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function He(e){return function(e){if(Array.isArray(e))return Ve(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ve(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ge(e){return Boolean(e.execute)}function We(e){var t=e.reduce((function(e,t){if(!Ge(t))return e.push(t),e;var n=t.searchClient,r=t.execute,o=t.requesterId,a=t.requests,s=e.find((function(e){return Ge(t)&&Ge(e)&&e.searchClient===n&&Boolean(o)&&e.requesterId===o}));if(s){var i;(i=s.items).push.apply(i,He(a))}else{var l={execute:r,requesterId:o,items:a,searchClient:n};e.push(l)}return e}),[]).map((function(e){if(!Ge(e))return Promise.resolve(e);var t=e,n=t.execute,r=t.items;return n({searchClient:t.searchClient,requests:r})}));return Promise.all(t).then((function(e){return T(e)}))}function Ke(e){return Ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ke(e)}var Qe=["event","nextState","props","query","refresh","store"];function Ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ye(Object(n),!0).forEach((function(t){Je(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ye(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Je(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Ke(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==Ke(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Ke(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xe,et,tt,nt=null,rt=(Xe=-1,et=-1,tt=void 0,function(e){var t=++Xe;return Promise.resolve(e).then((function(e){return tt&&t<et?tt:(et=t,tt=e,e)}))});function ot(e){var t=e.event,n=e.nextState,r=void 0===n?{}:n,o=e.props,a=e.query,s=e.refresh,i=e.store,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Qe);nt&&o.environment.clearTimeout(nt);var c=l.setCollections,u=l.setIsOpen,d=l.setQuery,p=l.setActiveItemId,f=l.setStatus,g=l.setContext;if(d(a),p(o.defaultActiveItemId),!a&&!1===o.openOnFocus){var m,h=i.getState().collections.map((function(e){return Ze(Ze({},e),{},{items:[]})}));f("idle"),c(h),u(null!==(m=r.isOpen)&&void 0!==m?m:o.shouldPanelOpen({state:i.getState()}));var b=pe(rt(h).then((function(){return Promise.resolve()})));return i.pendingRequests.add(b)}f("loading"),nt=o.environment.setTimeout((function(){f("stalled")}),o.stallThreshold);var v=pe(rt(o.getSources(Ze({query:a,refresh:s,state:i.getState()},l)).then((function(e){return Promise.all(e.map((function(e){return Promise.resolve(e.getItems(Ze({query:a,refresh:s,state:i.getState()},l))).then((function(t){return function(e,t,n){if(o=e,Boolean(null==o?void 0:o.execute)){var r="algolia"===e.requesterId?Object.assign.apply(Object,[{}].concat(He(Object.keys(n.context).map((function(e){var t;return null===(t=n.context[e])||void 0===t?void 0:t.__algoliaSearchParameters}))))):{};return qe(qe({},e),{},{requests:e.queries.map((function(n){return{query:"algolia"===e.requesterId?qe(qe({},n),{},{params:qe(qe({},r),n.params)}):n,sourceId:t,transformResponse:e.transformResponse}}))})}var o;return{items:e,sourceId:t}}(t,e.sourceId,i.getState())}))}))).then(We).then((function(t){var n,r=t.some((function(e){return function(e){return!Array.isArray(e)&&Boolean(null==e?void 0:e._automaticInsights)}(e.items)}));return r&&g({algoliaInsightsPlugin:Ze(Ze({},(null===(n=i.getState().context)||void 0===n?void 0:n.algoliaInsightsPlugin)||{}),{},{__automaticInsights:r})}),function(e,t,n){return t.map((function(t){var r,o=e.filter((function(e){return e.sourceId===t.sourceId})),a=o.map((function(e){return e.items})),s=o[0].transformResponse,i=s?s({results:r=a,hits:r.map((function(e){return e.hits})).filter(Boolean),facetHits:r.map((function(e){var t;return null===(t=e.facetHits)||void 0===t?void 0:t.map((function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}}))})).filter(Boolean)}):a;return t.onResolve({source:t,results:a,items:i,state:n.getState()}),i.every(Boolean),'The `getItems` function from source "'.concat(t.sourceId,'" must return an array of items but returned ').concat(JSON.stringify(void 0),".\n\nDid you forget to return items?\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems"),{source:t,items:i}}))}(t,e,i)})).then((function(e){return function(e){var t=e.props,n=e.state,r=e.collections.reduce((function(e,t){return Fe(Fe({},e),{},Be({},t.source.sourceId,Fe(Fe({},t.source),{},{getItems:function(){return T(t.items)}})))}),{}),o=t.plugins.reduce((function(e,t){return t.reshape?t.reshape(e):e}),{sourcesBySourceId:r,state:n}).sourcesBySourceId;return T(t.reshape({sourcesBySourceId:o,sources:Object.values(o),state:n})).filter(Boolean).map((function(e){return{source:e,items:e.getItems()}}))}({collections:e,props:o,state:i.getState()})}))})))).then((function(e){var n;f("idle"),c(e);var d=o.shouldPanelOpen({state:i.getState()});u(null!==(n=r.isOpen)&&void 0!==n?n:o.openOnFocus&&!a&&d||d);var p=ye(i.getState());if(null!==i.getState().activeItemId&&p){var g=p.item,m=p.itemInputValue,h=p.itemUrl,b=p.source;b.onActive(Ze({event:t,item:g,itemInputValue:m,itemUrl:h,refresh:s,source:b,state:i.getState()},l))}})).finally((function(){f("idle"),nt&&o.environment.clearTimeout(nt)}));return i.pendingRequests.add(v)}function at(e){return at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},at(e)}var st=["event","props","refresh","store"];function it(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function lt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?it(Object(n),!0).forEach((function(t){ct(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):it(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ct(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==at(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==at(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===at(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ut(e){return ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ut(e)}var dt=["props","refresh","store"],pt=["inputElement","formElement","panelElement"],ft=["inputElement"],gt=["inputElement","maxLength"],mt=["source"],ht=["item","source"];function bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function vt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bt(Object(n),!0).forEach((function(t){yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==ut(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==ut(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===ut(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wt(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function xt(e){var t=e.props,n=e.refresh,r=e.store,o=wt(e,dt);return{getEnvironmentProps:function(e){var n=e.inputElement,o=e.formElement,a=e.panelElement;function s(e){!r.getState().isOpen&&r.pendingRequests.isEmpty()||e.target===n||!1===[o,a].some((function(t){return(n=t)===(r=e.target)||n.contains(r);var n,r}))&&(r.dispatch("blur",null),t.debug||r.pendingRequests.cancelAll())}return vt({onTouchStart:s,onMouseDown:s,onTouchMove:function(e){!1!==r.getState().isOpen&&n===t.environment.document.activeElement&&e.target!==n&&n.blur()}},wt(e,pt))},getRootProps:function(e){return vt({role:"combobox","aria-expanded":r.getState().isOpen,"aria-haspopup":"listbox","aria-controls":r.getState().isOpen?r.getState().collections.map((function(e){var n=e.source;return we(t.id,"list",n)})).join(" "):void 0,"aria-labelledby":we(t.id,"label")},e)},getFormProps:function(e){return e.inputElement,vt({action:"",noValidate:!0,role:"search",onSubmit:function(a){var s;a.preventDefault(),t.onSubmit(vt({event:a,refresh:n,state:r.getState()},o)),r.dispatch("submit",null),null===(s=e.inputElement)||void 0===s||s.blur()},onReset:function(a){var s;a.preventDefault(),t.onReset(vt({event:a,refresh:n,state:r.getState()},o)),r.dispatch("reset",null),null===(s=e.inputElement)||void 0===s||s.focus()}},wt(e,ft))},getLabelProps:function(e){return vt({htmlFor:we(t.id,"input"),id:we(t.id,"label")},e)},getInputProps:function(e){var a;function s(e){(t.openOnFocus||Boolean(r.getState().query))&&ot(vt({event:e,props:t,query:r.getState().completion||r.getState().query,refresh:n,store:r},o)),r.dispatch("focus",null)}var i=e||{};i.inputElement;var l=i.maxLength,c=void 0===l?512:l,u=wt(i,gt),d=ye(r.getState()),p=function(e){return Boolean(e&&e.match(xe))}((null===(a=t.environment.navigator)||void 0===a?void 0:a.userAgent)||""),f=t.enterKeyHint||(null!=d&&d.itemUrl&&!p?"go":"search");return vt({"aria-autocomplete":"both","aria-activedescendant":r.getState().isOpen&&null!==r.getState().activeItemId?we(t.id,"item-".concat(r.getState().activeItemId),null==d?void 0:d.source):void 0,"aria-controls":r.getState().isOpen?r.getState().collections.map((function(e){var n=e.source;return we(t.id,"list",n)})).join(" "):void 0,"aria-labelledby":we(t.id,"label"),value:r.getState().completion||r.getState().query,id:we(t.id,"input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:f,spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:c,type:"search",onChange:function(e){var a=e.currentTarget.value;t.ignoreCompositionEvents&&je(e).isComposing?o.setQuery(a):ot(vt({event:e,props:t,query:a.slice(0,c),refresh:n,store:r},o))},onCompositionEnd:function(e){ot(vt({event:e,props:t,query:e.currentTarget.value.slice(0,c),refresh:n,store:r},o))},onKeyDown:function(e){je(e).isComposing||function(e){var t=e.event,n=e.props,r=e.refresh,o=e.store,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,st);if("ArrowUp"===t.key||"ArrowDown"===t.key){var s=function(){var e=ye(o.getState()),t=n.environment.document.getElementById(we(n.id,"item-".concat(o.getState().activeItemId),null==e?void 0:e.source));t&&(t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded(!1):t.scrollIntoView(!1))},i=function(){var e=ye(o.getState());if(null!==o.getState().activeItemId&&e){var n=e.item,s=e.itemInputValue,i=e.itemUrl,l=e.source;l.onActive(lt({event:t,item:n,itemInputValue:s,itemUrl:i,refresh:r,source:l,state:o.getState()},a))}};t.preventDefault(),!1===o.getState().isOpen&&(n.openOnFocus||Boolean(o.getState().query))?ot(lt({event:t,props:n,query:o.getState().query,refresh:r,store:o},a)).then((function(){o.dispatch(t.key,{nextActiveItemId:n.defaultActiveItemId}),i(),setTimeout(s,0)})):(o.dispatch(t.key,{}),i(),s())}else if("Escape"===t.key)t.preventDefault(),o.dispatch(t.key,null),o.pendingRequests.cancelAll();else if("Tab"===t.key)o.dispatch("blur",null),o.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===o.getState().activeItemId||o.getState().collections.every((function(e){return 0===e.items.length})))return void(n.debug||o.pendingRequests.cancelAll());t.preventDefault();var l=ye(o.getState()),c=l.item,u=l.itemInputValue,d=l.itemUrl,p=l.source;if(t.metaKey||t.ctrlKey)void 0!==d&&(p.onSelect(lt({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:p,state:o.getState()},a)),n.navigator.navigateNewTab({itemUrl:d,item:c,state:o.getState()}));else if(t.shiftKey)void 0!==d&&(p.onSelect(lt({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:p,state:o.getState()},a)),n.navigator.navigateNewWindow({itemUrl:d,item:c,state:o.getState()}));else if(t.altKey);else{if(void 0!==d)return p.onSelect(lt({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:p,state:o.getState()},a)),void n.navigator.navigate({itemUrl:d,item:c,state:o.getState()});ot(lt({event:t,nextState:{isOpen:!1},props:n,query:u,refresh:r,store:o},a)).then((function(){p.onSelect(lt({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:p,state:o.getState()},a))}))}}}(vt({event:e,props:t,refresh:n,store:r},o))},onFocus:s,onBlur:D,onClick:function(n){e.inputElement!==t.environment.document.activeElement||r.getState().isOpen||s(n)}},u)},getPanelProps:function(e){return vt({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){r.dispatch("mouseleave",null)}},e)},getListProps:function(e){var n=e||{},r=n.source,o=wt(n,mt);return vt({role:"listbox","aria-labelledby":we(t.id,"label"),id:we(t.id,"list",r)},o)},getItemProps:function(e){var a=e.item,s=e.source,i=wt(e,ht);return vt({id:we(t.id,"item-".concat(a.__autocomplete_id),s),role:"option","aria-selected":r.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==r.getState().activeItemId){r.dispatch("mousemove",a.__autocomplete_id);var t=ye(r.getState());if(null!==r.getState().activeItemId&&t){var s=t.item,i=t.itemInputValue,l=t.itemUrl,c=t.source;c.onActive(vt({event:e,item:s,itemInputValue:i,itemUrl:l,refresh:n,source:c,state:r.getState()},o))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var i=s.getItemInputValue({item:a,state:r.getState()}),l=s.getItemUrl({item:a,state:r.getState()});(l?Promise.resolve():ot(vt({event:e,nextState:{isOpen:!1},props:t,query:i,refresh:n,store:r},o))).then((function(){s.onSelect(vt({event:e,item:a,itemInputValue:i,itemUrl:l,refresh:n,source:s,state:r.getState()},o))}))}},i)}}}function jt(e){return jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jt(e)}function kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kt(Object(n),!0).forEach((function(t){_t(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==jt(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==jt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===jt(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Et(e){var t,n,r,o,a=e.plugins,s=e.options,i=null===(t=((null===(n=s.__autocomplete_metadata)||void 0===n?void 0:n.userAgents)||[])[0])||void 0===t?void 0:t.segment,l=i?_t({},i,Object.keys((null===(r=s.__autocomplete_metadata)||void 0===r?void 0:r.options)||{})):{};return{plugins:a.map((function(e){return{name:e.name,options:Object.keys(e.__autocomplete_pluginOptions||[])}})),options:St({"autocomplete-core":Object.keys(s)},l),ua:M.concat((null===(o=s.__autocomplete_metadata)||void 0===o?void 0:o.userAgents)||[])}}function Ot(e){var t,n=e.state;return!1===n.isOpen||null===n.activeItemId?null:(null===(t=ye(n))||void 0===t?void 0:t.itemInputValue)||null}function Ct(e){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct(e)}function At(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?At(Object(n),!0).forEach((function(t){Tt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):At(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Tt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Ct(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==Ct(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Ct(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var It=function(e,t){switch(t.type){case"setActiveItemId":case"mousemove":return Pt(Pt({},e),{},{activeItemId:t.payload});case"setQuery":return Pt(Pt({},e),{},{query:t.payload,completion:null});case"setCollections":return Pt(Pt({},e),{},{collections:t.payload});case"setIsOpen":return Pt(Pt({},e),{},{isOpen:t.payload});case"setStatus":return Pt(Pt({},e),{},{status:t.payload});case"setContext":return Pt(Pt({},e),{},{context:Pt(Pt({},e.context),t.payload)});case"ArrowDown":var n=Pt(Pt({},e),{},{activeItemId:t.payload.hasOwnProperty("nextActiveItemId")?t.payload.nextActiveItemId:ge(1,e.activeItemId,R(e),t.props.defaultActiveItemId)});return Pt(Pt({},n),{},{completion:Ot({state:n})});case"ArrowUp":var r=Pt(Pt({},e),{},{activeItemId:ge(-1,e.activeItemId,R(e),t.props.defaultActiveItemId)});return Pt(Pt({},r),{},{completion:Ot({state:r})});case"Escape":return e.isOpen?Pt(Pt({},e),{},{activeItemId:null,isOpen:!1,completion:null}):Pt(Pt({},e),{},{activeItemId:null,query:"",status:"idle",collections:[]});case"submit":return Pt(Pt({},e),{},{activeItemId:null,isOpen:!1,status:"idle"});case"reset":return Pt(Pt({},e),{},{activeItemId:!0===t.props.openOnFocus?t.props.defaultActiveItemId:null,status:"idle",completion:null,query:""});case"focus":return Pt(Pt({},e),{},{activeItemId:t.props.defaultActiveItemId,isOpen:(t.props.openOnFocus||Boolean(e.query))&&t.props.shouldPanelOpen({state:e})});case"blur":return t.props.debug?e:Pt(Pt({},e),{},{isOpen:!1,activeItemId:null});case"mouseleave":return Pt(Pt({},e),{},{activeItemId:t.props.defaultActiveItemId});default:return"The reducer action ".concat(JSON.stringify(t.type)," is not supported."),e}};function Rt(e){return Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rt(e)}function Nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Lt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nt(Object(n),!0).forEach((function(t){Dt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Dt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Rt(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==Rt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Rt(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mt(e){var t=[],n=Le(e,t),r=function(e,t,n){var r,o=t.initialState;return{getState:function(){return o},dispatch:function(r,a){var s=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(n),!0).forEach((function(t){_e(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o);o=e(o,{type:r,props:t,payload:a}),n({state:o,prevState:s})},pendingRequests:(r=[],{add:function(e){return r.push(e),e.finally((function(){r=r.filter((function(t){return t!==e}))}))},cancelAll:function(){r.forEach((function(e){return e.cancel()}))},isEmpty:function(){return 0===r.length}})}}(It,n,(function(e){var t,r,a=e.prevState,c=e.state;if(n.onStateChange(Lt({prevState:a,state:c,refresh:s,navigator:n.navigator},o)),!l()&&null!==(t=c.context)&&void 0!==t&&null!==(r=t.algoliaInsightsPlugin)&&void 0!==r&&r.__automaticInsights&&!1!==n.insights){var u=le({__autocomplete_clickAnalytics:!1});n.plugins.push(u),i([u])}})),o=function(e){var t=e.store;return{setActiveItemId:function(e){t.dispatch("setActiveItemId",e)},setQuery:function(e){t.dispatch("setQuery",e)},setCollections:function(e){var n=0,r=e.map((function(e){return Ce(Ce({},e),{},{items:T(e.items).map((function(e){return Ce(Ce({},e),{},{__autocomplete_id:n++})}))})}));t.dispatch("setCollections",r)},setIsOpen:function(e){t.dispatch("setIsOpen",e)},setStatus:function(e){t.dispatch("setStatus",e)},setContext:function(e){t.dispatch("setContext",e)}}}({store:r}),a=xt(Lt({props:n,refresh:s,store:r,navigator:n.navigator},o));function s(){return ot(Lt({event:new Event("input"),nextState:{isOpen:r.getState().isOpen},props:n,navigator:n.navigator,query:r.getState().query,refresh:s,store:r},o))}function i(e){e.forEach((function(e){var r;return null===(r=e.subscribe)||void 0===r?void 0:r.call(e,Lt(Lt({},o),{},{navigator:n.navigator,refresh:s,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})},onResolve:function(e){t.push({onResolve:e})}}))}))}function l(){return n.plugins.some((function(e){return"aa.algoliaInsightsPlugin"===e.name}))}if(n.insights&&!l()){var c="boolean"==typeof n.insights?{}:n.insights;n.plugins.push(le(c))}return i(n.plugins),function(e){var t,n,r=e.metadata,o=e.environment;if(null===(t=o.navigator)||void 0===t||null===(n=t.userAgent)||void 0===n?void 0:n.includes("Algolia Crawler")){var a=o.document.createElement("meta"),s=o.document.querySelector("head");a.name="algolia:metadata",setTimeout((function(){a.content=JSON.stringify(r),s.appendChild(a)}),0)}}({metadata:Et({plugins:n.plugins,options:e}),environment:n.environment}),Lt(Lt({refresh:s,navigator:n.navigator},a),o)}function Ft(e){var t=e.translations,n=(void 0===t?{}:t).searchByText,o=void 0===n?"Search by":n;return r.createElement("a",{href:"https://www.algolia.com/ref/docsearch/?utm_source=".concat(window.location.hostname,"&utm_medium=referral&utm_content=powered_by&utm_campaign=docsearch"),target:"_blank",rel:"noopener noreferrer"},r.createElement("span",{className:"DocSearch-Label"},o),r.createElement("svg",{width:"77",height:"19","aria-label":"Algolia",role:"img",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 2196.2 500"},r.createElement("defs",null,r.createElement("style",null,".cls-1,.cls-2{fill:#003dff;}.cls-2{fill-rule:evenodd;}")),r.createElement("path",{className:"cls-2",d:"M1070.38,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"}),r.createElement("rect",{className:"cls-1",x:"1845.88",y:"104.73",width:"62.58",height:"277.9",rx:"5.9",ry:"5.9"}),r.createElement("path",{className:"cls-2",d:"M1851.78,71.38h50.77c3.26,0,5.9-2.64,5.9-5.9V5.9c0-3.62-3.24-6.39-6.82-5.83l-50.77,7.95c-2.87,.45-4.99,2.92-4.99,5.83v51.62c0,3.26,2.64,5.9,5.9,5.9Z"}),r.createElement("path",{className:"cls-2",d:"M1764.03,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"}),r.createElement("path",{className:"cls-2",d:"M1631.95,142.72c-11.14-12.25-24.83-21.65-40.78-28.31-15.92-6.53-33.26-9.85-52.07-9.85-18.78,0-36.15,3.17-51.92,9.85-15.59,6.66-29.29,16.05-40.76,28.31-11.47,12.23-20.38,26.87-26.76,44.03-6.38,17.17-9.24,37.37-9.24,58.36,0,20.99,3.19,36.87,9.55,54.21,6.38,17.32,15.14,32.11,26.45,44.36,11.29,12.23,24.83,21.62,40.6,28.46,15.77,6.83,40.12,10.33,52.4,10.48,12.25,0,36.78-3.82,52.7-10.48,15.92-6.68,29.46-16.23,40.78-28.46,11.29-12.25,20.05-27.04,26.25-44.36,6.22-17.34,9.24-33.22,9.24-54.21,0-20.99-3.34-41.19-10.03-58.36-6.38-17.17-15.14-31.8-26.43-44.03Zm-44.43,163.75c-11.47,15.75-27.56,23.7-48.09,23.7-20.55,0-36.63-7.8-48.1-23.7-11.47-15.75-17.21-34.01-17.21-61.2,0-26.89,5.59-49.14,17.06-64.87,11.45-15.75,27.54-23.52,48.07-23.52,20.55,0,36.63,7.78,48.09,23.52,11.47,15.57,17.36,37.98,17.36,64.87,0,27.19-5.72,45.3-17.19,61.2Z"}),r.createElement("path",{className:"cls-2",d:"M894.42,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"}),r.createElement("path",{className:"cls-2",d:"M2133.97,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"}),r.createElement("path",{className:"cls-2",d:"M1314.05,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-11.79,18.34-19.6,39.64-22.11,62.59-.58,5.3-.88,10.68-.88,16.14s.31,11.15,.93,16.59c4.28,38.09,23.14,71.61,50.66,94.52,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47h0c17.99,0,34.61-5.93,48.16-15.97,16.29-11.58,28.88-28.54,34.48-47.75v50.26h-.11v11.08c0,21.84-5.71,38.27-17.34,49.36-11.61,11.08-31.04,16.63-58.25,16.63-11.12,0-28.79-.59-46.6-2.41-2.83-.29-5.46,1.5-6.27,4.22l-12.78,43.11c-1.02,3.46,1.27,7.02,4.83,7.53,21.52,3.08,42.52,4.68,54.65,4.68,48.91,0,85.16-10.75,108.89-32.21,21.48-19.41,33.15-48.89,35.2-88.52V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,64.1s.65,139.13,0,143.36c-12.08,9.77-27.11,13.59-43.49,14.7-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-1.32,0-2.63-.03-3.94-.1-40.41-2.11-74.52-37.26-74.52-79.38,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33Z"}),r.createElement("path",{className:"cls-1",d:"M249.83,0C113.3,0,2,110.09,.03,246.16c-2,138.19,110.12,252.7,248.33,253.5,42.68,.25,83.79-10.19,120.3-30.03,3.56-1.93,4.11-6.83,1.08-9.51l-23.38-20.72c-4.75-4.21-11.51-5.4-17.36-2.92-25.48,10.84-53.17,16.38-81.71,16.03-111.68-1.37-201.91-94.29-200.13-205.96,1.76-110.26,92-199.41,202.67-199.41h202.69V407.41l-115-102.18c-3.72-3.31-9.42-2.66-12.42,1.31-18.46,24.44-48.53,39.64-81.93,37.34-46.33-3.2-83.87-40.5-87.34-86.81-4.15-55.24,39.63-101.52,94-101.52,49.18,0,89.68,37.85,93.91,85.95,.38,4.28,2.31,8.27,5.52,11.12l29.95,26.55c3.4,3.01,8.79,1.17,9.63-3.3,2.16-11.55,2.92-23.58,2.07-35.92-4.82-70.34-61.8-126.93-132.17-131.26-80.68-4.97-148.13,58.14-150.27,137.25-2.09,77.1,61.08,143.56,138.19,145.26,32.19,.71,62.03-9.41,86.14-26.95l150.26,133.2c6.44,5.71,16.61,1.14,16.61-7.47V9.48C499.66,4.25,495.42,0,490.18,0H249.83Z"})))}function Bt(e){return r.createElement("svg",{width:"15",height:"15","aria-label":e.ariaLabel,role:"img"},r.createElement("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"},e.children))}function zt(e){var t=e.translations,n=void 0===t?{}:t,o=n.selectText,a=void 0===o?"to select":o,s=n.selectKeyAriaLabel,i=void 0===s?"Enter key":s,l=n.navigateText,c=void 0===l?"to navigate":l,u=n.navigateUpKeyAriaLabel,d=void 0===u?"Arrow up":u,p=n.navigateDownKeyAriaLabel,f=void 0===p?"Arrow down":p,g=n.closeText,m=void 0===g?"to close":g,h=n.closeKeyAriaLabel,b=void 0===h?"Escape key":h,v=n.searchByText,y=void 0===v?"Search by":v;return r.createElement(r.Fragment,null,r.createElement("div",{className:"DocSearch-Logo"},r.createElement(Ft,{translations:{searchByText:y}})),r.createElement("ul",{className:"DocSearch-Commands"},r.createElement("li",null,r.createElement("kbd",{className:"DocSearch-Commands-Key"},r.createElement(Bt,{ariaLabel:i},r.createElement("path",{d:"M12 3.53088v3c0 1-1 2-2 2H4M7 11.53088l-3-3 3-3"}))),r.createElement("span",{className:"DocSearch-Label"},a)),r.createElement("li",null,r.createElement("kbd",{className:"DocSearch-Commands-Key"},r.createElement(Bt,{ariaLabel:f},r.createElement("path",{d:"M7.5 3.5v8M10.5 8.5l-3 3-3-3"}))),r.createElement("kbd",{className:"DocSearch-Commands-Key"},r.createElement(Bt,{ariaLabel:d},r.createElement("path",{d:"M7.5 11.5v-8M10.5 6.5l-3-3-3 3"}))),r.createElement("span",{className:"DocSearch-Label"},c)),r.createElement("li",null,r.createElement("kbd",{className:"DocSearch-Commands-Key"},r.createElement(Bt,{ariaLabel:b},r.createElement("path",{d:"M13.6167 8.936c-.1065.3583-.6883.962-1.4875.962-.7993 0-1.653-.9165-1.653-2.1258v-.5678c0-1.2548.7896-2.1016 1.653-2.1016.8634 0 1.3601.4778 1.4875 1.0724M9 6c-.1352-.4735-.7506-.9219-1.46-.8972-.7092.0246-1.344.57-1.344 1.2166s.4198.8812 1.3445.9805C8.465 7.3992 8.968 7.9337 9 8.5c.032.5663-.454 1.398-1.4595 1.398C6.6593 9.898 6 9 5.963 8.4851m-1.4748.5368c-.2635.5941-.8099.876-1.5443.876s-1.7073-.6248-1.7073-2.204v-.4603c0-1.0416.721-2.131 1.7073-2.131.9864 0 1.6425 1.031 1.5443 2.2492h-2.956"}))),r.createElement("span",{className:"DocSearch-Label"},m))))}function Ut(e){var t=e.hit,n=e.children;return r.createElement("a",{href:t.url},n)}function qt(){return r.createElement("svg",{viewBox:"0 0 38 38",stroke:"currentColor",strokeOpacity:".5"},r.createElement("g",{fill:"none",fillRule:"evenodd"},r.createElement("g",{transform:"translate(1 1)",strokeWidth:"2"},r.createElement("circle",{strokeOpacity:".3",cx:"18",cy:"18",r:"18"}),r.createElement("path",{d:"M36 18c0-9.94-8.06-18-18-18"},r.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 18 18",to:"360 18 18",dur:"1s",repeatCount:"indefinite"})))))}function $t(){return r.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},r.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},r.createElement("path",{d:"M3.18 6.6a8.23 8.23 0 1112.93 9.94h0a8.23 8.23 0 01-11.63 0"}),r.createElement("path",{d:"M6.44 7.25H2.55V3.36M10.45 6v5.6M10.45 11.6L13 13"})))}function Ht(){return r.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},r.createElement("path",{d:"M10 10l5.09-5.09L10 10l5.09 5.09L10 10zm0 0L4.91 4.91 10 10l-5.09 5.09L10 10z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}function Vt(){return r.createElement("svg",{className:"DocSearch-Hit-Select-Icon",width:"20",height:"20",viewBox:"0 0 20 20"},r.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},r.createElement("path",{d:"M18 3v4c0 2-2 4-4 4H2"}),r.createElement("path",{d:"M8 17l-6-6 6-6"})))}var Gt=function(){return r.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},r.createElement("path",{d:"M17 6v12c0 .52-.2 1-1 1H4c-.7 0-1-.33-1-1V2c0-.55.42-1 1-1h8l5 5zM14 8h-3.13c-.51 0-.87-.34-.87-.87V4",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinejoin:"round"}))};function Wt(e){switch(e.type){case"lvl1":return r.createElement(Gt,null);case"content":return r.createElement(Qt,null);default:return r.createElement(Kt,null)}}function Kt(){return r.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},r.createElement("path",{d:"M13 13h4-4V8H7v5h6v4-4H7V8H3h4V3v5h6V3v5h4-4v5zm-6 0v4-4H3h4z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}function Qt(){return r.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},r.createElement("path",{d:"M17 5H3h14zm0 5H3h14zm0 5H3h14z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinejoin:"round"}))}function Yt(){return r.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},r.createElement("path",{d:"M10 14.2L5 17l1-5.6-4-4 5.5-.7 2.5-5 2.5 5 5.6.8-4 4 .9 5.5z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinejoin:"round"}))}function Zt(){return r.createElement("svg",{width:"40",height:"40",viewBox:"0 0 20 20",fill:"none",fillRule:"evenodd",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},r.createElement("path",{d:"M19 4.8a16 16 0 00-2-1.2m-3.3-1.2A16 16 0 001.1 4.7M16.7 8a12 12 0 00-2.8-1.4M10 6a12 12 0 00-6.7 2M12.3 14.7a4 4 0 00-4.5 0M14.5 11.4A8 8 0 0010 10M3 16L18 2M10 18h0"}))}function Jt(){return r.createElement("svg",{width:"40",height:"40",viewBox:"0 0 20 20",fill:"none",fillRule:"evenodd",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},r.createElement("path",{d:"M15.5 4.8c2 3 1.7 7-1 9.7h0l4.3 4.3-4.3-4.3a7.8 7.8 0 01-9.8 1m-2.2-2.2A7.8 7.8 0 0113.2 2.4M2 18L18 2"}))}function Xt(e){var t=e.translations,n=void 0===t?{}:t,o=n.titleText,a=void 0===o?"Unable to fetch results":o,s=n.helpText,i=void 0===s?"You might want to check your network connection.":s;return r.createElement("div",{className:"DocSearch-ErrorScreen"},r.createElement("div",{className:"DocSearch-Screen-Icon"},r.createElement(Zt,null)),r.createElement("p",{className:"DocSearch-Title"},a),r.createElement("p",{className:"DocSearch-Help"},i))}var en=["translations"];function tn(e){var t=e.translations,n=void 0===t?{}:t,o=b(e,en),a=n.noResultsText,s=void 0===a?"No results for":a,i=n.suggestedQueryText,l=void 0===i?"Try searching for":i,c=n.reportMissingResultsText,u=void 0===c?"Believe this query should return results?":c,d=n.reportMissingResultsLinkText,p=void 0===d?"Let us know.":d,f=o.state.context.searchSuggestions;return r.createElement("div",{className:"DocSearch-NoResults"},r.createElement("div",{className:"DocSearch-Screen-Icon"},r.createElement(Jt,null)),r.createElement("p",{className:"DocSearch-Title"},s,' "',r.createElement("strong",null,o.state.query),'"'),f&&f.length>0&&r.createElement("div",{className:"DocSearch-NoResults-Prefill-List"},r.createElement("p",{className:"DocSearch-Help"},l,":"),r.createElement("ul",null,f.slice(0,3).reduce((function(e,t){return[].concat(x(e),[r.createElement("li",{key:t},r.createElement("button",{className:"DocSearch-Prefill",key:t,type:"button",onClick:function(){o.setQuery(t.toLowerCase()+" "),o.refresh(),o.inputRef.current.focus()}},t))])}),[]))),o.getMissingResultsUrl&&r.createElement("p",{className:"DocSearch-Help"},"".concat(u," "),r.createElement("a",{href:o.getMissingResultsUrl({query:o.state.query}),target:"_blank",rel:"noopener noreferrer"},p)))}var nn=["hit","attribute","tagName"];function rn(e,t){return t.split(".").reduce((function(e,t){return null!=e&&e[t]?e[t]:null}),e)}function on(e){var t=e.hit,n=e.attribute,o=e.tagName,a=void 0===o?"span":o,s=b(e,nn);return(0,r.createElement)(a,h(h({},s),{},{dangerouslySetInnerHTML:{__html:rn(t,"_snippetResult.".concat(n,".value"))||rn(t,n)}}))}function an(e){return e.collection&&0!==e.collection.items.length?r.createElement("section",{className:"DocSearch-Hits"},r.createElement("div",{className:"DocSearch-Hit-source"},e.title),r.createElement("ul",e.getListProps(),e.collection.items.map((function(t,n){return r.createElement(sn,d({key:[e.title,t.objectID].join(":"),item:t,index:n},e))})))):null}function sn(e){var t=e.item,n=e.index,o=e.renderIcon,a=e.renderAction,s=e.getItemProps,i=e.onItemClick,l=e.collection,c=e.hitComponent,u=w(r.useState(!1),2),p=u[0],f=u[1],g=w(r.useState(!1),2),m=g[0],h=g[1],b=r.useRef(null),v=c;return r.createElement("li",d({className:["DocSearch-Hit",t.__docsearch_parent&&"DocSearch-Hit--Child",p&&"DocSearch-Hit--deleting",m&&"DocSearch-Hit--favoriting"].filter(Boolean).join(" "),onTransitionEnd:function(){b.current&&b.current()}},s({item:t,source:l.source,onClick:function(e){i(t,e)}})),r.createElement(v,{hit:t},r.createElement("div",{className:"DocSearch-Hit-Container"},o({item:t,index:n}),t.hierarchy[t.type]&&"lvl1"===t.type&&r.createElement("div",{className:"DocSearch-Hit-content-wrapper"},r.createElement(on,{className:"DocSearch-Hit-title",hit:t,attribute:"hierarchy.lvl1"}),t.content&&r.createElement(on,{className:"DocSearch-Hit-path",hit:t,attribute:"content"})),t.hierarchy[t.type]&&("lvl2"===t.type||"lvl3"===t.type||"lvl4"===t.type||"lvl5"===t.type||"lvl6"===t.type)&&r.createElement("div",{className:"DocSearch-Hit-content-wrapper"},r.createElement(on,{className:"DocSearch-Hit-title",hit:t,attribute:"hierarchy.".concat(t.type)}),r.createElement(on,{className:"DocSearch-Hit-path",hit:t,attribute:"hierarchy.lvl1"})),"content"===t.type&&r.createElement("div",{className:"DocSearch-Hit-content-wrapper"},r.createElement(on,{className:"DocSearch-Hit-title",hit:t,attribute:"content"}),r.createElement(on,{className:"DocSearch-Hit-path",hit:t,attribute:"hierarchy.lvl1"})),a({item:t,runDeleteTransition:function(e){f(!0),b.current=e},runFavoriteTransition:function(e){h(!0),b.current=e}}))))}function ln(e,t,n){return e.reduce((function(e,r){var o=t(r);return e.hasOwnProperty(o)||(e[o]=[]),e[o].length<(n||5)&&e[o].push(r),e}),{})}function cn(e){return e}function un(e){return 1===e.button||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function dn(){}var pn=/(<mark>|<\/mark>)/g,fn=RegExp(pn.source);function gn(e){var t,n,r=e;if(!r.__docsearch_parent&&!e._highlightResult)return e.hierarchy.lvl0;var o=r.__docsearch_parent?null===(t=r.__docsearch_parent)||void 0===t||null===(t=t._highlightResult)||void 0===t||null===(t=t.hierarchy)||void 0===t?void 0:t.lvl0:null===(n=e._highlightResult)||void 0===n||null===(n=n.hierarchy)||void 0===n?void 0:n.lvl0;return o?o.value&&fn.test(o.value)?o.value.replace(pn,""):o.value:e.hierarchy.lvl0}function mn(e){return r.createElement("div",{className:"DocSearch-Dropdown-Container"},e.state.collections.map((function(t){if(0===t.items.length)return null;var n=gn(t.items[0]);return r.createElement(an,d({},e,{key:t.source.sourceId,title:n,collection:t,renderIcon:function(e){var n,o=e.item,a=e.index;return r.createElement(r.Fragment,null,o.__docsearch_parent&&r.createElement("svg",{className:"DocSearch-Hit-Tree",viewBox:"0 0 24 54"},r.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},o.__docsearch_parent!==(null===(n=t.items[a+1])||void 0===n?void 0:n.__docsearch_parent)?r.createElement("path",{d:"M8 6v21M20 27H8.3"}):r.createElement("path",{d:"M8 6v42M20 27H8.3"}))),r.createElement("div",{className:"DocSearch-Hit-icon"},r.createElement(Wt,{type:o.type})))},renderAction:function(){return r.createElement("div",{className:"DocSearch-Hit-action"},r.createElement(Vt,null))}}))})),e.resultsFooterComponent&&r.createElement("section",{className:"DocSearch-HitsFooter"},r.createElement(e.resultsFooterComponent,{state:e.state})))}var hn=["translations"];function bn(e){var t=e.translations,n=void 0===t?{}:t,o=b(e,hn),a=n.recentSearchesTitle,s=void 0===a?"Recent":a,i=n.noRecentSearchesText,l=void 0===i?"No recent searches":i,c=n.saveRecentSearchButtonTitle,u=void 0===c?"Save this search":c,p=n.removeRecentSearchButtonTitle,f=void 0===p?"Remove this search from history":p,g=n.favoriteSearchesTitle,m=void 0===g?"Favorite":g,h=n.removeFavoriteSearchButtonTitle,v=void 0===h?"Remove this search from favorites":h;return"idle"===o.state.status&&!1===o.hasCollections?o.disableUserPersonalization?null:r.createElement("div",{className:"DocSearch-StartScreen"},r.createElement("p",{className:"DocSearch-Help"},l)):!1===o.hasCollections?null:r.createElement("div",{className:"DocSearch-Dropdown-Container"},r.createElement(an,d({},o,{title:s,collection:o.state.collections[0],renderIcon:function(){return r.createElement("div",{className:"DocSearch-Hit-icon"},r.createElement($t,null))},renderAction:function(e){var t=e.item,n=e.runFavoriteTransition,a=e.runDeleteTransition;return r.createElement(r.Fragment,null,r.createElement("div",{className:"DocSearch-Hit-action"},r.createElement("button",{className:"DocSearch-Hit-action-button",title:u,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),n((function(){o.favoriteSearches.add(t),o.recentSearches.remove(t),o.refresh()}))}},r.createElement(Yt,null))),r.createElement("div",{className:"DocSearch-Hit-action"},r.createElement("button",{className:"DocSearch-Hit-action-button",title:f,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),a((function(){o.recentSearches.remove(t),o.refresh()}))}},r.createElement(Ht,null))))}})),r.createElement(an,d({},o,{title:m,collection:o.state.collections[1],renderIcon:function(){return r.createElement("div",{className:"DocSearch-Hit-icon"},r.createElement(Yt,null))},renderAction:function(e){var t=e.item,n=e.runDeleteTransition;return r.createElement("div",{className:"DocSearch-Hit-action"},r.createElement("button",{className:"DocSearch-Hit-action-button",title:v,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),n((function(){o.favoriteSearches.remove(t),o.refresh()}))}},r.createElement(Ht,null)))}})))}var vn=["translations"],yn=r.memo((function(e){var t=e.translations,n=void 0===t?{}:t,o=b(e,vn);if("error"===o.state.status)return r.createElement(Xt,{translations:null==n?void 0:n.errorScreen});var a=o.state.collections.some((function(e){return e.items.length>0}));return o.state.query?!1===a?r.createElement(tn,d({},o,{translations:null==n?void 0:n.noResultsScreen})):r.createElement(mn,o):r.createElement(bn,d({},o,{hasCollections:a,translations:null==n?void 0:n.startScreen}))}),(function(e,t){return"loading"===t.state.status||"stalled"===t.state.status})),wn=["translations"];function xn(e){var t=e.translations,n=void 0===t?{}:t,o=b(e,wn),a=n.resetButtonTitle,s=void 0===a?"Clear the query":a,i=n.resetButtonAriaLabel,l=void 0===i?"Clear the query":i,c=n.cancelButtonText,u=void 0===c?"Cancel":c,p=n.cancelButtonAriaLabel,f=void 0===p?"Cancel":p,g=n.searchInputLabel,m=void 0===g?"Search":g,h=o.getFormProps({inputElement:o.inputRef.current}).onReset;return r.useEffect((function(){o.autoFocus&&o.inputRef.current&&o.inputRef.current.focus()}),[o.autoFocus,o.inputRef]),r.useEffect((function(){o.isFromSelection&&o.inputRef.current&&o.inputRef.current.select()}),[o.isFromSelection,o.inputRef]),r.createElement(r.Fragment,null,r.createElement("form",{className:"DocSearch-Form",onSubmit:function(e){e.preventDefault()},onReset:h},r.createElement("label",d({className:"DocSearch-MagnifierLabel"},o.getLabelProps()),r.createElement(_,null),r.createElement("span",{className:"DocSearch-VisuallyHiddenForAccessibility"},m)),r.createElement("div",{className:"DocSearch-LoadingIndicator"},r.createElement(qt,null)),r.createElement("input",d({className:"DocSearch-Input",ref:o.inputRef},o.getInputProps({inputElement:o.inputRef.current,autoFocus:o.autoFocus,maxLength:64}))),r.createElement("button",{type:"reset",title:s,className:"DocSearch-Reset","aria-label":l,hidden:!o.state.query},r.createElement(Ht,null))),r.createElement("button",{className:"DocSearch-Cancel",type:"reset","aria-label":f,onClick:o.onClose},u))}var jn=["_highlightResult","_snippetResult"];function kn(e){var t=e.key,n=e.limit,r=void 0===n?5:n,o=function(e){return!1===function(){var e="__TEST_KEY__";try{return localStorage.setItem(e,""),localStorage.removeItem(e),!0}catch(e){return!1}}()?{setItem:function(){},getItem:function(){return[]}}:{setItem:function(t){return window.localStorage.setItem(e,JSON.stringify(t))},getItem:function(){var t=window.localStorage.getItem(e);return t?JSON.parse(t):[]}}}(t),a=o.getItem().slice(0,r);return{add:function(e){var t=e;t._highlightResult,t._snippetResult;var n=b(t,jn),s=a.findIndex((function(e){return e.objectID===n.objectID}));s>-1&&a.splice(s,1),a.unshift(n),a=a.slice(0,r),o.setItem(a)},remove:function(e){a=a.filter((function(t){return t.objectID!==e.objectID})),o.setItem(a)},getAll:function(){return a}}}function Sn(e){var t,n="algolia-client-js-".concat(e.key);function r(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function o(){return JSON.parse(r().getItem(n)||"{}")}function a(e){r().setItem(n,JSON.stringify(e))}return{get:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){var n,r,s;return n=e.timeToLive?1e3*e.timeToLive:null,r=o(),a(s=Object.fromEntries(Object.entries(r).filter((function(e){return void 0!==w(e,2)[1].timestamp})))),n&&a(Object.fromEntries(Object.entries(s).filter((function(e){var t=w(e,2)[1],r=(new Date).getTime();return!(t.timestamp+n<r)})))),o()[JSON.stringify(t)]})).then((function(e){return Promise.all([e?e.value:n(),void 0!==e])})).then((function(e){var t=w(e,2),n=t[0],o=t[1];return Promise.all([n,o||r.miss(n)])})).then((function(e){return w(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var a=o();return a[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},r().setItem(n,JSON.stringify(a)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=o();delete t[JSON.stringify(e)],r().setItem(n,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){r().removeItem(n)}))}}}function _n(e){var t=x(e.caches),n=t.shift();return void 0===n?{get:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,n.miss(e)])})).then((function(e){return w(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return n.get(e,r,o).catch((function(){return _n({caches:t}).get(e,r,o)}))},set:function(e,r){return n.set(e,r).catch((function(){return _n({caches:t}).set(e,r)}))},delete:function(e){return n.delete(e).catch((function(){return _n({caches:t}).delete(e)}))},clear:function(){return n.clear().catch((function(){return _n({caches:t}).clear()}))}}}function En(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(n,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(n);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var s=r();return s.then((function(e){return o.miss(e)})).then((function(){return s}))},set:function(n,r){return t[JSON.stringify(n)]=e.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function On(e){var t=e.algoliaAgents,n=e.client,r=e.version,o=function(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var n="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(n)&&(t.value="".concat(t.value).concat(n)),t}};return t}(r).add({segment:n,version:r});return t.forEach((function(e){return o.add(e)})),o}var Cn=12e4;function An(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"up",n=Date.now();return h(h({},e),{},{status:t,lastUpdate:n,isUp:function(){return"up"===t||Date.now()-n>Cn},isTimedOut:function(){return"timed out"===t&&Date.now()-n<=Cn}})}var Pn=function(){function e(t,n){var r;return l(this,e),u(r=i(this,e,[t]),"name","AlgoliaError"),n&&(r.name=n),r}return f(e,k(Error)),c(e)}(),Tn=function(){function e(t,n,r){var o;return l(this,e),u(o=i(this,e,[t,r]),"stackTrace",void 0),o.stackTrace=n,o}return f(e,Pn),c(e)}(),In=function(){function e(t){return l(this,e),i(this,e,["Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError"])}return f(e,Tn),c(e)}(),Rn=function(){function e(t,n,r){var o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"ApiError";return l(this,e),u(o=i(this,e,[t,r,a]),"status",void 0),o.status=n,o}return f(e,Tn),c(e)}(),Nn=function(){function e(t,n){var r;return l(this,e),u(r=i(this,e,[t,"DeserializationError"]),"response",void 0),r.response=n,r}return f(e,Pn),c(e)}(),Ln=function(){function e(t,n,r,o){var a;return l(this,e),u(a=i(this,e,[t,n,o,"DetailedApiError"]),"error",void 0),a.error=r,a}return f(e,Rn),c(e)}();function Dn(e,t,n){var r,o=(r=n,Object.keys(r).filter((function(e){return void 0!==r[e]})).sort().map((function(e){return"".concat(e,"=").concat(encodeURIComponent("[object Array]"===Object.prototype.toString.call(r[e])?r[e].join(","):r[e]).replace(/\+/g,"%20"))})).join("&")),a="".concat(e.protocol,"://").concat(e.url).concat(e.port?":".concat(e.port):"","/").concat("/"===t.charAt(0)?t.substring(1):t);return o.length&&(a+="?".concat(o)),a}function Mn(e,t){if("GET"!==e.method&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:h(h({},e.data),t.data);return JSON.stringify(n)}}function Fn(e,t,n){var r=h(h(h({Accept:"application/json"},e),t),n),o={};return Object.keys(r).forEach((function(e){var t=r[e];o[e.toLowerCase()]=t})),o}function Bn(e){try{return JSON.parse(e.content)}catch(t){throw new Nn(t.message,e)}}function zn(e,t){var n=e.content,r=e.status;try{var o=JSON.parse(n);return"error"in o?new Ln(o.message,r,o.error,t):new Rn(o.message,r,t)}catch(e){}return new Rn(n,r,t)}function Un(e){return e.map((function(e){return qn(e)}))}function qn(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return h(h({},e),{},{request:h(h({},e.request),{},{headers:h(h({},e.request.headers),t)})})}var $n=["appId","apiKey","authMode","algoliaAgents"],Hn=["params"],Vn="5.14.2";function Gn(e){return[{url:"".concat(e,"-dsn.algolia.net"),accept:"read",protocol:"https"},{url:"".concat(e,".algolia.net"),accept:"write",protocol:"https"}].concat(function(e){for(var t=e,n=e.length-1;n>0;n--){var r=Math.floor(Math.random()*(n+1)),o=e[n];t[n]=e[r],t[r]=o}return t}([{url:"".concat(e,"-1.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-2.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-3.algolianet.com"),accept:"readWrite",protocol:"https"}]))}var Wn="3.8.2";function Kn(e,t,n){return r.useMemo((function(){var r=function(e,t,n){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");return function(e){var t=e.appId,n=e.apiKey,r=e.authMode,o=e.algoliaAgents,a=b(e,$n),i=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"WithinHeaders",r={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:function(){return"WithinHeaders"===n?r:{}},queryParameters:function(){return"WithinQueryParameters"===n?r:{}}}}(t,n,r),l=function(e){var t=e.hosts,n=e.hostsCache,r=e.baseHeaders,o=e.logger,a=e.baseQueryParameters,i=e.algoliaAgent,l=e.timeouts,c=e.requester,u=e.requestsCache,d=e.responsesCache;function p(e){return f.apply(this,arguments)}function f(){return(f=s(v().mark((function e(t){var r,o,a,s,i;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map((function(e){return n.get(e,(function(){return Promise.resolve(An(e))}))})));case 2:return r=e.sent,o=r.filter((function(e){return e.isUp()})),a=r.filter((function(e){return e.isTimedOut()})),s=[].concat(x(o),x(a)),i=s.length>0?s:t,e.abrupt("return",{hosts:i,getTimeout:function(e,t){return(0===a.length&&0===e?1:a.length+3+e)*t}});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e,t){return m.apply(this,arguments)}function m(){return m=s(v().mark((function e(u,d){var f,g,m,b,y,w,j,k,S,_,E,O,C,A=arguments;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f=!(A.length>2&&void 0!==A[2])||A[2],g=[],m=Mn(u,d),b=Fn(r,u.headers,d.headers),y="GET"===u.method?h(h({},u.data),d.data):{},w=h(h(h({},a),u.queryParameters),y),i.value&&(w["x-algolia-agent"]=i.value),d&&d.queryParameters)for(j=0,k=Object.keys(d.queryParameters);j<k.length;j++)S=k[j],d.queryParameters[S]&&"[object Object]"!==Object.prototype.toString.call(d.queryParameters[S])?w[S]=d.queryParameters[S].toString():w[S]=d.queryParameters[S];return _=0,E=function(){var e=s(v().mark((function e(t,r){var a,s,i,p,y,x;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(a=t.pop())){e.next=3;break}throw new In(Un(g));case 3:return s=h(h({},l),d.timeouts),i={data:m,headers:b,method:u.method,url:Dn(a,u.path,w),connectTimeout:r(_,s.connect),responseTimeout:r(_,f?s.read:s.write)},p=function(e){var n={request:i,response:e,host:a,triesLeft:t.length};return g.push(n),n},e.next=8,c.send(i);case 8:if(j=(v=y=e.sent).isTimedOut,k=v.status,!(j||function(e){return!e.isTimedOut&&!~~e.status}({isTimedOut:j,status:k})||2!=~~(k/100)&&4!=~~(k/100))){e.next=16;break}return x=p(y),y.isTimedOut&&_++,o.info("Retryable failure",qn(x)),e.next=15,n.set(a,An(a,y.isTimedOut?"timed out":"down"));case 15:return e.abrupt("return",E(t,r));case 16:if(2!=~~(y.status/100)){e.next=18;break}return e.abrupt("return",Bn(y));case 18:throw p(y),zn(y,g);case 20:case"end":return e.stop()}var v,j,k}),e)})));return function(t,n){return e.apply(this,arguments)}}(),O=t.filter((function(e){return"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept)})),e.next=13,p(O);case 13:return C=e.sent,e.abrupt("return",E(x(C.hosts).reverse(),C.getTimeout));case 15:case"end":return e.stop()}}),e)}))),m.apply(this,arguments)}return{hostsCache:n,requester:c,timeouts:l,logger:o,algoliaAgent:i,baseHeaders:r,baseQueryParameters:a,hosts:t,request:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.useReadTransporter||"GET"===e.method;if(!n)return g(e,t,n);var o=function(){return g(e,t)};if(!0!==(t.cacheable||e.cacheable))return o();var s={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return d.get(s,(function(){return u.get(s,(function(){return u.set(s,o()).then((function(e){return Promise.all([u.delete(s),e])}),(function(e){return Promise.all([u.delete(s),Promise.reject(e)])})).then((function(e){var t=w(e,2);return t[0],t[1]}))}))}),{miss:function(e){return d.set(s,e)}})},requestsCache:u,responsesCache:d}}(h(h({hosts:Gn(t)},a),{},{algoliaAgent:On({algoliaAgents:o,client:"Lite",version:Vn}),baseHeaders:h(h({"content-type":"text/plain"},i.headers()),a.baseHeaders),baseQueryParameters:h(h({},i.queryParameters()),a.baseQueryParameters)}));return{transporter:l,appId:t,clearCache:function(){return Promise.all([l.requestsCache.clear(),l.responsesCache.clear()]).then((function(){}))},get _ua(){return l.algoliaAgent.value},addAlgoliaAgent:function(e,t){l.algoliaAgent.add({segment:e,version:t})},setClientApiKey:function(e){var t=e.apiKey;r&&"WithinHeaders"!==r?l.baseQueryParameters["x-algolia-api-key"]=t:l.baseHeaders["x-algolia-api-key"]=t},searchForHits:function(e,t){return this.search(e,t)},searchForFacets:function(e,t){return this.search(e,t)},customPost:function(e,t){var n=e.path,r=e.parameters,o=e.body;if(!n)throw new Error("Parameter `path` is required when calling `customPost`.");var a={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:r||{},headers:{},data:o||{}};return l.request(a,t)},getRecommendations:function(e,t){if(e&&Array.isArray(e)&&(e={requests:e}),!e)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!e.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");var n={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return l.request(n,t)},search:function(e,t){if(e&&Array.isArray(e)){var n={requests:e.map((function(e){var t=e.params,n=b(e,Hn);return"facet"===n.type?h(h(h({},n),t),{},{type:"facet"}):h(h(h({},n),t),{},{facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}))};e=n}if(!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");var r={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return l.request(r,t)}}}(h({appId:e,apiKey:t,timeouts:{connect:1e3,read:2e3,write:3e4},logger:{debug:function(e,t){return Promise.resolve()},info:function(e,t){return Promise.resolve()},error:function(e,t){return Promise.resolve()}},requester:{send:function(e){return new Promise((function(t){var n=new XMLHttpRequest;n.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return n.setRequestHeader(t,e.headers[t])}));var r,o=function(e,r){return setTimeout((function(){n.abort(),t({status:0,content:r,isTimedOut:!0})}),e)},a=o(e.connectTimeout,"Connection timeout");n.onreadystatechange=function(){n.readyState>n.OPENED&&void 0===r&&(clearTimeout(a),r=o(e.responseTimeout,"Socket timeout"))},n.onerror=function(){0===n.status&&(clearTimeout(a),clearTimeout(r),t({content:n.responseText||"Network request failed",status:n.status,isTimedOut:!1}))},n.onload=function(){clearTimeout(a),clearTimeout(r),t({content:n.responseText,status:n.status,isTimedOut:!1})},n.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:En(),requestsCache:En({serializable:!1}),hostsCache:_n({caches:[Sn({key:"".concat(Vn,"-").concat(e)}),En()]})},void 0))}(e,t);return r.addAlgoliaAgent("docsearch",Wn),!1===/docsearch.js \(.*\)/.test(r.transporter.algoliaAgent.value)&&r.addAlgoliaAgent("docsearch-react",Wn),n(r)}),[e,t,n])}var Qn=["footer","searchBox"];function Yn(e){var t=e.appId,n=e.apiKey,o=e.indexName,a=e.placeholder,s=void 0===a?"Search docs":a,i=e.searchParameters,l=e.maxResultsPerGroup,c=e.onClose,u=void 0===c?dn:c,p=e.transformItems,f=void 0===p?cn:p,g=e.hitComponent,m=void 0===g?Ut:g,v=e.resultsFooterComponent,y=void 0===v?function(){return null}:v,x=e.navigator,j=e.initialScrollY,k=void 0===j?0:j,S=e.transformSearchClient,_=void 0===S?cn:S,E=e.disableUserPersonalization,O=void 0!==E&&E,C=e.initialQuery,A=void 0===C?"":C,P=e.translations,T=void 0===P?{}:P,I=e.getMissingResultsUrl,R=e.insights,N=void 0!==R&&R,L=T.footer,D=T.searchBox,M=b(T,Qn),F=w(r.useState({query:"",collections:[],completion:null,context:{},isOpen:!1,activeItemId:null,status:"idle"}),2),B=F[0],z=F[1],U=r.useRef(null),q=r.useRef(null),$=r.useRef(null),H=r.useRef(null),V=r.useRef(null),G=r.useRef(10),W=r.useRef("undefined"!=typeof window?window.getSelection().toString().slice(0,64):"").current,K=r.useRef(A||W).current,Q=Kn(t,n,_),Y=r.useRef(kn({key:"__DOCSEARCH_FAVORITE_SEARCHES__".concat(o),limit:10})).current,Z=r.useRef(kn({key:"__DOCSEARCH_RECENT_SEARCHES__".concat(o),limit:0===Y.getAll().length?7:4})).current,J=r.useCallback((function(e){if(!O){var t="content"===e.type?e.__docsearch_parent:e;t&&-1===Y.getAll().findIndex((function(e){return e.objectID===t.objectID}))&&Z.add(t)}}),[Y,Z,O]),X=r.useCallback((function(e){if(B.context.algoliaInsightsPlugin&&e.__autocomplete_id){var t=e,n={eventName:"Item Selected",index:t.__autocomplete_indexName,items:[t],positions:[e.__autocomplete_id],queryID:t.__autocomplete_queryID};B.context.algoliaInsightsPlugin.insights.clickedObjectIDsAfterSearch(n)}}),[B.context.algoliaInsightsPlugin]),ee=r.useMemo((function(){return Mt({id:"docsearch",defaultActiveItemId:0,placeholder:s,openOnFocus:!0,initialState:{query:K,context:{searchSuggestions:[]}},insights:N,navigator:x,onStateChange:function(e){z(e.state)},getSources:function(e){var r=e.query,a=e.state,s=e.setContext,c=e.setStatus;if(!r)return O?[]:[{sourceId:"recentSearches",onSelect:function(e){var t=e.item,n=e.event;J(t),un(n)||u()},getItemUrl:function(e){return e.item.url},getItems:function(){return Z.getAll()}},{sourceId:"favoriteSearches",onSelect:function(e){var t=e.item,n=e.event;J(t),un(n)||u()},getItemUrl:function(e){return e.item.url},getItems:function(){return Y.getAll()}}];var d=Boolean(N);return Q.search({requests:[h({query:r,indexName:o,attributesToRetrieve:["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url"],attributesToSnippet:["hierarchy.lvl1:".concat(G.current),"hierarchy.lvl2:".concat(G.current),"hierarchy.lvl3:".concat(G.current),"hierarchy.lvl4:".concat(G.current),"hierarchy.lvl5:".concat(G.current),"hierarchy.lvl6:".concat(G.current),"content:".concat(G.current)],snippetEllipsisText:"\u2026",highlightPreTag:"<mark>",highlightPostTag:"</mark>",hitsPerPage:20,clickAnalytics:d},i)]}).catch((function(e){throw"RetryError"===e.name&&c("error"),e})).then((function(e){var r=e.results[0],i=r.hits,c=r.nbHits,p=ln(i,(function(e){return gn(e)}),l);a.context.searchSuggestions.length<Object.keys(p).length&&s({searchSuggestions:Object.keys(p)}),s({nbHits:c});var g={};return d&&(g={__autocomplete_indexName:o,__autocomplete_queryID:r.queryID,__autocomplete_algoliaCredentials:{appId:t,apiKey:n}}),Object.values(p).map((function(e,t){return{sourceId:"hits".concat(t),onSelect:function(e){var t=e.item,n=e.event;J(t),un(n)||u()},getItemUrl:function(e){return e.item.url},getItems:function(){return Object.values(ln(e,(function(e){return e.hierarchy.lvl1}),l)).map(f).map((function(e){return e.map((function(t){var n=null,r=e.find((function(e){return"lvl1"===e.type&&e.hierarchy.lvl1===t.hierarchy.lvl1}));return"lvl1"!==t.type&&r&&(n=r),h(h({},t),{},{__docsearch_parent:n},g)}))})).flat()}}}))}))}})}),[o,i,l,Q,u,Z,Y,J,K,s,x,f,O,N,t,n]),te=ee.getEnvironmentProps,ne=ee.getRootProps,re=ee.refresh;return function(e){var t=e.getEnvironmentProps,n=e.panelElement,o=e.formElement,a=e.inputElement;r.useEffect((function(){if(n&&o&&a){var e=t({panelElement:n,formElement:o,inputElement:a}),r=e.onTouchStart,s=e.onTouchMove;return window.addEventListener("touchstart",r),window.addEventListener("touchmove",s),function(){window.removeEventListener("touchstart",r),window.removeEventListener("touchmove",s)}}}),[t,n,o,a])}({getEnvironmentProps:te,panelElement:H.current,formElement:$.current,inputElement:V.current}),function(e){var t=e.container;r.useEffect((function(){if(t){var e=t.querySelectorAll("a[href]:not([disabled]), button:not([disabled]), input:not([disabled])"),n=e[0],r=e[e.length-1];return t.addEventListener("keydown",o),function(){t.removeEventListener("keydown",o)}}function o(e){"Tab"===e.key&&(e.shiftKey?document.activeElement===n&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),n.focus()))}}),[t])}({container:U.current}),r.useEffect((function(){return document.body.classList.add("DocSearch--active"),function(){var e,t;document.body.classList.remove("DocSearch--active"),null===(e=(t=window).scrollTo)||void 0===e||e.call(t,0,k)}}),[]),r.useEffect((function(){window.matchMedia("(max-width: 768px)").matches&&(G.current=5)}),[]),r.useEffect((function(){H.current&&(H.current.scrollTop=0)}),[B.query]),r.useEffect((function(){K.length>0&&(re(),V.current&&V.current.focus())}),[K,re]),r.useEffect((function(){function e(){if(q.current){var e=.01*window.innerHeight;q.current.style.setProperty("--docsearch-vh","".concat(e,"px"))}}return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),r.createElement("div",d({ref:U},ne({"aria-expanded":!0}),{className:["DocSearch","DocSearch-Container","stalled"===B.status&&"DocSearch-Container--Stalled","error"===B.status&&"DocSearch-Container--Errored"].filter(Boolean).join(" "),role:"button",tabIndex:0,onMouseDown:function(e){e.target===e.currentTarget&&u()}}),r.createElement("div",{className:"DocSearch-Modal",ref:q},r.createElement("header",{className:"DocSearch-SearchBar",ref:$},r.createElement(xn,d({},ee,{state:B,autoFocus:0===K.length,inputRef:V,isFromSelection:Boolean(K)&&K===W,translations:D,onClose:u}))),r.createElement("div",{className:"DocSearch-Dropdown",ref:H},r.createElement(yn,d({},ee,{indexName:o,state:B,hitComponent:m,resultsFooterComponent:y,disableUserPersonalization:O,recentSearches:Z,favoriteSearches:Y,inputRef:V,translations:M,getMissingResultsUrl:I,onItemClick:function(e,t){X(e),J(e),un(t)||u()}}))),r.createElement("footer",{className:"DocSearch-Footer"},r.createElement(zt,{translations:L}))))}function Zn(e){var t=e.isOpen,n=e.onOpen,o=e.onClose,a=e.onInput,s=e.searchButtonRef;r.useEffect((function(){function e(e){var r;if("Escape"===e.code&&t||"k"===(null===(r=e.key)||void 0===r?void 0:r.toLowerCase())&&(e.metaKey||e.ctrlKey)||!function(e){var t=e.target,n=t.tagName;return t.isContentEditable||"INPUT"===n||"SELECT"===n||"TEXTAREA"===n}(e)&&"/"===e.key&&!t)return e.preventDefault(),void(t?o():document.body.classList.contains("DocSearch--active")||n());s&&s.current===document.activeElement&&a&&/[a-zA-Z0-9]/.test(String.fromCharCode(e.keyCode))&&a(e)}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}),[t,n,o,a,s])}},8328:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});n(6540);var r=n(3259),o=n.n(r),a=n(4054);const s={"029bedf1":[()=>n.e(1180).then(n.bind(n,1152)),"@site/versioned_docs/version-11.1/guides/using-with-babel.md",1152],"02a1e558":[()=>Promise.all([n.e(1869),n.e(4026)]).then(n.bind(n,3937)),"@site/versioned_docs/version-8.x/getting-started/installation.md",3937],"03be7dae":[()=>Promise.all([n.e(1869),n.e(4768)]).then(n.bind(n,2152)),"@site/docs/guides/troubleshooting.md",2152],"04ae74d1":[()=>Promise.all([n.e(1869),n.e(8889)]).then(n.bind(n,8533)),"@site/versioned_docs/version-12.0/getting-started/presets.md",8533],"04b3fc6c":[()=>n.e(8582).then(n.bind(n,7334)),"@site/versioned_docs/version-10.x/getting-started/presets.md",7334],"05916282":[()=>n.e(2502).then(n.bind(n,9387)),"@site/versioned_docs/version-14.0/guides/absolute-imports.md",9387],"08804573":[()=>Promise.all([n.e(1869),n.e(108)]).then(n.bind(n,175)),"@site/versioned_docs/version-14.3/guides/troubleshooting.md",175],"097bb47a":[()=>n.e(3803).then(n.bind(n,1928)),"@site/versioned_docs/version-14.3/processing.md",1928],"09df063d":[()=>Promise.all([n.e(1869),n.e(5027)]).then(n.bind(n,7646)),"@site/versioned_docs/version-14.4/getting-started/installation.md",7646],"0d71a3f1":[()=>n.e(3316).then(n.bind(n,3961)),"@site/versioned_docs/version-9.x/getting-started/test-environment.md",3961],"0dc350cc":[()=>Promise.all([n.e(1869),n.e(9800)]).then(n.bind(n,2869)),"@site/versioned_docs/version-14.0/guides/jsdom-version.md",2869],"0e35f71d":[()=>Promise.all([n.e(1869),n.e(1672)]).then(n.bind(n,3230)),"@site/versioned_docs/version-12.0/guides/using-with-babel.md",3230],"13973f06":[()=>n.e(1446).then(n.bind(n,5842)),"@site/versioned_docs/version-12.0/processing.md",5842],"1438ea8f":[()=>Promise.all([n.e(1869),n.e(853)]).then(n.bind(n,5959)),"@site/versioned_docs/version-14.2/guides/jsdom-version.md",5959],"14b133ce":[()=>Promise.all([n.e(1869),n.e(1653)]).then(n.bind(n,1772)),"@site/docs/guides/angular-ivy.md",1772],"151633a5":[()=>n.e(4528).then(n.bind(n,5571)),"@site/versioned_docs/version-11.0/introduction.md",5571],"15a051c9":[()=>Promise.all([n.e(1869),n.e(1116)]).then(n.bind(n,8583)),"@site/versioned_docs/version-14.3/guides/using-with-babel.md",8583],"164a8de7":[()=>Promise.all([n.e(1869),n.e(1795)]).then(n.bind(n,905)),"@site/versioned_docs/version-14.3/guides/jsdom-version.md",905],17896441:[()=>Promise.all([n.e(1869),n.e(8401)]).then(n.bind(n,5744)),"@theme/DocItem",5744],"1a421168":[()=>Promise.all([n.e(1869),n.e(8737),n.e(9631)]).then(n.bind(n,7723)),"@site/docs/getting-started/test-environment.md",7723],"1a4e3797":[()=>Promise.all([n.e(1869),n.e(2138)]).then(n.bind(n,917)),"@theme/SearchPage",917],"1a5572f6":[()=>Promise.all([n.e(1869),n.e(3676)]).then(n.bind(n,1037)),"@site/versioned_docs/version-14.0/guides/angular-ivy.md",1037],"1d8e39f8":[()=>Promise.all([n.e(1869),n.e(4611)]).then(n.bind(n,365)),"@site/versioned_docs/version-14.4/guides/jsdom-version.md",365],"1df93b7f":[()=>Promise.all([n.e(1869),n.e(4583)]).then(n.bind(n,9008)),"@site/src/pages/index.tsx",9008],"1e388ac9":[()=>Promise.all([n.e(1869),n.e(6969)]).then(n.bind(n,8449)),"@site/versioned_docs/version-14.2/getting-started/presets.md",8449],"203fc93e":[()=>Promise.all([n.e(1869),n.e(6038)]).then(n.bind(n,647)),"@site/versioned_docs/version-14.2/guides/angular-ivy.md",647],"22e4d634":[()=>n.e(5559).then(n.bind(n,9153)),"@site/versioned_docs/version-10.x/guides/troubleshooting.md",9153],"252e2b80":[()=>n.e(8955).then(n.bind(n,8227)),"@site/versioned_docs/version-10.x/getting-started/options.md",8227],"25e9e857":[()=>n.e(4393).then(n.t.bind(n,3809,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-next-3ad.json",3809],"26cb42b7":[()=>Promise.all([n.e(1869),n.e(179)]).then(n.bind(n,477)),"@site/versioned_docs/version-14.0/guides/esm-support.md",477],"27299a3b":[()=>Promise.all([n.e(1869),n.e(7036)]).then(n.bind(n,7536)),"@site/versioned_docs/version-9.x/getting-started/installation.md",7536],"27af8d7b":[()=>n.e(4868).then(n.bind(n,337)),"@site/versioned_docs/version-14.3/guides/esm-support.md",337],"29d26392":[()=>n.e(8626).then(n.bind(n,4736)),"@site/versioned_docs/version-11.1/getting-started/presets.md",4736],"2a474b18":[()=>Promise.all([n.e(1869),n.e(8737),n.e(2822)]).then(n.bind(n,1898)),"@site/versioned_docs/version-14.3/getting-started/test-environment.md",1898],"2ab18ce5":[()=>n.e(6530).then(n.bind(n,2704)),"@site/versioned_docs/version-14.2/introduction.md",2704],"2ae17008":[()=>n.e(1635).then(n.bind(n,4140)),"@site/versioned_docs/version-8.x/guides/esm-support.md",4140],"2e81e74f":[()=>Promise.all([n.e(1869),n.e(647)]).then(n.bind(n,7303)),"@site/versioned_docs/version-13.0/guides/angular-ivy.md",7303],30388853:[()=>n.e(9075).then(n.bind(n,2385)),"@site/versioned_docs/version-13.0/processing.md",2385],"327b6d8e":[()=>n.e(6968).then(n.bind(n,3135)),"@site/versioned_docs/version-14.3/introduction.md",3135],"33a5adb4":[()=>Promise.all([n.e(1869),n.e(8737),n.e(2758)]).then(n.bind(n,2944)),"@site/versioned_docs/version-14.2/guides/snapshot-testing.md",2944],"357d33d4":[()=>n.e(5492).then(n.bind(n,5912)),"@site/versioned_docs/version-14.4/guides/esm-support.md",5912],"388d3430":[()=>Promise.all([n.e(1869),n.e(9762)]).then(n.bind(n,3085)),"@site/versioned_docs/version-14.0/guides/angular-13+.md",3085],"3b270bcb":[()=>Promise.all([n.e(1869),n.e(8388)]).then(n.bind(n,9276)),"@site/versioned_docs/version-14.4/guides/angular-ivy.md",9276],"3c7caf67":[()=>Promise.all([n.e(1869),n.e(7375)]).then(n.bind(n,3448)),"@site/versioned_docs/version-14.2/getting-started/installation.md",3448],"407f8801":[()=>Promise.all([n.e(1869),n.e(6261)]).then(n.bind(n,9160)),"@site/versioned_docs/version-9.x/guides/jsdom-version.md",9160],"433cefd8":[()=>Promise.all([n.e(1869),n.e(403)]).then(n.bind(n,6770)),"@site/versioned_docs/version-12.0/guides/angular-ivy.md",6770],"4351d34b":[()=>Promise.all([n.e(1869),n.e(3095)]).then(n.bind(n,3062)),"@site/docs/guides/jsdom-version.md",3062],44821296:[()=>Promise.all([n.e(1869),n.e(8737),n.e(509)]).then(n.bind(n,596)),"@site/versioned_docs/version-14.3/guides/snapshot-testing.md",596],"44b4d73b":[()=>Promise.all([n.e(1869),n.e(9829)]).then(n.bind(n,9004)),"@site/versioned_docs/version-13.0/guides/angular-13+.md",9004],"47c825a2":[()=>Promise.all([n.e(1869),n.e(8879)]).then(n.bind(n,9582)),"@site/docs/guides/using-with-babel.md",9582],"47cccd8d":[()=>n.e(6323).then(n.bind(n,4423)),"@site/versioned_docs/version-12.0/guides/absolute-imports.md",4423],"48dd39e2":[()=>Promise.all([n.e(1869),n.e(2442)]).then(n.bind(n,6990)),"@site/versioned_docs/version-12.0/getting-started/options.md",6990],"4941928a":[()=>Promise.all([n.e(1869),n.e(2703)]).then(n.bind(n,8260)),"@site/versioned_docs/version-14.3/guides/angular-13+.md",8260],"494f4f5e":[()=>n.e(8108).then(n.bind(n,2697)),"@site/versioned_docs/version-10.x/guides/angular-ivy.md",2697],"4b3f866b":[()=>Promise.all([n.e(1869),n.e(7400)]).then(n.bind(n,9197)),"@site/versioned_docs/version-14.2/guides/esm-support.md",9197],"4e0c07c5":[()=>Promise.all([n.e(1869),n.e(5250)]).then(n.bind(n,7872)),"@site/docs/getting-started/options.md",7872],"51d67042":[()=>n.e(6060).then(n.bind(n,9697)),"@site/versioned_docs/version-11.0/guides/using-with-babel.md",9697],"5253afba":[()=>Promise.all([n.e(1869),n.e(7832)]).then(n.bind(n,9011)),"@site/versioned_docs/version-14.3/guides/angular-ivy.md",9011],54071611:[()=>Promise.all([n.e(1869),n.e(6448)]).then(n.bind(n,4730)),"@site/versioned_docs/version-10.x/getting-started/installation.md",4730],"5465ebbc":[()=>n.e(6883).then(n.bind(n,2601)),"@site/versioned_docs/version-14.3/guides/absolute-imports.md",2601],"54f44165":[()=>Promise.all([n.e(1869),n.e(7924)]).then(n.bind(n,7668)),"@site/docs/getting-started/installation.md",7668],"5635425a":[()=>n.e(9806).then(n.bind(n,2699)),"@site/versioned_docs/version-9.x/guides/esm-support.md",2699],"56acf0ae":[()=>Promise.all([n.e(1869),n.e(1694)]).then(n.bind(n,687)),"@site/versioned_docs/version-13.0/guides/jsdom-version.md",687],"58f4fbf7":[()=>n.e(4787).then(n.t.bind(n,4985,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-8-x-495.json",4985],"5ae6b2db":[()=>n.e(6358).then(n.bind(n,8111)),"@site/versioned_docs/version-11.1/introduction.md",8111],"5b125e0e":[()=>Promise.all([n.e(1869),n.e(8904)]).then(n.bind(n,8422)),"@site/docs/guides/angular-13+.md",8422],"5b1cb890":[()=>Promise.all([n.e(1869),n.e(4827)]).then(n.bind(n,499)),"@site/versioned_docs/version-13.0/getting-started/presets.md",499],"5d23d50c":[()=>n.e(7168).then(n.t.bind(n,7896,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-12-0-4a9.json",7896],"5e95c892":[()=>n.e(9647).then(n.bind(n,7121)),"@theme/DocsRoot",7121],"5e9f5e1a":[()=>Promise.resolve().then(n.bind(n,4784)),"@generated/docusaurus.config",4784],"5ee9d842":[()=>n.e(6917).then(n.bind(n,781)),"@site/versioned_docs/version-11.1/getting-started/test-environment.md",781],"5f85402d":[()=>Promise.all([n.e(1869),n.e(3489)]).then(n.bind(n,6570)),"@site/versioned_docs/version-12.0/getting-started/installation.md",6570],"6059e070":[()=>Promise.all([n.e(1869),n.e(8649)]).then(n.bind(n,3118)),"@site/versioned_docs/version-13.0/getting-started/installation.md",3118],"6266f1ba":[()=>n.e(5883).then(n.bind(n,5911)),"@site/versioned_docs/version-8.x/getting-started/options.md",5911],"63150b11":[()=>n.e(3596).then(n.bind(n,4383)),"@site/versioned_docs/version-9.x/getting-started/options.md",4383],"651850eb":[()=>n.e(9461).then(n.bind(n,4866)),"@site/versioned_docs/version-8.x/introduction.md",4866],"6608151e":[()=>n.e(2891).then(n.bind(n,185)),"@site/versioned_docs/version-10.x/introduction.md",185],68240572:[()=>Promise.all([n.e(1869),n.e(8737),n.e(689)]).then(n.bind(n,4564)),"@site/docs/guides/snapshot-testing.md",4564],"68e3f1d5":[()=>Promise.all([n.e(1869),n.e(7367)]).then(n.bind(n,4713)),"@site/versioned_docs/version-12.0/guides/angular-13+.md",4713],"6916680a":[()=>Promise.all([n.e(1869),n.e(3818)]).then(n.bind(n,6696)),"@site/versioned_docs/version-11.0/getting-started/installation.md",6696],"6a6dcee7":[()=>n.e(7466).then(n.bind(n,3577)),"@site/versioned_docs/version-14.2/getting-started/test-environment.md",3577],"6d1ddfa7":[()=>n.e(4240).then(n.bind(n,6021)),"@site/versioned_docs/version-13.0/guides/absolute-imports.md",6021],"6f809103":[()=>Promise.all([n.e(1869),n.e(646)]).then(n.bind(n,9258)),"@site/versioned_docs/version-14.0/guides/using-with-babel.md",9258],"710ad8a9":[()=>Promise.all([n.e(1869),n.e(8828)]).then(n.bind(n,2067)),"@site/versioned_docs/version-11.0/guides/jsdom-version.md",2067],"72f058d3":[()=>n.e(7330).then(n.bind(n,6489)),"@site/versioned_docs/version-8.x/guides/troubleshooting.md",6489],"732c3ce9":[()=>n.e(4340).then(n.bind(n,3381)),"@site/versioned_docs/version-13.0/getting-started/test-environment.md",3381],"79ea3e73":[()=>n.e(795).then(n.bind(n,9892)),"@site/versioned_docs/version-9.x/getting-started/presets.md",9892],"7aeeadd4":[()=>n.e(8654).then(n.bind(n,3004)),"@site/versioned_docs/version-8.x/getting-started/test-environment.md",3004],"7d7dbec2":[()=>n.e(1315).then(n.t.bind(n,3925,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-9-x-465.json",3925],"80b4c599":[()=>n.e(131).then(n.bind(n,7087)),"@site/versioned_docs/version-12.0/getting-started/test-environment.md",7087],"85e14910":[()=>Promise.all([n.e(1869),n.e(3170)]).then(n.bind(n,8779)),"@site/versioned_docs/version-14.0/getting-started/installation.md",8779],"8665e647":[()=>Promise.all([n.e(1869),n.e(5700)]).then(n.bind(n,3852)),"@site/versioned_docs/version-11.1/getting-started/installation.md",3852],"8afa1348":[()=>n.e(2341).then(n.bind(n,747)),"@site/versioned_docs/version-10.x/processing.md",747],"8b263414":[()=>n.e(347).then(n.bind(n,6102)),"@site/versioned_docs/version-11.0/guides/angular-ivy.md",6102],"8e1736e0":[()=>n.e(4394).then(n.t.bind(n,5833,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-14-3-a8a.json",5833],"8f3baa16":[()=>Promise.all([n.e(1869),n.e(217)]).then(n.bind(n,182)),"@site/versioned_docs/version-14.3/getting-started/options.md",182],"915eea02":[()=>n.e(1263).then(n.bind(n,3367)),"@site/versioned_docs/version-14.4/introduction.md",3367],"9251a350":[()=>n.e(5075).then(n.bind(n,798)),"@site/versioned_docs/version-11.0/guides/esm-support.md",798],"93f0793d":[()=>n.e(1352).then(n.bind(n,9928)),"@site/versioned_docs/version-9.x/guides/using-with-babel.md",9928],"95451dd5":[()=>n.e(6201).then(n.bind(n,9584)),"@site/versioned_docs/version-14.4/processing.md",9584],"9798ce17":[()=>Promise.all([n.e(1869),n.e(6224)]).then(n.bind(n,9854)),"@site/versioned_docs/version-14.0/getting-started/presets.md",9854],"9903dc99":[()=>n.e(5487).then(n.bind(n,96)),"@site/versioned_docs/version-8.x/guides/angular-ivy.md",96],"9a2fa73a":[()=>Promise.all([n.e(1869),n.e(8937)]).then(n.bind(n,4241)),"@site/versioned_docs/version-13.0/guides/using-with-babel.md",4241],"9bc9e25c":[()=>n.e(223).then(n.bind(n,8946)),"@site/versioned_docs/version-13.0/introduction.md",8946],"9d48492b":[()=>n.e(3737).then(n.bind(n,5452)),"@site/versioned_docs/version-14.0/getting-started/test-environment.md",5452],"9fc1d339":[()=>n.e(8201).then(n.bind(n,1223)),"@site/versioned_docs/version-11.1/guides/troubleshooting.md",1223],a05464cd:[()=>Promise.all([n.e(1869),n.e(8737),n.e(1832)]).then(n.bind(n,4121)),"@site/versioned_docs/version-14.4/guides/snapshot-testing.md",4121],a09c2993:[()=>n.e(5899).then(n.bind(n,1920)),"@site/docs/introduction.md",1920],a389e28e:[()=>Promise.all([n.e(1869),n.e(7554)]).then(n.bind(n,8827)),"@site/versioned_docs/version-12.0/guides/esm-support.md",8827],a7456010:[()=>n.e(1235).then(n.t.bind(n,8552,19)),"@generated/docusaurus-plugin-content-pages/default/__plugin.json",8552],a74b641e:[()=>n.e(1841).then(n.bind(n,6092)),"@site/versioned_docs/version-9.x/guides/absolute-imports.md",6092],a7bd4aaa:[()=>n.e(7098).then(n.bind(n,4532)),"@theme/DocVersionRoot",4532],a7d04da7:[()=>Promise.all([n.e(1869),n.e(2363)]).then(n.bind(n,7080)),"@site/versioned_docs/version-14.4/guides/troubleshooting.md",7080],a7d61b99:[()=>Promise.all([n.e(1869),n.e(2766)]).then(n.bind(n,3011)),"@site/versioned_docs/version-12.0/guides/jsdom-version.md",3011],a89007e0:[()=>Promise.all([n.e(1869),n.e(3767)]).then(n.bind(n,5858)),"@site/versioned_docs/version-14.2/guides/angular-13+.md",5858],a94703ab:[()=>Promise.all([n.e(1869),n.e(9048)]).then(n.bind(n,1377)),"@theme/DocRoot",1377],a9789633:[()=>n.e(3543).then(n.bind(n,9131)),"@site/versioned_docs/version-9.x/guides/troubleshooting.md",9131],aa079c8b:[()=>Promise.all([n.e(1869),n.e(2772)]).then(n.bind(n,374)),"@site/versioned_docs/version-13.0/getting-started/options.md",374],aad144a3:[()=>n.e(9104).then(n.bind(n,568)),"@site/versioned_docs/version-11.1/guides/angular-13+.md",568],aba21aa0:[()=>n.e(5742).then(n.t.bind(n,7093,19)),"@generated/docusaurus-plugin-content-docs/default/__plugin.json",7093],adb64ee2:[()=>n.e(8480).then(n.bind(n,5622)),"@site/versioned_docs/version-8.x/processing.md",5622],af572879:[()=>Promise.all([n.e(1869),n.e(6308)]).then(n.bind(n,2630)),"@site/versioned_docs/version-14.3/getting-started/installation.md",2630],afba4106:[()=>n.e(1942).then(n.bind(n,5831)),"@site/versioned_docs/version-11.0/getting-started/test-environment.md",5831],b2161dc5:[()=>n.e(709).then(n.bind(n,8615)),"@site/versioned_docs/version-14.0/processing.md",8615],b4c5bdfe:[()=>n.e(4344).then(n.bind(n,8556)),"@site/versioned_docs/version-14.2/processing.md",8556],b647df5a:[()=>n.e(2624).then(n.bind(n,31)),"@site/versioned_docs/version-8.x/guides/using-with-babel.md",31],b83f237d:[()=>n.e(8930).then(n.bind(n,5804)),"@site/versioned_docs/version-14.2/guides/absolute-imports.md",5804],bb70b9c8:[()=>n.e(9760).then(n.t.bind(n,5673,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-3da.json",5673],c00c612c:[()=>n.e(5603).then(n.bind(n,4126)),"@site/versioned_docs/version-10.x/getting-started/test-environment.md",4126],c141421f:[()=>n.e(957).then(n.t.bind(n,936,19)),"@generated/docusaurus-theme-search-algolia/default/__plugin.json",936],c1865e7c:[()=>n.e(1049).then(n.t.bind(n,9636,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-14-0-33f.json",9636],c1bdbc58:[()=>n.e(9467).then(n.bind(n,9159)),"@site/versioned_docs/version-14.0/introduction.md",9159],c44fa306:[()=>n.e(2274).then(n.bind(n,4044)),"@site/versioned_docs/version-8.x/getting-started/presets.md",4044],c49413db:[()=>n.e(1767).then(n.bind(n,2575)),"@site/versioned_docs/version-10.x/guides/esm-support.md",2575],c4ba122c:[()=>Promise.all([n.e(1869),n.e(4769)]).then(n.bind(n,5747)),"@site/versioned_docs/version-14.2/guides/using-with-babel.md",5747],c62dfc48:[()=>n.e(51).then(n.bind(n,7704)),"@site/versioned_docs/version-14.0/guides/troubleshooting.md",7704],c7279284:[()=>n.e(1605).then(n.bind(n,3063)),"@site/versioned_docs/version-11.0/getting-started/options.md",3063],c9f7f11b:[()=>n.e(2052).then(n.t.bind(n,8454,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-10-x-ab5.json",8454],cd9c57cb:[()=>n.e(5297).then(n.bind(n,4710)),"@site/versioned_docs/version-10.x/guides/absolute-imports.md",4710],d069ae84:[()=>n.e(1454).then(n.bind(n,9453)),"@site/versioned_docs/version-11.0/guides/angular-13+.md",9453],d19b9e8a:[()=>n.e(5240).then(n.bind(n,4521)),"@site/docs/guides/absolute-imports.md",4521],d1b207fe:[()=>n.e(1090).then(n.bind(n,7972)),"@site/versioned_docs/version-13.0/guides/troubleshooting.md",7972],d2df711a:[()=>n.e(2601).then(n.bind(n,7498)),"@site/versioned_docs/version-11.0/guides/absolute-imports.md",7498],d30d9744:[()=>n.e(3344).then(n.t.bind(n,9560,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-13-0-e91.json",9560],d4836a8e:[()=>n.e(106).then(n.bind(n,248)),"@site/docs/guides/esm-support.md",248],d720bb60:[()=>n.e(5596).then(n.bind(n,6281)),"@site/versioned_docs/version-9.x/guides/angular-ivy.md",6281],d9330f66:[()=>Promise.all([n.e(1869),n.e(8678)]).then(n.bind(n,7587)),"@site/versioned_docs/version-13.0/guides/esm-support.md",7587],d957c22b:[()=>Promise.all([n.e(1869),n.e(9353)]).then(n.bind(n,5867)),"@site/versioned_docs/version-14.4/guides/angular-13+.md",5867],daab97c5:[()=>n.e(1555).then(n.bind(n,648)),"@site/versioned_docs/version-11.1/processing.md",648],dc033a20:[()=>n.e(949).then(n.t.bind(n,9466,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-11-0-0a4.json",9466],dd1da75d:[()=>Promise.all([n.e(1869),n.e(8737),n.e(7951)]).then(n.bind(n,9747)),"@site/versioned_docs/version-14.4/getting-started/test-environment.md",9747],dd8b0175:[()=>Promise.all([n.e(1869),n.e(2972)]).then(n.bind(n,4125)),"@site/versioned_docs/version-11.1/guides/jsdom-version.md",4125],df70a34a:[()=>n.e(9197).then(n.bind(n,7267)),"@site/versioned_docs/version-10.x/guides/using-with-babel.md",7267],dff5aaca:[()=>n.e(744).then(n.bind(n,7707)),"@site/versioned_docs/version-14.2/guides/troubleshooting.md",7707],e0a3f9c8:[()=>n.e(46).then(n.bind(n,1438)),"@site/versioned_docs/version-11.1/guides/esm-support.md",1438],e1715838:[()=>n.e(6603).then(n.bind(n,3804)),"@site/versioned_docs/version-9.x/introduction.md",3804],e36b815f:[()=>n.e(2659).then(n.bind(n,6146)),"@site/versioned_docs/version-14.4/guides/absolute-imports.md",6146],e59053ae:[()=>Promise.all([n.e(1869),n.e(8737),n.e(2008)]).then(n.bind(n,5500)),"@site/versioned_docs/version-14.4/getting-started/presets.md",5500],e5a27df7:[()=>Promise.all([n.e(1869),n.e(2416)]).then(n.bind(n,8159)),"@site/versioned_docs/version-14.4/getting-started/options.md",8159],ea131d77:[()=>n.e(8624).then(n.bind(n,1313)),"@site/versioned_docs/version-11.1/guides/absolute-imports.md",1313],eabdbf07:[()=>n.e(5100).then(n.bind(n,2997)),"@site/docs/processing.md",2997],eae657ee:[()=>n.e(4134).then(n.bind(n,4880)),"@site/versioned_docs/version-11.1/getting-started/options.md",4880],ebf39289:[()=>Promise.all([n.e(1869),n.e(8715)]).then(n.bind(n,9546)),"@site/versioned_docs/version-14.0/getting-started/options.md",9546],ec1d9510:[()=>n.e(3421).then(n.bind(n,6418)),"@site/versioned_docs/version-11.0/guides/troubleshooting.md",6418],ec7d5e88:[()=>Promise.all([n.e(1869),n.e(9896)]).then(n.bind(n,7988)),"@site/versioned_docs/version-14.3/getting-started/presets.md",7988],ecfacc56:[()=>n.e(1019).then(n.bind(n,1811)),"@site/versioned_docs/version-11.0/processing.md",1811],ef2f3ccd:[()=>Promise.all([n.e(1869),n.e(6741)]).then(n.bind(n,6979)),"@site/versioned_docs/version-14.2/getting-started/options.md",6979],f0447160:[()=>Promise.all([n.e(1869),n.e(499)]).then(n.bind(n,7727)),"@site/versioned_docs/version-8.x/guides/jsdom-version.md",7727],f14ecac0:[()=>n.e(8704).then(n.bind(n,9088)),"@site/versioned_docs/version-12.0/introduction.md",9088],f2ed1a27:[()=>n.e(667).then(n.t.bind(n,6011,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-14-2-238.json",6011],f3212b1e:[()=>Promise.all([n.e(1869),n.e(7511)]).then(n.bind(n,5496)),"@site/versioned_docs/version-10.x/guides/jsdom-version.md",5496],f43def45:[()=>Promise.all([n.e(1869),n.e(2656)]).then(n.bind(n,1524)),"@site/versioned_docs/version-11.1/guides/angular-ivy.md",1524],f546eb96:[()=>n.e(6370).then(n.bind(n,8115)),"@site/versioned_docs/version-9.x/processing.md",8115],f67ebb5d:[()=>n.e(5416).then(n.t.bind(n,5200,19)),"@generated/docusaurus-plugin-content-docs/default/p/jest-preset-angular-docs-11-1-cd3.json",5200],f97daad0:[()=>n.e(5243).then(n.bind(n,560)),"@site/versioned_docs/version-8.x/guides/absolute-imports.md",560],fa17a3e5:[()=>n.e(8054).then(n.bind(n,3303)),"@site/src/pages/versions.tsx",3303],fa9f2ace:[()=>n.e(742).then(n.bind(n,5034)),"@site/versioned_docs/version-11.0/getting-started/presets.md",5034],fbd32610:[()=>Promise.all([n.e(1869),n.e(6543)]).then(n.bind(n,9570)),"@site/versioned_docs/version-14.4/guides/using-with-babel.md",9570],fc80686b:[()=>Promise.all([n.e(1869),n.e(8737),n.e(2440)]).then(n.bind(n,4160)),"@site/docs/getting-started/presets.md",4160],fea96f18:[()=>n.e(3309).then(n.bind(n,7125)),"@site/versioned_docs/version-12.0/guides/troubleshooting.md",7125]};var i=n(4848);function l(e){let{error:t,retry:n,pastDelay:r}=e;return t?(0,i.jsxs)("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"},children:[(0,i.jsx)("p",{children:String(t)}),(0,i.jsx)("div",{children:(0,i.jsx)("button",{type:"button",onClick:n,children:"Retry"})})]}):r?(0,i.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,i.jsx)("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb",children:(0,i.jsxs)("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2",children:[(0,i.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,i.jsx)("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,i.jsx)("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,i.jsx)("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,i.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,i.jsx)("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,i.jsx)("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,i.jsx)("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,i.jsx)("circle",{cx:"22",cy:"22",r:"8",children:(0,i.jsx)("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"})})]})})}):null}var c=n(6921),u=n(3102);function d(e,t){if("*"===e)return o()({loading:l,loader:()=>n.e(2237).then(n.bind(n,2237)),modules:["@theme/NotFound"],webpack:()=>[2237],render(e,t){const n=e.default;return(0,i.jsx)(u.W,{value:{plugin:{name:"native",id:"default"}},children:(0,i.jsx)(n,{...t})})}});const r=a[`${e}-${t}`],d={},p=[],f=[],g=(0,c.A)(r);return Object.entries(g).forEach((e=>{let[t,n]=e;const r=s[n];r&&(d[t]=r[0],p.push(r[1]),f.push(r[2]))})),o().Map({loading:l,loader:d,modules:p,webpack:()=>f,render(t,n){const o=JSON.parse(JSON.stringify(r));Object.entries(t).forEach((t=>{let[n,r]=t;const a=r.default;if(!a)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof a&&"function"!=typeof a||Object.keys(r).filter((e=>"default"!==e)).forEach((e=>{a[e]=r[e]}));let s=o;const i=n.split(".");i.slice(0,-1).forEach((e=>{s=s[e]})),s[i[i.length-1]]=a}));const a=o.__comp;delete o.__comp;const s=o.__context;delete o.__context;const l=o.__props;return delete o.__props,(0,i.jsx)(u.W,{value:s,children:(0,i.jsx)(a,{...o,...l,...n})})}})}const p=[{path:"/jest-preset-angular/search",component:d("/jest-preset-angular/search","948"),exact:!0},{path:"/jest-preset-angular/versions",component:d("/jest-preset-angular/versions","4c3"),exact:!0},{path:"/jest-preset-angular/docs",component:d("/jest-preset-angular/docs","074"),routes:[{path:"/jest-preset-angular/docs/10.x",component:d("/jest-preset-angular/docs/10.x","6e5"),routes:[{path:"/jest-preset-angular/docs/10.x",component:d("/jest-preset-angular/docs/10.x","88d"),routes:[{path:"/jest-preset-angular/docs/10.x/",component:d("/jest-preset-angular/docs/10.x/","5e1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/getting-started/installation",component:d("/jest-preset-angular/docs/10.x/getting-started/installation","1ae"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/getting-started/options",component:d("/jest-preset-angular/docs/10.x/getting-started/options","c06"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/getting-started/presets",component:d("/jest-preset-angular/docs/10.x/getting-started/presets","44d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/getting-started/test-environment",component:d("/jest-preset-angular/docs/10.x/getting-started/test-environment","132"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/absolute-imports",component:d("/jest-preset-angular/docs/10.x/guides/absolute-imports","075"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/angular-ivy",component:d("/jest-preset-angular/docs/10.x/guides/angular-ivy","1c3"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/esm-support",component:d("/jest-preset-angular/docs/10.x/guides/esm-support","152"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/jsdom-version",component:d("/jest-preset-angular/docs/10.x/guides/jsdom-version","522"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/troubleshooting",component:d("/jest-preset-angular/docs/10.x/guides/troubleshooting","9c6"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/guides/using-with-babel",component:d("/jest-preset-angular/docs/10.x/guides/using-with-babel","d13"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/10.x/processing",component:d("/jest-preset-angular/docs/10.x/processing","c81"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/11.0",component:d("/jest-preset-angular/docs/11.0","4d0"),routes:[{path:"/jest-preset-angular/docs/11.0",component:d("/jest-preset-angular/docs/11.0","6c8"),routes:[{path:"/jest-preset-angular/docs/11.0/",component:d("/jest-preset-angular/docs/11.0/","34e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/getting-started/installation",component:d("/jest-preset-angular/docs/11.0/getting-started/installation","8e7"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/getting-started/options",component:d("/jest-preset-angular/docs/11.0/getting-started/options","fb3"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/getting-started/presets",component:d("/jest-preset-angular/docs/11.0/getting-started/presets","60e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/getting-started/test-environment",component:d("/jest-preset-angular/docs/11.0/getting-started/test-environment","0ce"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/absolute-imports",component:d("/jest-preset-angular/docs/11.0/guides/absolute-imports","5bd"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/angular-13+",component:d("/jest-preset-angular/docs/11.0/guides/angular-13+","d6e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/angular-ivy",component:d("/jest-preset-angular/docs/11.0/guides/angular-ivy","9cf"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/esm-support",component:d("/jest-preset-angular/docs/11.0/guides/esm-support","9ad"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/jsdom-version",component:d("/jest-preset-angular/docs/11.0/guides/jsdom-version","227"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/troubleshooting",component:d("/jest-preset-angular/docs/11.0/guides/troubleshooting","a5d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/guides/using-with-babel",component:d("/jest-preset-angular/docs/11.0/guides/using-with-babel","5f7"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.0/processing",component:d("/jest-preset-angular/docs/11.0/processing","4ad"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/11.1",component:d("/jest-preset-angular/docs/11.1","12c"),routes:[{path:"/jest-preset-angular/docs/11.1",component:d("/jest-preset-angular/docs/11.1","0bb"),routes:[{path:"/jest-preset-angular/docs/11.1/",component:d("/jest-preset-angular/docs/11.1/","fc4"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/getting-started/installation",component:d("/jest-preset-angular/docs/11.1/getting-started/installation","1c6"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/getting-started/options",component:d("/jest-preset-angular/docs/11.1/getting-started/options","875"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/getting-started/presets",component:d("/jest-preset-angular/docs/11.1/getting-started/presets","62f"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/getting-started/test-environment",component:d("/jest-preset-angular/docs/11.1/getting-started/test-environment","d96"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/absolute-imports",component:d("/jest-preset-angular/docs/11.1/guides/absolute-imports","f80"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/angular-13+",component:d("/jest-preset-angular/docs/11.1/guides/angular-13+","58d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/angular-ivy",component:d("/jest-preset-angular/docs/11.1/guides/angular-ivy","3ee"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/esm-support",component:d("/jest-preset-angular/docs/11.1/guides/esm-support","fbf"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/jsdom-version",component:d("/jest-preset-angular/docs/11.1/guides/jsdom-version","f12"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/troubleshooting",component:d("/jest-preset-angular/docs/11.1/guides/troubleshooting","feb"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/guides/using-with-babel",component:d("/jest-preset-angular/docs/11.1/guides/using-with-babel","b0c"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/11.1/processing",component:d("/jest-preset-angular/docs/11.1/processing","aba"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/12.0",component:d("/jest-preset-angular/docs/12.0","0a3"),routes:[{path:"/jest-preset-angular/docs/12.0",component:d("/jest-preset-angular/docs/12.0","a63"),routes:[{path:"/jest-preset-angular/docs/12.0/",component:d("/jest-preset-angular/docs/12.0/","70d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/getting-started/installation",component:d("/jest-preset-angular/docs/12.0/getting-started/installation","18d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/getting-started/options",component:d("/jest-preset-angular/docs/12.0/getting-started/options","514"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/getting-started/presets",component:d("/jest-preset-angular/docs/12.0/getting-started/presets","eb3"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/getting-started/test-environment",component:d("/jest-preset-angular/docs/12.0/getting-started/test-environment","0eb"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/absolute-imports",component:d("/jest-preset-angular/docs/12.0/guides/absolute-imports","5e9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/angular-13+",component:d("/jest-preset-angular/docs/12.0/guides/angular-13+","124"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/angular-ivy",component:d("/jest-preset-angular/docs/12.0/guides/angular-ivy","392"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/esm-support",component:d("/jest-preset-angular/docs/12.0/guides/esm-support","65d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/jsdom-version",component:d("/jest-preset-angular/docs/12.0/guides/jsdom-version","3fe"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/troubleshooting",component:d("/jest-preset-angular/docs/12.0/guides/troubleshooting","061"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/guides/using-with-babel",component:d("/jest-preset-angular/docs/12.0/guides/using-with-babel","995"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/12.0/processing",component:d("/jest-preset-angular/docs/12.0/processing","5bf"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/13.0",component:d("/jest-preset-angular/docs/13.0","0e5"),routes:[{path:"/jest-preset-angular/docs/13.0",component:d("/jest-preset-angular/docs/13.0","88e"),routes:[{path:"/jest-preset-angular/docs/13.0/",component:d("/jest-preset-angular/docs/13.0/","1a4"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/getting-started/installation",component:d("/jest-preset-angular/docs/13.0/getting-started/installation","b75"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/getting-started/options",component:d("/jest-preset-angular/docs/13.0/getting-started/options","d92"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/getting-started/presets",component:d("/jest-preset-angular/docs/13.0/getting-started/presets","364"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/getting-started/test-environment",component:d("/jest-preset-angular/docs/13.0/getting-started/test-environment","dc3"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/absolute-imports",component:d("/jest-preset-angular/docs/13.0/guides/absolute-imports","108"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/angular-13+",component:d("/jest-preset-angular/docs/13.0/guides/angular-13+","f9c"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/angular-ivy",component:d("/jest-preset-angular/docs/13.0/guides/angular-ivy","182"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/esm-support",component:d("/jest-preset-angular/docs/13.0/guides/esm-support","905"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/jsdom-version",component:d("/jest-preset-angular/docs/13.0/guides/jsdom-version","b9a"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/troubleshooting",component:d("/jest-preset-angular/docs/13.0/guides/troubleshooting","0f4"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/guides/using-with-babel",component:d("/jest-preset-angular/docs/13.0/guides/using-with-babel","b1b"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/13.0/processing",component:d("/jest-preset-angular/docs/13.0/processing","22f"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/14.0",component:d("/jest-preset-angular/docs/14.0","4ea"),routes:[{path:"/jest-preset-angular/docs/14.0",component:d("/jest-preset-angular/docs/14.0","2c3"),routes:[{path:"/jest-preset-angular/docs/14.0/",component:d("/jest-preset-angular/docs/14.0/","bd1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/getting-started/installation",component:d("/jest-preset-angular/docs/14.0/getting-started/installation","811"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/getting-started/options",component:d("/jest-preset-angular/docs/14.0/getting-started/options","568"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/getting-started/presets",component:d("/jest-preset-angular/docs/14.0/getting-started/presets","60f"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/getting-started/test-environment",component:d("/jest-preset-angular/docs/14.0/getting-started/test-environment","1d8"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/absolute-imports",component:d("/jest-preset-angular/docs/14.0/guides/absolute-imports","8e9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/angular-13+",component:d("/jest-preset-angular/docs/14.0/guides/angular-13+","6e3"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/angular-ivy",component:d("/jest-preset-angular/docs/14.0/guides/angular-ivy","218"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/esm-support",component:d("/jest-preset-angular/docs/14.0/guides/esm-support","bf8"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/jsdom-version",component:d("/jest-preset-angular/docs/14.0/guides/jsdom-version","af8"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/troubleshooting",component:d("/jest-preset-angular/docs/14.0/guides/troubleshooting","49d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/guides/using-with-babel",component:d("/jest-preset-angular/docs/14.0/guides/using-with-babel","1e1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.0/processing",component:d("/jest-preset-angular/docs/14.0/processing","33e"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/14.2",component:d("/jest-preset-angular/docs/14.2","af3"),routes:[{path:"/jest-preset-angular/docs/14.2",component:d("/jest-preset-angular/docs/14.2","f2b"),routes:[{path:"/jest-preset-angular/docs/14.2/",component:d("/jest-preset-angular/docs/14.2/","6e2"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/getting-started/installation",component:d("/jest-preset-angular/docs/14.2/getting-started/installation","f85"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/getting-started/options",component:d("/jest-preset-angular/docs/14.2/getting-started/options","8cb"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/getting-started/presets",component:d("/jest-preset-angular/docs/14.2/getting-started/presets","16e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/getting-started/test-environment",component:d("/jest-preset-angular/docs/14.2/getting-started/test-environment","76a"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/absolute-imports",component:d("/jest-preset-angular/docs/14.2/guides/absolute-imports","3f1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/angular-13+",component:d("/jest-preset-angular/docs/14.2/guides/angular-13+","0dc"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/angular-ivy",component:d("/jest-preset-angular/docs/14.2/guides/angular-ivy","689"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/esm-support",component:d("/jest-preset-angular/docs/14.2/guides/esm-support","c77"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/jsdom-version",component:d("/jest-preset-angular/docs/14.2/guides/jsdom-version","8b6"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/snapshot-testing",component:d("/jest-preset-angular/docs/14.2/guides/snapshot-testing","8b6"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/troubleshooting",component:d("/jest-preset-angular/docs/14.2/guides/troubleshooting","834"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/guides/using-with-babel",component:d("/jest-preset-angular/docs/14.2/guides/using-with-babel","b46"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.2/processing",component:d("/jest-preset-angular/docs/14.2/processing","48f"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/14.3",component:d("/jest-preset-angular/docs/14.3","8b6"),routes:[{path:"/jest-preset-angular/docs/14.3",component:d("/jest-preset-angular/docs/14.3","1f4"),routes:[{path:"/jest-preset-angular/docs/14.3/",component:d("/jest-preset-angular/docs/14.3/","f1b"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/getting-started/installation",component:d("/jest-preset-angular/docs/14.3/getting-started/installation","501"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/getting-started/options",component:d("/jest-preset-angular/docs/14.3/getting-started/options","fa8"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/getting-started/presets",component:d("/jest-preset-angular/docs/14.3/getting-started/presets","581"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/getting-started/test-environment",component:d("/jest-preset-angular/docs/14.3/getting-started/test-environment","424"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/absolute-imports",component:d("/jest-preset-angular/docs/14.3/guides/absolute-imports","a3f"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/angular-13+",component:d("/jest-preset-angular/docs/14.3/guides/angular-13+","614"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/angular-ivy",component:d("/jest-preset-angular/docs/14.3/guides/angular-ivy","cc3"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/esm-support",component:d("/jest-preset-angular/docs/14.3/guides/esm-support","30a"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/jsdom-version",component:d("/jest-preset-angular/docs/14.3/guides/jsdom-version","2bb"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/snapshot-testing",component:d("/jest-preset-angular/docs/14.3/guides/snapshot-testing","10b"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/troubleshooting",component:d("/jest-preset-angular/docs/14.3/guides/troubleshooting","967"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/guides/using-with-babel",component:d("/jest-preset-angular/docs/14.3/guides/using-with-babel","b97"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/14.3/processing",component:d("/jest-preset-angular/docs/14.3/processing","2ad"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/8.x",component:d("/jest-preset-angular/docs/8.x","7ae"),routes:[{path:"/jest-preset-angular/docs/8.x",component:d("/jest-preset-angular/docs/8.x","ca3"),routes:[{path:"/jest-preset-angular/docs/8.x/",component:d("/jest-preset-angular/docs/8.x/","c36"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/getting-started/installation",component:d("/jest-preset-angular/docs/8.x/getting-started/installation","606"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/getting-started/options",component:d("/jest-preset-angular/docs/8.x/getting-started/options","36a"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/getting-started/presets",component:d("/jest-preset-angular/docs/8.x/getting-started/presets","71d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/getting-started/test-environment",component:d("/jest-preset-angular/docs/8.x/getting-started/test-environment","110"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/absolute-imports",component:d("/jest-preset-angular/docs/8.x/guides/absolute-imports","3a8"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/angular-ivy",component:d("/jest-preset-angular/docs/8.x/guides/angular-ivy","566"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/esm-support",component:d("/jest-preset-angular/docs/8.x/guides/esm-support","461"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/jsdom-version",component:d("/jest-preset-angular/docs/8.x/guides/jsdom-version","218"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/troubleshooting",component:d("/jest-preset-angular/docs/8.x/guides/troubleshooting","4e8"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/guides/using-with-babel",component:d("/jest-preset-angular/docs/8.x/guides/using-with-babel","3d1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/8.x/processing",component:d("/jest-preset-angular/docs/8.x/processing","202"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/9.x",component:d("/jest-preset-angular/docs/9.x","091"),routes:[{path:"/jest-preset-angular/docs/9.x",component:d("/jest-preset-angular/docs/9.x","f89"),routes:[{path:"/jest-preset-angular/docs/9.x/",component:d("/jest-preset-angular/docs/9.x/","89c"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/getting-started/installation",component:d("/jest-preset-angular/docs/9.x/getting-started/installation","a49"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/getting-started/options",component:d("/jest-preset-angular/docs/9.x/getting-started/options","11d"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/getting-started/presets",component:d("/jest-preset-angular/docs/9.x/getting-started/presets","342"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/getting-started/test-environment",component:d("/jest-preset-angular/docs/9.x/getting-started/test-environment","728"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/absolute-imports",component:d("/jest-preset-angular/docs/9.x/guides/absolute-imports","ad1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/angular-ivy",component:d("/jest-preset-angular/docs/9.x/guides/angular-ivy","3e0"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/esm-support",component:d("/jest-preset-angular/docs/9.x/guides/esm-support","d87"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/jsdom-version",component:d("/jest-preset-angular/docs/9.x/guides/jsdom-version","664"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/troubleshooting",component:d("/jest-preset-angular/docs/9.x/guides/troubleshooting","d1c"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/guides/using-with-babel",component:d("/jest-preset-angular/docs/9.x/guides/using-with-babel","a60"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/9.x/processing",component:d("/jest-preset-angular/docs/9.x/processing","120"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs/next",component:d("/jest-preset-angular/docs/next","9e7"),routes:[{path:"/jest-preset-angular/docs/next",component:d("/jest-preset-angular/docs/next","8fc"),routes:[{path:"/jest-preset-angular/docs/next/",component:d("/jest-preset-angular/docs/next/","301"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/getting-started/installation",component:d("/jest-preset-angular/docs/next/getting-started/installation","444"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/getting-started/options",component:d("/jest-preset-angular/docs/next/getting-started/options","683"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/getting-started/presets",component:d("/jest-preset-angular/docs/next/getting-started/presets","841"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/getting-started/test-environment",component:d("/jest-preset-angular/docs/next/getting-started/test-environment","e77"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/absolute-imports",component:d("/jest-preset-angular/docs/next/guides/absolute-imports","7b5"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/angular-13+",component:d("/jest-preset-angular/docs/next/guides/angular-13+","af5"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/angular-ivy",component:d("/jest-preset-angular/docs/next/guides/angular-ivy","476"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/esm-support",component:d("/jest-preset-angular/docs/next/guides/esm-support","3c5"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/jsdom-version",component:d("/jest-preset-angular/docs/next/guides/jsdom-version","ad1"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/snapshot-testing",component:d("/jest-preset-angular/docs/next/guides/snapshot-testing","8ac"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/troubleshooting",component:d("/jest-preset-angular/docs/next/guides/troubleshooting","b2e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/guides/using-with-babel",component:d("/jest-preset-angular/docs/next/guides/using-with-babel","5a5"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/next/processing",component:d("/jest-preset-angular/docs/next/processing","6b2"),exact:!0,sidebar:"docs"}]}]},{path:"/jest-preset-angular/docs",component:d("/jest-preset-angular/docs","a75"),routes:[{path:"/jest-preset-angular/docs",component:d("/jest-preset-angular/docs","d90"),routes:[{path:"/jest-preset-angular/docs/",component:d("/jest-preset-angular/docs/","3e2"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/getting-started/installation",component:d("/jest-preset-angular/docs/getting-started/installation","8ea"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/getting-started/options",component:d("/jest-preset-angular/docs/getting-started/options","a7b"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/getting-started/presets",component:d("/jest-preset-angular/docs/getting-started/presets","c5a"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/getting-started/test-environment",component:d("/jest-preset-angular/docs/getting-started/test-environment","d76"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/absolute-imports",component:d("/jest-preset-angular/docs/guides/absolute-imports","52e"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/angular-13+",component:d("/jest-preset-angular/docs/guides/angular-13+","7b9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/angular-ivy",component:d("/jest-preset-angular/docs/guides/angular-ivy","452"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/esm-support",component:d("/jest-preset-angular/docs/guides/esm-support","b9c"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/jsdom-version",component:d("/jest-preset-angular/docs/guides/jsdom-version","a84"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/snapshot-testing",component:d("/jest-preset-angular/docs/guides/snapshot-testing","bcb"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/troubleshooting",component:d("/jest-preset-angular/docs/guides/troubleshooting","4a9"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/guides/using-with-babel",component:d("/jest-preset-angular/docs/guides/using-with-babel","149"),exact:!0,sidebar:"docs"},{path:"/jest-preset-angular/docs/processing",component:d("/jest-preset-angular/docs/processing","32b"),exact:!0,sidebar:"docs"}]}]}]},{path:"/jest-preset-angular/",component:d("/jest-preset-angular/","c4f"),exact:!0},{path:"*",component:d("*")}]},6125:(e,t,n)=>{"use strict";n.d(t,{o:()=>a,x:()=>s});var r=n(6540),o=n(4848);const a=r.createContext(!1);function s(e){let{children:t}=e;const[n,s]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{s(!0)}),[]),(0,o.jsx)(a.Provider,{value:n,children:t})}},8536:(e,t,n)=>{"use strict";var r=n(6540),o=n(5338),a=n(545),s=n(4625),i=n(4784),l=n(8193);const c=[n(119),n(6134),n(6294),n(1043),n(4096)];var u=n(8328),d=n(6347),p=n(2831),f=n(4848);function g(e){let{children:t}=e;return(0,f.jsx)(f.Fragment,{children:t})}var m=n(5260),h=n(4586),b=n(6025),v=n(6342),y=n(9024),w=n(2131),x=n(4090),j=n(2967),k=n(440),S=n(1463);function _(){const{i18n:{currentLocale:e,defaultLocale:t,localeConfigs:n}}=(0,h.A)(),r=(0,w.o)(),o=n[e].htmlLang,a=e=>e.replace("-","_");return(0,f.jsxs)(m.A,{children:[Object.entries(n).map((e=>{let[t,{htmlLang:n}]=e;return(0,f.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:n},t)})),(0,f.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:"x-default"}),(0,f.jsx)("meta",{property:"og:locale",content:a(o)}),Object.values(n).filter((e=>o!==e.htmlLang)).map((e=>(0,f.jsx)("meta",{property:"og:locale:alternate",content:a(e.htmlLang)},`meta-og-${e.htmlLang}`)))]})}function E(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,h.A)(),r=function(){const{siteConfig:{url:e,baseUrl:t,trailingSlash:n}}=(0,h.A)(),{pathname:r}=(0,d.zy)();return e+(0,k.Ks)((0,b.Ay)(r),{trailingSlash:n,baseUrl:t})}(),o=t?`${n}${t}`:r;return(0,f.jsxs)(m.A,{children:[(0,f.jsx)("meta",{property:"og:url",content:o}),(0,f.jsx)("link",{rel:"canonical",href:o})]})}function O(){const{i18n:{currentLocale:e}}=(0,h.A)(),{metadata:t,image:n}=(0,v.p)();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(m.A,{children:[(0,f.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,f.jsx)("body",{className:x.w})]}),n&&(0,f.jsx)(y.be,{image:n}),(0,f.jsx)(E,{}),(0,f.jsx)(_,{}),(0,f.jsx)(S.A,{tag:j.C,locale:e}),(0,f.jsx)(m.A,{children:t.map(((e,t)=>(0,f.jsx)("meta",{...e},t)))})]})}const C=new Map;var A=n(6125),P=n(6988),T=n(205);function I(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const o=c.map((t=>{const r=t.default?.[e]??t[e];return r?.(...n)}));return()=>o.forEach((e=>e?.()))}const R=function(e){let{children:t,location:n,previousLocation:r}=e;return(0,T.A)((()=>{r!==n&&(!function(e){let{location:t,previousLocation:n}=e;if(!n)return;const r=t.pathname===n.pathname,o=t.hash===n.hash,a=t.search===n.search;if(r&&o&&!a)return;const{hash:s}=t;if(s){const e=decodeURIComponent(s.substring(1)),t=document.getElementById(e);t?.scrollIntoView()}else window.scrollTo(0,0)}({location:n,previousLocation:r}),I("onRouteDidUpdate",{previousLocation:r,location:n}))}),[r,n]),t};function N(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,p.u)(u.A,e))).flat();return Promise.all(t.map((e=>e.route.component.preload?.())))}class L extends r.Component{previousLocation;routeUpdateCleanupCb;constructor(e){super(e),this.previousLocation=null,this.routeUpdateCleanupCb=l.A.canUseDOM?I("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const n=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=I("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),N(n.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:t}=this.props;return(0,f.jsx)(R,{previousLocation:this.previousLocation,location:t,children:(0,f.jsx)(d.qh,{location:t,render:()=>e})})}}const D=L,M="__docusaurus-base-url-issue-banner-container",F="__docusaurus-base-url-issue-banner",B="__docusaurus-base-url-issue-banner-suggestion-container";function z(e){return`\ndocument.addEventListener('DOMContentLoaded', function maybeInsertBanner() {\n var shouldInsert = typeof window['docusaurus'] === 'undefined';\n shouldInsert && insertBanner();\n});\n\nfunction insertBanner() {\n var bannerContainer = document.createElement('div');\n bannerContainer.id = '${M}';\n var bannerHtml = ${JSON.stringify(function(e){return`\n<div id="${F}" 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;">${e}</span> ${"/"===e?" (default value)":""}</p>\n <p>We suggest trying baseUrl = <span id="${B}" style="font-weight: bold; color: green;"></span></p>\n</div>\n`}(e)).replace(/</g,"\\<")};\n bannerContainer.innerHTML = bannerHtml;\n document.body.prepend(bannerContainer);\n var suggestionContainer = document.getElementById('${B}');\n var actualHomePagePath = window.location.pathname;\n var suggestedBaseUrl = actualHomePagePath.substr(-1) === '/'\n ? actualHomePagePath\n : actualHomePagePath + '/';\n suggestionContainer.innerHTML = suggestedBaseUrl;\n}\n`}function U(){const{siteConfig:{baseUrl:e}}=(0,h.A)();return(0,f.jsx)(f.Fragment,{children:!l.A.canUseDOM&&(0,f.jsx)(m.A,{children:(0,f.jsx)("script",{children:z(e)})})})}function q(){const{siteConfig:{baseUrl:e,baseUrlIssueBanner:t}}=(0,h.A)(),{pathname:n}=(0,d.zy)();return t&&n===e?(0,f.jsx)(U,{}):null}function $(){const{siteConfig:{favicon:e,title:t,noIndex:n},i18n:{currentLocale:r,localeConfigs:o}}=(0,h.A)(),a=(0,b.Ay)(e),{htmlLang:s,direction:i}=o[r];return(0,f.jsxs)(m.A,{children:[(0,f.jsx)("html",{lang:s,dir:i}),(0,f.jsx)("title",{children:t}),(0,f.jsx)("meta",{property:"og:title",content:t}),(0,f.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),n&&(0,f.jsx)("meta",{name:"robots",content:"noindex, nofollow"}),e&&(0,f.jsx)("link",{rel:"icon",href:a})]})}var H=n(7489),V=n(2303);function G(){const e=(0,V.A)();return(0,f.jsx)(m.A,{children:(0,f.jsx)("html",{"data-has-hydrated":e})})}const W=(0,p.v)(u.A);function K(){const e=function(e){if(C.has(e.pathname))return{...e,pathname:C.get(e.pathname)};if((0,p.u)(u.A,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return C.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return C.set(e.pathname,t),{...e,pathname:t}}((0,d.zy)());return(0,f.jsx)(D,{location:e,children:W})}function Q(){return(0,f.jsx)(H.A,{children:(0,f.jsx)(P.l,{children:(0,f.jsxs)(A.x,{children:[(0,f.jsxs)(g,{children:[(0,f.jsx)($,{}),(0,f.jsx)(O,{}),(0,f.jsx)(q,{}),(0,f.jsx)(K,{})]}),(0,f.jsx)(G,{})]})})})}var Y=n(4054);const Z=function(e){try{return document.createElement("link").relList.supports(e)}catch{return!1}}("prefetch")?function(e){return new Promise(((t,n)=>{if("undefined"==typeof document)return void n();const r=document.createElement("link");r.setAttribute("rel","prefetch"),r.setAttribute("href",e),r.onload=()=>t(),r.onerror=()=>n();const o=document.getElementsByTagName("head")[0]??document.getElementsByName("script")[0]?.parentNode;o?.appendChild(r)}))}:function(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),r.withCredentials=!0,r.onload=()=>{200===r.status?t():n()},r.send(null)}))};var J=n(6921);const X=new Set,ee=new Set,te=()=>navigator.connection?.effectiveType.includes("2g")||navigator.connection?.saveData,ne={prefetch:e=>{if(!(e=>!te()&&!ee.has(e)&&!X.has(e))(e))return!1;X.add(e);const t=(0,p.u)(u.A,e).flatMap((e=>{return t=e.route.path,Object.entries(Y).filter((e=>{let[n]=e;return n.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,J.A)(t))}));var t}));return Promise.all(t.map((e=>{const t=n.gca(e);return t&&!t.includes("undefined")?Z(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!te()&&!ee.has(e))(e)&&(ee.add(e),N(e))},re=Object.freeze(ne);function oe(e){let{children:t}=e;return"hash"===i.default.future.experimental_router?(0,f.jsx)(s.I9,{children:t}):(0,f.jsx)(s.Kd,{children:t})}const ae=Boolean(!0);if(l.A.canUseDOM){window.docusaurus=re;const e=document.getElementById("__docusaurus"),t=(0,f.jsx)(a.vd,{children:(0,f.jsx)(oe,{children:(0,f.jsx)(Q,{})})}),n=(e,t)=>{console.error("Docusaurus React Root onRecoverableError:",e,t)},s=()=>{if(window.docusaurusRoot)window.docusaurusRoot.render(t);else if(ae)window.docusaurusRoot=o.hydrateRoot(e,t,{onRecoverableError:n});else{const r=o.createRoot(e,{onRecoverableError:n});r.render(t),window.docusaurusRoot=r}};N(window.location.pathname).then((()=>{(0,r.startTransition)(s)}))}},6988:(e,t,n)=>{"use strict";n.d(t,{o:()=>d,l:()=>p});var r=n(6540),o=n(4784);const a=JSON.parse('{"docusaurus-plugin-content-docs":{"default":{"path":"/jest-preset-angular/docs","versions":[{"name":"current","label":"Next","isLast":false,"path":"/jest-preset-angular/docs/next","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/next/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/next/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/next/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/next/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/next/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/next/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/next/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/next/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/next/guides/jsdom-version","sidebar":"docs"},{"id":"guides/snapshot-testing","path":"/jest-preset-angular/docs/next/guides/snapshot-testing","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/next/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/next/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/next/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/next/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/next/","label":"introduction"}}}},{"name":"14.4","label":"14.4","isLast":true,"path":"/jest-preset-angular/docs","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/guides/jsdom-version","sidebar":"docs"},{"id":"guides/snapshot-testing","path":"/jest-preset-angular/docs/guides/snapshot-testing","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/","label":"introduction"}}}},{"name":"14.3","label":"14.3","isLast":false,"path":"/jest-preset-angular/docs/14.3","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/14.3/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/14.3/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/14.3/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/14.3/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/14.3/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/14.3/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/14.3/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/14.3/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/14.3/guides/jsdom-version","sidebar":"docs"},{"id":"guides/snapshot-testing","path":"/jest-preset-angular/docs/14.3/guides/snapshot-testing","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/14.3/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/14.3/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/14.3/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/14.3/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/14.3/","label":"introduction"}}}},{"name":"14.2","label":"14.2","isLast":false,"path":"/jest-preset-angular/docs/14.2","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/14.2/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/14.2/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/14.2/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/14.2/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/14.2/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/14.2/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/14.2/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/14.2/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/14.2/guides/jsdom-version","sidebar":"docs"},{"id":"guides/snapshot-testing","path":"/jest-preset-angular/docs/14.2/guides/snapshot-testing","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/14.2/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/14.2/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/14.2/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/14.2/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/14.2/","label":"introduction"}}}},{"name":"14.0","label":"14.0","isLast":false,"path":"/jest-preset-angular/docs/14.0","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/14.0/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/14.0/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/14.0/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/14.0/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/14.0/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/14.0/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/14.0/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/14.0/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/14.0/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/14.0/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/14.0/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/14.0/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/14.0/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/14.0/","label":"introduction"}}}},{"name":"13.0","label":"13.0","isLast":false,"path":"/jest-preset-angular/docs/13.0","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/13.0/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/13.0/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/13.0/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/13.0/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/13.0/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/13.0/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/13.0/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/13.0/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/13.0/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/13.0/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/13.0/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/13.0/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/13.0/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/13.0/","label":"introduction"}}}},{"name":"12.0","label":"12.0","isLast":false,"path":"/jest-preset-angular/docs/12.0","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/12.0/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/12.0/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/12.0/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/12.0/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/12.0/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/12.0/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/12.0/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/12.0/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/12.0/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/12.0/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/12.0/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/12.0/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/12.0/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/12.0/","label":"introduction"}}}},{"name":"11.1","label":"11.1","isLast":false,"path":"/jest-preset-angular/docs/11.1","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/11.1/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/11.1/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/11.1/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/11.1/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/11.1/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/11.1/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/11.1/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/11.1/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/11.1/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/11.1/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/11.1/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/11.1/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/11.1/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/11.1/","label":"introduction"}}}},{"name":"11.0","label":"11.0","isLast":false,"path":"/jest-preset-angular/docs/11.0","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/11.0/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/11.0/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/11.0/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/11.0/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/11.0/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-13+","path":"/jest-preset-angular/docs/11.0/guides/angular-13+","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/11.0/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/11.0/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/11.0/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/11.0/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/11.0/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/11.0/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/11.0/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/11.0/","label":"introduction"}}}},{"name":"10.x","label":"10.x","isLast":false,"path":"/jest-preset-angular/docs/10.x","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/10.x/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/10.x/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/10.x/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/10.x/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/10.x/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/10.x/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/10.x/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/10.x/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/10.x/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/10.x/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/10.x/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/10.x/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/10.x/","label":"introduction"}}}},{"name":"9.x","label":"9.x","isLast":false,"path":"/jest-preset-angular/docs/9.x","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/9.x/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/9.x/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/9.x/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/9.x/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/9.x/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/9.x/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/9.x/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/9.x/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/9.x/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/9.x/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/9.x/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/9.x/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/9.x/","label":"introduction"}}}},{"name":"8.x","label":"8.x","isLast":false,"path":"/jest-preset-angular/docs/8.x","mainDocId":"introduction","docs":[{"id":"getting-started/installation","path":"/jest-preset-angular/docs/8.x/getting-started/installation","sidebar":"docs"},{"id":"getting-started/options","path":"/jest-preset-angular/docs/8.x/getting-started/options","sidebar":"docs"},{"id":"getting-started/presets","path":"/jest-preset-angular/docs/8.x/getting-started/presets","sidebar":"docs"},{"id":"getting-started/test-environment","path":"/jest-preset-angular/docs/8.x/getting-started/test-environment","sidebar":"docs"},{"id":"guides/absolute-imports","path":"/jest-preset-angular/docs/8.x/guides/absolute-imports","sidebar":"docs"},{"id":"guides/angular-ivy","path":"/jest-preset-angular/docs/8.x/guides/angular-ivy","sidebar":"docs"},{"id":"guides/esm-support","path":"/jest-preset-angular/docs/8.x/guides/esm-support","sidebar":"docs"},{"id":"guides/jsdom-version","path":"/jest-preset-angular/docs/8.x/guides/jsdom-version","sidebar":"docs"},{"id":"guides/troubleshooting","path":"/jest-preset-angular/docs/8.x/guides/troubleshooting","sidebar":"docs"},{"id":"guides/using-with-babel","path":"/jest-preset-angular/docs/8.x/guides/using-with-babel","sidebar":"docs"},{"id":"introduction","path":"/jest-preset-angular/docs/8.x/","sidebar":"docs"},{"id":"processing","path":"/jest-preset-angular/docs/8.x/processing","sidebar":"docs"}],"draftIds":[],"sidebars":{"docs":{"link":{"path":"/jest-preset-angular/docs/8.x/","label":"introduction"}}}}],"breadcrumbs":true}}}'),s=JSON.parse('{"defaultLocale":"en","locales":["en"],"path":"i18n","currentLocale":"en","localeConfigs":{"en":{"label":"English","direction":"ltr","htmlLang":"en","calendar":"gregory","path":"en"}}}');var i=n(2654);const l=JSON.parse('{"docusaurusVersion":"3.7.0","siteVersion":"0.0.0","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"3.7.0"},"docusaurus-plugin-content-blog":{"type":"package","name":"@docusaurus/plugin-content-blog","version":"3.7.0"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"3.7.0"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"3.7.0"},"docusaurus-plugin-svgr":{"type":"package","name":"@docusaurus/plugin-svgr","version":"3.7.0"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"3.7.0"},"docusaurus-theme-search-algolia":{"type":"package","name":"@docusaurus/theme-search-algolia","version":"3.7.0"},"docusaurus-plugin-ideal-image":{"type":"package","name":"@docusaurus/plugin-ideal-image","version":"3.7.0"},"docusaurus-plugin-pwa":{"type":"package","name":"@docusaurus/plugin-pwa","version":"3.7.0"}}}');var c=n(4848);const u={siteConfig:o.default,siteMetadata:l,globalData:a,i18n:s,codeTranslations:i},d=r.createContext(u);function p(e){let{children:t}=e;return(0,c.jsx)(d.Provider,{value:u,children:t})}},7489:(e,t,n)=>{"use strict";n.d(t,{A:()=>m});var r=n(6540),o=n(8193),a=n(5260),s=n(440),i=n(1957),l=n(3102),c=n(4848);function u(e){let{error:t,tryAgain:n}=e;return(0,c.jsxs)("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",minHeight:"100vh",width:"100%",maxWidth:"80ch",fontSize:"20px",margin:"0 auto",padding:"1rem"},children:[(0,c.jsx)("h1",{style:{fontSize:"3rem"},children:"This page crashed"}),(0,c.jsx)("button",{type:"button",onClick:n,style:{margin:"1rem 0",fontSize:"2rem",cursor:"pointer",borderRadius:20,padding:"1rem"},children:"Try again"}),(0,c.jsx)(d,{error:t})]})}function d(e){let{error:t}=e;const n=(0,s.rA)(t).map((e=>e.message)).join("\n\nCause:\n");return(0,c.jsx)("p",{style:{whiteSpace:"pre-wrap"},children:n})}function p(e){let{children:t}=e;return(0,c.jsx)(l.W,{value:{plugin:{name:"docusaurus-core-error-boundary",id:"default"}},children:t})}function f(e){let{error:t,tryAgain:n}=e;return(0,c.jsx)(p,{children:(0,c.jsxs)(m,{fallback:()=>(0,c.jsx)(u,{error:t,tryAgain:n}),children:[(0,c.jsx)(a.A,{children:(0,c.jsx)("title",{children:"Page Error"})}),(0,c.jsx)(i.A,{children:(0,c.jsx)(u,{error:t,tryAgain:n})})]})})}const g=e=>(0,c.jsx)(f,{...e});class m extends r.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){o.A.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:t}=this.state;if(t){const e={error:t,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??g)(e)}return e??null}}},8193:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const r="undefined"!=typeof window&&"document"in window&&"createElement"in window.document,o={canUseDOM:r,canUseEventListeners:r&&("addEventListener"in window||"attachEvent"in window),canUseIntersectionObserver:r&&"IntersectionObserver"in window,canUseViewport:r&&"screen"in window}},5260:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});n(6540);var r=n(545),o=n(4848);function a(e){return(0,o.jsx)(r.mg,{...e})}},8774:(e,t,n)=>{"use strict";n.d(t,{A:()=>f});var r=n(6540),o=n(4625),a=n(440),s=n(4586),i=n(6654),l=n(8193),c=n(3427),u=n(6025),d=n(4848);function p(e,t){let{isNavLink:n,to:p,href:f,activeClassName:g,isActive:m,"data-noBrokenLinkCheck":h,autoAddBaseUrl:b=!0,...v}=e;const{siteConfig:y}=(0,s.A)(),{trailingSlash:w,baseUrl:x}=y,j=y.future.experimental_router,{withBaseUrl:k}=(0,u.hH)(),S=(0,c.A)(),_=(0,r.useRef)(null);(0,r.useImperativeHandle)(t,(()=>_.current));const E=p||f;const O=(0,i.A)(E),C=E?.replace("pathname://","");let A=void 0!==C?(P=C,b&&(e=>e.startsWith("/"))(P)?k(P):P):void 0;var P;"hash"===j&&A?.startsWith("./")&&(A=A?.slice(1)),A&&O&&(A=(0,a.Ks)(A,{trailingSlash:w,baseUrl:x}));const T=(0,r.useRef)(!1),I=n?o.k2:o.N_,R=l.A.canUseIntersectionObserver,N=(0,r.useRef)(),L=()=>{T.current||null==A||(window.docusaurus.preload(A),T.current=!0)};(0,r.useEffect)((()=>(!R&&O&&l.A.canUseDOM&&null!=A&&window.docusaurus.prefetch(A),()=>{R&&N.current&&N.current.disconnect()})),[N,A,R,O]);const D=A?.startsWith("#")??!1,M=!v.target||"_self"===v.target,F=!A||!O||!M||D&&"hash"!==j;h||!D&&F||S.collectLink(A),v.id&&S.collectAnchor(v.id);const B={};return F?(0,d.jsx)("a",{ref:_,href:A,...E&&!O&&{target:"_blank",rel:"noopener noreferrer"},...v,...B}):(0,d.jsx)(I,{...v,onMouseEnter:L,onTouchStart:L,innerRef:e=>{_.current=e,R&&e&&O&&(N.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(N.current.unobserve(e),N.current.disconnect(),null!=A&&window.docusaurus.prefetch(A))}))})),N.current.observe(e))},to:A,...n&&{isActive:m,activeClassName:g},...B})}const f=r.forwardRef(p)},1312:(e,t,n)=>{"use strict";n.d(t,{A:()=>c,T:()=>l});var r=n(6540),o=n(4848);function a(e,t){const n=e.split(/(\{\w+\})/).map(((e,n)=>{if(n%2==1){const n=t?.[e.slice(1,-1)];if(void 0!==n)return n}return e}));return n.some((e=>(0,r.isValidElement)(e)))?n.map(((e,t)=>(0,r.isValidElement)(e)?r.cloneElement(e,{key:t}):e)).filter((e=>""!==e)):n.join("")}var s=n(2654);function i(e){let{id:t,message:n}=e;if(void 0===t&&void 0===n)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return s[t??n]??n??t}function l(e,t){let{message:n,id:r}=e;return a(i({message:n,id:r}),t)}function c(e){let{children:t,id:n,values:r}=e;if(t&&"string"!=typeof t)throw console.warn("Illegal <Translate> children",t),new Error("The Docusaurus <Translate> component only accept simple string values");const s=i({message:t,id:n});return(0,o.jsx)(o.Fragment,{children:a(s,r)})}},7065:(e,t,n)=>{"use strict";n.d(t,{W:()=>r});const r="default"},6654:(e,t,n)=>{"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function o(e){return void 0!==e&&!r(e)}n.d(t,{A:()=>o,z:()=>r})},6025:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>i,hH:()=>s});var r=n(6540),o=n(4586),a=n(6654);function s(){const{siteConfig:e}=(0,o.A)(),{baseUrl:t,url:n}=e,s=e.future.experimental_router,i=(0,r.useCallback)(((e,r)=>function(e){let{siteUrl:t,baseUrl:n,url:r,options:{forcePrependBaseUrl:o=!1,absolute:s=!1}={},router:i}=e;if(!r||r.startsWith("#")||(0,a.z)(r))return r;if("hash"===i)return r.startsWith("/")?`.${r}`:`./${r}`;if(o)return n+r.replace(/^\//,"");if(r===n.replace(/\/$/,""))return n;const l=r.startsWith(n)?r:n+r.replace(/^\//,"");return s?t+l:l}({siteUrl:n,baseUrl:t,url:e,options:r,router:s})),[n,t,s]);return{withBaseUrl:i}}function i(e,t){void 0===t&&(t={});const{withBaseUrl:n}=s();return n(e,t)}},3427:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(6540);n(4848);const o=r.createContext({collectAnchor:()=>{},collectLink:()=>{}}),a=()=>(0,r.useContext)(o);function s(){return a()}},4586:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(6540),o=n(6988);function a(){return(0,r.useContext)(o.o)}},2303:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(6540),o=n(6125);function a(){return(0,r.useContext)(o.o)}},205:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540);const o=n(8193).A.canUseDOM?r.useLayoutEffect:r.useEffect},6921:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const r=e=>"object"==typeof e&&!!e&&Object.keys(e).length>0;function o(e){const t={};return function e(n,o){Object.entries(n).forEach((n=>{let[a,s]=n;const i=o?`${o}.${a}`:a;r(s)?e(s,i):t[i]=s}))}(e),t}},3102:(e,t,n)=>{"use strict";n.d(t,{W:()=>s,o:()=>a});var r=n(6540),o=n(4848);const a=r.createContext(null);function s(e){let{children:t,value:n}=e;const s=r.useContext(a),i=(0,r.useMemo)((()=>function(e){let{parent:t,value:n}=e;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}const r={...t.data,...n?.data};return{plugin:t.plugin,data:r}}({parent:s,value:n})),[s,n]);return(0,o.jsx)(a.Provider,{value:i,children:t})}},3886:(e,t,n)=>{"use strict";n.d(t,{VQ:()=>h,XK:()=>y,g1:()=>v});var r=n(6540),o=n(4070),a=n(7065),s=n(6342),i=n(679),l=n(9532),c=n(4848);const u=e=>`docs-preferred-version-${e}`,d={save:(e,t,n)=>{(0,i.Wf)(u(e),{persistence:t}).set(n)},read:(e,t)=>(0,i.Wf)(u(e),{persistence:t}).get(),clear:(e,t)=>{(0,i.Wf)(u(e),{persistence:t}).del()}},p=e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}])));const f=r.createContext(null);function g(){const e=(0,o.Gy)(),t=(0,s.p)().docs.versionPersistence,n=(0,r.useMemo)((()=>Object.keys(e)),[e]),[a,i]=(0,r.useState)((()=>p(n)));(0,r.useEffect)((()=>{i(function(e){let{pluginIds:t,versionPersistence:n,allDocsData:r}=e;function o(e){const t=d.read(e,n);return r[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(d.clear(e,n),{preferredVersionName:null})}return Object.fromEntries(t.map((e=>[e,o(e)])))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]);return[a,(0,r.useMemo)((()=>({savePreferredVersion:function(e,n){d.save(e,t,n),i((t=>({...t,[e]:{preferredVersionName:n}})))}})),[t])]}function m(e){let{children:t}=e;const n=g();return(0,c.jsx)(f.Provider,{value:n,children:t})}function h(e){let{children:t}=e;return(0,c.jsx)(m,{children:t})}function b(){const e=(0,r.useContext)(f);if(!e)throw new l.dV("DocsPreferredVersionContextProvider");return e}function v(e){void 0===e&&(e=a.W);const t=(0,o.ht)(e),[n,s]=b(),{preferredVersionName:i}=n[e];return{preferredVersion:t.versions.find((e=>e.name===i))??null,savePreferredVersionName:(0,r.useCallback)((t=>{s.savePreferredVersion(e,t)}),[s,e])}}function y(){const e=(0,o.Gy)(),[t]=b();function n(n){const r=e[n],{preferredVersionName:o}=t[n];return r.versions.find((e=>e.name===o))??null}const r=Object.keys(e);return Object.fromEntries(r.map((e=>[e,n(e)])))}},2565:(e,t,n)=>{"use strict";n.d(t,{k:()=>a,v:()=>s});var r=n(4070),o=n(3886);function a(e,t){return`docs-${e}-${t}`}function s(){const e=(0,r.Gy)(),t=(0,r.gk)(),n=(0,o.XK)();return[...Object.keys(e).map((function(r){const o=t?.activePlugin.pluginId===r?t.activeVersion:void 0,s=n[r],i=e[r].versions.find((e=>e.isLast));return a(r,(o??s??i).name)}))]}},609:(e,t,n)=>{"use strict";n.d(t,{V:()=>l,t:()=>c});var r=n(6540),o=n(9532),a=n(4848);const s=Symbol("EmptyContext"),i=r.createContext(s);function l(e){let{children:t,name:n,items:o}=e;const s=(0,r.useMemo)((()=>n&&o?{name:n,items:o}:null),[n,o]);return(0,a.jsx)(i.Provider,{value:s,children:t})}function c(){const e=(0,r.useContext)(i);if(e===s)throw new o.dV("DocsSidebarProvider");return e}},6972:(e,t,n)=>{"use strict";n.d(t,{B5:()=>k,Nr:()=>p,OF:()=>y,QB:()=>j,Vd:()=>w,Y:()=>b,fW:()=>x,w8:()=>m});var r=n(6540),o=n(6347),a=n(2831),s=n(4070),i=n(9169),l=n(1682),c=n(3886),u=n(3025),d=n(609);function p(e){return"link"!==e.type||e.unlisted?"category"===e.type?function(e){if(e.href&&!e.linkUnlisted)return e.href;for(const t of e.items){const e=p(t);if(e)return e}}(e):void 0:e.href}const f=(e,t)=>void 0!==e&&(0,i.ys)(e,t),g=(e,t)=>e.some((e=>m(e,t)));function m(e,t){return"link"===e.type?f(e.href,t):"category"===e.type&&(f(e.href,t)||g(e.items,t))}function h(e,t){switch(e.type){case"category":return m(e,t)||void 0!==e.href&&!e.linkUnlisted||e.items.some((e=>h(e,t)));case"link":return!e.unlisted||m(e,t);default:return!0}}function b(e,t){return(0,r.useMemo)((()=>e.filter((e=>h(e,t)))),[e,t])}function v(e){let{sidebarItems:t,pathname:n,onlyCategories:r=!1}=e;const o=[];return function e(t){for(const a of t)if("category"===a.type&&((0,i.ys)(a.href,n)||e(a.items))||"link"===a.type&&(0,i.ys)(a.href,n)){return r&&"category"!==a.type||o.unshift(a),!0}return!1}(t),o}function y(){const e=(0,d.t)(),{pathname:t}=(0,o.zy)(),n=(0,s.vT)()?.pluginData.breadcrumbs;return!1!==n&&e?v({sidebarItems:e.items,pathname:t}):null}function w(e){const{activeVersion:t}=(0,s.zK)(e),{preferredVersion:n}=(0,c.g1)(e),o=(0,s.r7)(e);return(0,r.useMemo)((()=>(0,l.sb)([t,n,o].filter(Boolean))),[t,n,o])}function x(e,t){const n=w(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),r=t.find((t=>t[0]===e));if(!r)throw new Error(`Can't find any sidebar with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\nAvailable sidebar ids are:\n- ${t.map((e=>e[0])).join("\n- ")}`);return r[1]}),[e,n])}function j(e,t){const n=w(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.docs)),r=t.find((t=>t.id===e));if(!r){if(n.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`Couldn't find any doc with id "${e}" in version${n.length>1?"s":""} "${n.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${(0,l.sb)(t.map((e=>e.id))).join("\n- ")}`)}return r}),[e,n])}function k(e){let{route:t}=e;const n=(0,o.zy)(),r=(0,u.r)(),s=t.routes,i=s.find((e=>(0,o.B6)(n.pathname,e)));if(!i)return null;const l=i.sidebar,c=l?r.docsSidebars[l]:void 0;return{docElement:(0,a.v)(s),sidebarName:l,sidebarItems:c}}},3025:(e,t,n)=>{"use strict";n.d(t,{n:()=>i,r:()=>l});var r=n(6540),o=n(9532),a=n(4848);const s=r.createContext(null);function i(e){let{children:t,version:n}=e;return(0,a.jsx)(s.Provider,{value:n,children:t})}function l(){const e=(0,r.useContext)(s);if(null===e)throw new o.dV("DocsVersionProvider");return e}},4070:(e,t,n)=>{"use strict";n.d(t,{zK:()=>b,vT:()=>f,gk:()=>g,Gy:()=>d,HW:()=>v,ht:()=>p,r7:()=>h,jh:()=>m});var r=n(6347),o=n(4586),a=n(7065);function s(e,t){void 0===t&&(t={});const n=function(){const{globalData:e}=(0,o.A)();return e}()[e];if(!n&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return n}const i=e=>e.versions.find((e=>e.isLast));function l(e,t){return[...e.versions].sort(((e,t)=>e.path===t.path?0:e.path.includes(t.path)?-1:t.path.includes(e.path)?1:0)).find((e=>!!(0,r.B6)(t,{path:e.path,exact:!1,strict:!1})))}function c(e,t){const n=l(e,t),o=n?.docs.find((e=>!!(0,r.B6)(t,{path:e.path,exact:!0,strict:!1})));return{activeVersion:n,activeDoc:o,alternateDocVersions:o?function(t){const n={};return e.versions.forEach((e=>{e.docs.forEach((r=>{r.id===t&&(n[e.name]=r)}))})),n}(o.id):{}}}const u={},d=()=>s("docusaurus-plugin-content-docs")??u,p=e=>{try{return function(e,t,n){void 0===t&&(t=a.W),void 0===n&&(n={});const r=s(e),o=r?.[t];if(!o&&n.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${t}".`);return o}("docusaurus-plugin-content-docs",e,{failfast:!0})}catch(t){throw new Error("You are using a feature of the Docusaurus docs plugin, but this plugin does not seem to be enabled"+("Default"===e?"":` (pluginId=${e}`),{cause:t})}};function f(e){void 0===e&&(e={});const t=d(),{pathname:n}=(0,r.zy)();return function(e,t,n){void 0===n&&(n={});const o=Object.entries(e).sort(((e,t)=>t[1].path.localeCompare(e[1].path))).find((e=>{let[,n]=e;return!!(0,r.B6)(t,{path:n.path,exact:!1,strict:!1})})),a=o?{pluginId:o[0],pluginData:o[1]}:void 0;if(!a&&n.failfast)throw new Error(`Can't find active docs plugin for "${t}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return a}(t,n,e)}function g(e){void 0===e&&(e={});const t=f(e),{pathname:n}=(0,r.zy)();if(!t)return;return{activePlugin:t,activeVersion:l(t.pluginData,n)}}function m(e){return p(e).versions}function h(e){const t=p(e);return i(t)}function b(e){const t=p(e),{pathname:n}=(0,r.zy)();return c(t,n)}function v(e){const t=p(e),{pathname:n}=(0,r.zy)();return function(e,t){const n=i(e);return{latestDocSuggestion:c(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(t,n)}},4096:(e,t,n)=>{"use strict";n.r(t);var r=n(8193),o=n(679);const a="/jest-preset-angular/sw.js",s=["appInstalled","queryString"],i=!1,l=(0,o.Wf)("docusaurus.pwa.event.appInstalled.fired");function c(e,t){i&&(void 0===t?console.log(`[Docusaurus-PWA][registerSw]: ${e}`):console.log(`[Docusaurus-PWA][registerSw]: ${e}`,t))}async function u(){const e=await navigator.serviceWorker.getRegistrations();c("will unregister all service workers",{registrations:e}),await Promise.all(e.map((e=>e.unregister().then((t=>c("unregister service worker",{registration:e,result:t})))))),c("unregistered all service workers",{registrations:e}),window.location.reload()}const d={always:()=>!0,mobile:()=>window.innerWidth<=996,saveData:()=>!!navigator.connection?.saveData,appInstalled:()=>"true"===l.get()||async function(){if(!("getInstalledRelatedApps"in window.navigator))return!1;try{return(await navigator.getInstalledRelatedApps()).some((e=>"webapp"===e.platform))}catch(e){return!1}}(),standalone:()=>window.matchMedia("(display-mode: standalone)").matches,queryString:()=>"true"===new URLSearchParams(window.location.search).get("offlineMode")};async function p(){const e=await async function(){return(await Promise.all(s.map((e=>Promise.resolve(d[e]()).then((t=>t?e:void 0)))))).filter(Boolean)}(),t=e.length>0;return c(t?"offline mode enabled, because of activation strategies":"offline mode disabled, because none of the offlineModeActivationStrategies could be used",{activeStrategies:e,availableStrategies:s}),t}r.A.canUseDOM&&(c("debug mode enabled"),"serviceWorker"in navigator&&(c("addLegacyAppInstalledEventsListeners"),window.addEventListener("appinstalled",(e=>{c("event appinstalled",{event:e}),l.set("true"),c("AppInstalledEventFiredStorage.set('true')"),u()})),window.addEventListener("beforeinstallprompt",(e=>{c("event beforeinstallprompt",{event:e});const t=l.get();c("AppInstalledEventFiredStorage.get()",{appInstalledEventFired:t}),t&&(l.del(),c("AppInstalledEventFiredStorage.del()"),u())})),c("legacy appinstalled and beforeinstallprompt event listeners installed"),async function(){const[{Workbox:e},t]=await Promise.all([n.e(9730).then(n.bind(n,9730)),p()]),r=new e(function(e){const t=JSON.stringify(e),n=`${a}?params=${encodeURIComponent(t)}`;return c("service worker url",{url:n,params:e}),n}({offlineMode:t,debug:i})),o=()=>r.messageSW({type:"SKIP_WAITING"}),s=()=>(c("handleServiceWorkerWaiting"),t?n.e(4334).then(n.bind(n,4334)).then((e=>{let{renderReloadPopup:t}=e;return t({onReload(){r.addEventListener("controlling",(()=>{window.location.reload()})),o()}})})):o());r.addEventListener("waiting",(e=>{c("event waiting",{event:e}),s()})),r.addEventListener("externalwaiting",(e=>{c("event externalwaiting",{event:e}),s()}));const l=await r.register();l&&(l.active&&c("registration.active",{registration:l}),l.installing&&c("registration.installing",{registration:l}),l.waiting&&(c("registration.waiting",{registration:l}),await s()))}().catch((e=>console.error("registerSW failed",e)))))},6294:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a});var r=n(5947),o=n.n(r);o().configure({showSpinner:!1});const a={onRouteUpdate(e){let{location:t,previousLocation:n}=e;if(n&&t.pathname!==n.pathname){const e=window.setTimeout((()=>{o().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){o().done()}}},6134:(e,t,n)=>{"use strict";var r=n(1765),o=n(4784);!function(e){const{themeConfig:{prism:t}}=o.default,{additionalLanguages:r}=t,a=globalThis.Prism;globalThis.Prism=e,r.forEach((e=>{"php"===e&&n(9700),n(8692)(`./prism-${e}`)})),delete globalThis.Prism,void 0!==a&&(globalThis.Prism=e)}(r.My)},1107:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});n(6540);var r=n(4164),o=n(1312),a=n(6342),s=n(8774),i=n(3427);const l={anchorWithStickyNavbar:"anchorWithStickyNavbar_LWe7",anchorWithHideOnScrollNavbar:"anchorWithHideOnScrollNavbar_WYt5"};var c=n(4848);function u(e){let{as:t,id:n,...u}=e;const d=(0,i.A)(),{navbar:{hideOnScroll:p}}=(0,a.p)();if("h1"===t||!n)return(0,c.jsx)(t,{...u,id:void 0});d.collectAnchor(n);const f=(0,o.T)({id:"theme.common.headingLinkTitle",message:"Direct link to {heading}",description:"Title for link to heading"},{heading:"string"==typeof u.children?u.children:n});return(0,c.jsxs)(t,{...u,className:(0,r.A)("anchor",p?l.anchorWithHideOnScrollNavbar:l.anchorWithStickyNavbar,u.className),id:n,children:[u.children,(0,c.jsx)(s.A,{className:"hash-link",to:`#${n}`,"aria-label":f,title:f,children:"\u200b"})]})}},3186:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});n(6540);const r={iconExternalLink:"iconExternalLink_nPIU"};var o=n(4848);function a(e){let{width:t=13.5,height:n=13.5}=e;return(0,o.jsx)("svg",{width:t,height:n,"aria-hidden":"true",viewBox:"0 0 24 24",className:r.iconExternalLink,children:(0,o.jsx)("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"})})}},1957:(e,t,n)=>{"use strict";n.d(t,{A:()=>Ot});var r=n(6540),o=n(4164),a=n(7489),s=n(9024),i=n(6347),l=n(1312),c=n(5062),u=n(4848);const d="__docusaurus_skipToContent_fallback";function p(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function f(){const e=(0,r.useRef)(null),{action:t}=(0,i.W6)(),n=(0,r.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.getElementById(d);t&&p(t)}),[]);return(0,c.$)((n=>{let{location:r}=n;e.current&&!r.hash&&"PUSH"===t&&p(e.current)})),{containerRef:e,onClick:n}}const g=(0,l.T)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function m(e){const t=e.children??g,{containerRef:n,onClick:r}=f();return(0,u.jsx)("div",{ref:n,role:"region","aria-label":g,children:(0,u.jsx)("a",{...e,href:`#${d}`,onClick:r,children:t})})}var h=n(7559),b=n(4090);const v={skipToContent:"skipToContent_fXgn"};function y(){return(0,u.jsx)(m,{className:v.skipToContent})}var w=n(6342),x=n(5041);function j(e){let{width:t=21,height:n=21,color:r="currentColor",strokeWidth:o=1.2,className:a,...s}=e;return(0,u.jsx)("svg",{viewBox:"0 0 15 15",width:t,height:n,...s,children:(0,u.jsx)("g",{stroke:r,strokeWidth:o,children:(0,u.jsx)("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})})})}const k={closeButton:"closeButton_CVFx"};function S(e){return(0,u.jsx)("button",{type:"button","aria-label":(0,l.T)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"}),...e,className:(0,o.A)("clean-btn close",k.closeButton,e.className),children:(0,u.jsx)(j,{width:14,height:14,strokeWidth:3.1})})}const _={content:"content_knG7"};function E(e){const{announcementBar:t}=(0,w.p)(),{content:n}=t;return(0,u.jsx)("div",{...e,className:(0,o.A)(_.content,e.className),dangerouslySetInnerHTML:{__html:n}})}const O={announcementBar:"announcementBar_mb4j",announcementBarPlaceholder:"announcementBarPlaceholder_vyr4",announcementBarClose:"announcementBarClose_gvF7",announcementBarContent:"announcementBarContent_xLdY"};function C(){const{announcementBar:e}=(0,w.p)(),{isActive:t,close:n}=(0,x.M)();if(!t)return null;const{backgroundColor:r,textColor:o,isCloseable:a}=e;return(0,u.jsxs)("div",{className:O.announcementBar,style:{backgroundColor:r,color:o},role:"banner",children:[a&&(0,u.jsx)("div",{className:O.announcementBarPlaceholder}),(0,u.jsx)(E,{className:O.announcementBarContent}),a&&(0,u.jsx)(S,{onClick:n,className:O.announcementBarClose})]})}var A=n(2069),P=n(3104);var T=n(9532),I=n(5600);const R=r.createContext(null);function N(e){let{children:t}=e;const n=function(){const e=(0,A.M)(),t=(0,I.YL)(),[n,o]=(0,r.useState)(!1),a=null!==t.component,s=(0,T.ZC)(a);return(0,r.useEffect)((()=>{a&&!s&&o(!0)}),[a,s]),(0,r.useEffect)((()=>{a?e.shown||o(!0):o(!1)}),[e.shown,a]),(0,r.useMemo)((()=>[n,o]),[n])}();return(0,u.jsx)(R.Provider,{value:n,children:t})}function L(e){if(e.component){const t=e.component;return(0,u.jsx)(t,{...e.props})}}function D(){const e=(0,r.useContext)(R);if(!e)throw new T.dV("NavbarSecondaryMenuDisplayProvider");const[t,n]=e,o=(0,r.useCallback)((()=>n(!1)),[n]),a=(0,I.YL)();return(0,r.useMemo)((()=>({shown:t,hide:o,content:L(a)})),[o,a,t])}function M(e){let{header:t,primaryMenu:n,secondaryMenu:r}=e;const{shown:a}=D();return(0,u.jsxs)("div",{className:"navbar-sidebar",children:[t,(0,u.jsxs)("div",{className:(0,o.A)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":a}),children:[(0,u.jsx)("div",{className:"navbar-sidebar__item menu",children:n}),(0,u.jsx)("div",{className:"navbar-sidebar__item menu",children:r})]})]})}var F=n(5293),B=n(2303);function z(e){return(0,u.jsx)("svg",{viewBox:"0 0 24 24",width:24,height:24,...e,children:(0,u.jsx)("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"})})}function U(e){return(0,u.jsx)("svg",{viewBox:"0 0 24 24",width:24,height:24,...e,children:(0,u.jsx)("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"})})}const q={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function $(e){let{className:t,buttonClassName:n,value:r,onChange:a}=e;const s=(0,B.A)(),i=(0,l.T)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===r?(0,l.T)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,l.T)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return(0,u.jsx)("div",{className:(0,o.A)(q.toggle,t),children:(0,u.jsxs)("button",{className:(0,o.A)("clean-btn",q.toggleButton,!s&&q.toggleButtonDisabled,n),type:"button",onClick:()=>a("dark"===r?"light":"dark"),disabled:!s,title:i,"aria-label":i,"aria-live":"polite","aria-pressed":"dark"===r?"true":"false",children:[(0,u.jsx)(z,{className:(0,o.A)(q.toggleIcon,q.lightToggleIcon)}),(0,u.jsx)(U,{className:(0,o.A)(q.toggleIcon,q.darkToggleIcon)})]})})}const H=r.memo($),V={darkNavbarColorModeToggle:"darkNavbarColorModeToggle_X3D1"};function G(e){let{className:t}=e;const n=(0,w.p)().navbar.style,r=(0,w.p)().colorMode.disableSwitch,{colorMode:o,setColorMode:a}=(0,F.G)();return r?null:(0,u.jsx)(H,{className:t,buttonClassName:"dark"===n?V.darkNavbarColorModeToggle:void 0,value:o,onChange:a})}var W=n(3465);function K(){return(0,u.jsx)(W.A,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function Q(){const e=(0,A.M)();return(0,u.jsx)("button",{type:"button","aria-label":(0,l.T)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle(),children:(0,u.jsx)(j,{color:"var(--ifm-color-emphasis-600)"})})}function Y(){return(0,u.jsxs)("div",{className:"navbar-sidebar__brand",children:[(0,u.jsx)(K,{}),(0,u.jsx)(G,{className:"margin-right--md"}),(0,u.jsx)(Q,{})]})}var Z=n(8774),J=n(6025),X=n(6654),ee=n(1252),te=n(3186);function ne(e){let{activeBasePath:t,activeBaseRegex:n,to:r,href:o,label:a,html:s,isDropdownLink:i,prependBaseUrlToHref:l,...c}=e;const d=(0,J.Ay)(r),p=(0,J.Ay)(t),f=(0,J.Ay)(o,{forcePrependBaseUrl:!0}),g=a&&o&&!(0,X.A)(o),m=s?{dangerouslySetInnerHTML:{__html:s}}:{children:(0,u.jsxs)(u.Fragment,{children:[a,g&&(0,u.jsx)(te.A,{...i&&{width:12,height:12}})]})};return o?(0,u.jsx)(Z.A,{href:l?f:o,...c,...m}):(0,u.jsx)(Z.A,{to:d,isNavLink:!0,...(t||n)&&{isActive:(e,t)=>n?(0,ee.G)(n,t.pathname):t.pathname.startsWith(p)},...c,...m})}function re(e){let{className:t,isDropdownItem:n=!1,...r}=e;const a=(0,u.jsx)(ne,{className:(0,o.A)(n?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:n,...r});return n?(0,u.jsx)("li",{children:a}):a}function oe(e){let{className:t,isDropdownItem:n,...r}=e;return(0,u.jsx)("li",{className:"menu__list-item",children:(0,u.jsx)(ne,{className:(0,o.A)("menu__link",t),...r})})}function ae(e){let{mobile:t=!1,position:n,...r}=e;const o=t?oe:re;return(0,u.jsx)(o,{...r,activeClassName:r.activeClassName??(t?"menu__link--active":"navbar__link--active")})}var se=n(1422),ie=n(9169),le=n(4586);const ce={dropdownNavbarItemMobile:"dropdownNavbarItemMobile_S0Fm"};function ue(e,t){return e.some((e=>function(e,t){return!!(0,ie.ys)(e.to,t)||!!(0,ee.G)(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)))}function de(e){let{items:t,position:n,className:a,onClick:s,...i}=e;const l=(0,r.useRef)(null),[c,d]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{l.current&&!l.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("focusin",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("focusin",e)}}),[l]),(0,u.jsxs)("div",{ref:l,className:(0,o.A)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===n,"dropdown--show":c}),children:[(0,u.jsx)(ne,{"aria-haspopup":"true","aria-expanded":c,role:"button",href:i.to?void 0:"#",className:(0,o.A)("navbar__link",a),...i,onClick:i.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(!c))},children:i.children??i.label}),(0,u.jsx)("ul",{className:"dropdown__menu",children:t.map(((e,t)=>(0,r.createElement)(Be,{isDropdownItem:!0,activeClassName:"dropdown__link--active",...e,key:t})))})]})}function pe(e){let{items:t,className:n,position:a,onClick:s,...l}=e;const c=function(){const{siteConfig:{baseUrl:e}}=(0,le.A)(),{pathname:t}=(0,i.zy)();return t.replace(e,"/")}(),d=ue(t,c),{collapsed:p,toggleCollapsed:f,setCollapsed:g}=(0,se.u)({initialState:()=>!d});return(0,r.useEffect)((()=>{d&&g(!d)}),[c,d,g]),(0,u.jsxs)("li",{className:(0,o.A)("menu__list-item",{"menu__list-item--collapsed":p}),children:[(0,u.jsx)(ne,{role:"button",className:(0,o.A)(ce.dropdownNavbarItemMobile,"menu__link menu__link--sublist menu__link--sublist-caret",n),...l,onClick:e=>{e.preventDefault(),f()},children:l.children??l.label}),(0,u.jsx)(se.N,{lazy:!0,as:"ul",className:"menu__list",collapsed:p,children:t.map(((e,t)=>(0,r.createElement)(Be,{mobile:!0,isDropdownItem:!0,onClick:s,activeClassName:"menu__link--active",...e,key:t})))})]})}function fe(e){let{mobile:t=!1,...n}=e;const r=t?pe:de;return(0,u.jsx)(r,{...n})}var ge=n(2131);function me(e){let{width:t=20,height:n=20,...r}=e;return(0,u.jsx)("svg",{viewBox:"0 0 24 24",width:t,height:n,"aria-hidden":!0,...r,children:(0,u.jsx)("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"})})}const he="iconLanguage_nlXk";var be=n(961),ve=n(3219),ye=n(5260),we=n(4255),xe=n(1062),je=n(2967),ke=n(2565);function Se(){return[`language:${(0,le.A)().i18n.currentLocale}`,function(){const e=(0,ke.v)();return[je.C,...e]}().map((e=>`docusaurus_tag:${e}`))]}const _e={button:{buttonText:(0,l.T)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"}),buttonAriaLabel:(0,l.T)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"})},modal:{searchBox:{resetButtonTitle:(0,l.T)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),resetButtonAriaLabel:(0,l.T)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),cancelButtonText:(0,l.T)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"}),cancelButtonAriaLabel:(0,l.T)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"})},startScreen:{recentSearchesTitle:(0,l.T)({id:"theme.SearchModal.startScreen.recentSearchesTitle",message:"Recent",description:"The title for recent searches"}),noRecentSearchesText:(0,l.T)({id:"theme.SearchModal.startScreen.noRecentSearchesText",message:"No recent searches",description:"The text when no recent searches"}),saveRecentSearchButtonTitle:(0,l.T)({id:"theme.SearchModal.startScreen.saveRecentSearchButtonTitle",message:"Save this search",description:"The label for save recent search button"}),removeRecentSearchButtonTitle:(0,l.T)({id:"theme.SearchModal.startScreen.removeRecentSearchButtonTitle",message:"Remove this search from history",description:"The label for remove recent search button"}),favoriteSearchesTitle:(0,l.T)({id:"theme.SearchModal.startScreen.favoriteSearchesTitle",message:"Favorite",description:"The title for favorite searches"}),removeFavoriteSearchButtonTitle:(0,l.T)({id:"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle",message:"Remove this search from favorites",description:"The label for remove favorite search button"})},errorScreen:{titleText:(0,l.T)({id:"theme.SearchModal.errorScreen.titleText",message:"Unable to fetch results",description:"The title for error screen of search modal"}),helpText:(0,l.T)({id:"theme.SearchModal.errorScreen.helpText",message:"You might want to check your network connection.",description:"The help text for error screen of search modal"})},footer:{selectText:(0,l.T)({id:"theme.SearchModal.footer.selectText",message:"to select",description:"The explanatory text of the action for the enter key"}),selectKeyAriaLabel:(0,l.T)({id:"theme.SearchModal.footer.selectKeyAriaLabel",message:"Enter key",description:"The ARIA label for the Enter key button that makes the selection"}),navigateText:(0,l.T)({id:"theme.SearchModal.footer.navigateText",message:"to navigate",description:"The explanatory text of the action for the Arrow up and Arrow down key"}),navigateUpKeyAriaLabel:(0,l.T)({id:"theme.SearchModal.footer.navigateUpKeyAriaLabel",message:"Arrow up",description:"The ARIA label for the Arrow up key button that makes the navigation"}),navigateDownKeyAriaLabel:(0,l.T)({id:"theme.SearchModal.footer.navigateDownKeyAriaLabel",message:"Arrow down",description:"The ARIA label for the Arrow down key button that makes the navigation"}),closeText:(0,l.T)({id:"theme.SearchModal.footer.closeText",message:"to close",description:"The explanatory text of the action for Escape key"}),closeKeyAriaLabel:(0,l.T)({id:"theme.SearchModal.footer.closeKeyAriaLabel",message:"Escape key",description:"The ARIA label for the Escape key button that close the modal"}),searchByText:(0,l.T)({id:"theme.SearchModal.footer.searchByText",message:"Search by",description:"The text explain that the search is making by Algolia"})},noResultsScreen:{noResultsText:(0,l.T)({id:"theme.SearchModal.noResultsScreen.noResultsText",message:"No results for",description:"The text explains that there are no results for the following search"}),suggestedQueryText:(0,l.T)({id:"theme.SearchModal.noResultsScreen.suggestedQueryText",message:"Try searching for",description:"The text for the suggested query when no results are found for the following search"}),reportMissingResultsText:(0,l.T)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsText",message:"Believe this query should return results?",description:"The text for the question where the user thinks there are missing results"}),reportMissingResultsLinkText:(0,l.T)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText",message:"Let us know.",description:"The text for the link to report missing results"})}},placeholder:(0,l.T)({id:"theme.SearchModal.placeholder",message:"Search docs",description:"The placeholder of the input of the DocSearch pop-up modal"})};let Ee=null;function Oe(){return Ee?Promise.resolve():Promise.all([n.e(8158).then(n.bind(n,8158)),Promise.all([n.e(1869),n.e(8913)]).then(n.bind(n,8913)),Promise.all([n.e(1869),n.e(416)]).then(n.bind(n,416))]).then((e=>{let[{DocSearchModal:t}]=e;Ee=t}))}function Ce(e){let{hit:t,children:n}=e;return(0,u.jsx)(Z.A,{to:t.url,children:n})}function Ae(e){let{state:t,onClose:n}=e;const r=(0,we.w)();return(0,u.jsx)(Z.A,{to:r(t.query),onClick:n,children:(0,u.jsx)(l.A,{id:"theme.SearchBar.seeAll",values:{count:t.context.nbHits},children:"See all {count} results"})})}function Pe(e){let{externalUrlRegex:t,...n}=e;const o=function(e){let{externalUrlRegex:t}=e;const n=(0,i.W6)(),[o]=(0,r.useState)((()=>({navigate(e){(0,ee.G)(t,e.itemUrl)?window.location.href=e.itemUrl:n.push(e.itemUrl)}})));return o}({externalUrlRegex:t}),a=function(e){let{contextualSearch:t,...n}=e;const r=Se(),o=n.searchParameters?.facetFilters??[],a=t?function(e,t){const n=e=>"string"==typeof e?[e]:e;return[...n(e),...n(t)]}(r,o):o;return{...n.searchParameters,facetFilters:a}}({...n}),s=function(e){const t=(0,xe.C)(),[n]=(0,r.useState)((()=>n=>e.transformItems?e.transformItems(n):n.map((e=>({...e,url:t(e.url)})))));return n}(n),l=function(){const{siteMetadata:{docusaurusVersion:e}}=(0,le.A)();return(0,r.useCallback)((t=>(t.addAlgoliaAgent("docusaurus",e),t)),[e])}(),c=(0,r.useRef)(null),d=(0,r.useRef)(null),[p,f]=(0,r.useState)(!1),[g,m]=(0,r.useState)(void 0),h=(0,r.useCallback)((()=>{if(!c.current){const e=document.createElement("div");c.current=e,document.body.insertBefore(e,document.body.firstChild)}}),[]),b=(0,r.useCallback)((()=>{h(),Oe().then((()=>f(!0)))}),[h]),v=(0,r.useCallback)((()=>{f(!1),d.current?.focus(),m(void 0)}),[]),y=(0,r.useCallback)((e=>{"f"===e.key&&(e.metaKey||e.ctrlKey)||(e.preventDefault(),m(e.key),b())}),[b]),w=function(e){let{closeModal:t}=e;return(0,r.useMemo)((()=>e=>{let{state:n}=e;return(0,u.jsx)(Ae,{state:n,onClose:t})}),[t])}({closeModal:v});return(0,ve.E8)({isOpen:p,onOpen:b,onClose:v,onInput:y,searchButtonRef:d}),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ye.A,{children:(0,u.jsx)("link",{rel:"preconnect",href:`https://${n.appId}-dsn.algolia.net`,crossOrigin:"anonymous"})}),(0,u.jsx)(ve.Bc,{onTouchStart:Oe,onFocus:Oe,onMouseOver:Oe,onClick:b,ref:d,translations:n.translations?.button??_e.button}),p&&Ee&&c.current&&(0,be.createPortal)((0,u.jsx)(Ee,{onClose:v,initialScrollY:window.scrollY,initialQuery:g,navigator:o,transformItems:s,hitComponent:Ce,transformSearchClient:l,...n.searchPagePath&&{resultsFooterComponent:w},placeholder:_e.placeholder,...n,translations:n.translations?.modal??_e.modal,searchParameters:a}),c.current)]})}function Te(){const{siteConfig:e}=(0,le.A)();return(0,u.jsx)(Pe,{...e.themeConfig.algolia})}const Ie={navbarSearchContainer:"navbarSearchContainer_Bca1"};function Re(e){let{children:t,className:n}=e;return(0,u.jsx)("div",{className:(0,o.A)(n,Ie.navbarSearchContainer),children:t})}var Ne=n(4070),Le=n(6972);var De=n(3886);function Me(e,t){return t.alternateDocVersions[e.name]??function(e){return e.docs.find((t=>t.id===e.mainDocId))}(e)}const Fe={default:ae,localeDropdown:function(e){let{mobile:t,dropdownItemsBefore:n,dropdownItemsAfter:r,queryString:o="",...a}=e;const{i18n:{currentLocale:s,locales:c,localeConfigs:d}}=(0,le.A)(),p=(0,ge.o)(),{search:f,hash:g}=(0,i.zy)(),m=[...n,...c.map((e=>{const n=`${`pathname://${p.createUrl({locale:e,fullyQualified:!1})}`}${f}${g}${o}`;return{label:d[e].label,lang:d[e].htmlLang,to:n,target:"_self",autoAddBaseUrl:!1,className:e===s?t?"menu__link--active":"dropdown__link--active":""}})),...r],h=t?(0,l.T)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):d[s].label;return(0,u.jsx)(fe,{...a,mobile:t,label:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(me,{className:he}),h]}),items:m})},search:function(e){let{mobile:t,className:n}=e;return t?null:(0,u.jsx)(Re,{className:n,children:(0,u.jsx)(Te,{})})},dropdown:fe,html:function(e){let{value:t,className:n,mobile:r=!1,isDropdownItem:a=!1}=e;const s=a?"li":"div";return(0,u.jsx)(s,{className:(0,o.A)({navbar__item:!r&&!a,"menu__list-item":r},n),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){let{docId:t,label:n,docsPluginId:r,...o}=e;const{activeDoc:a}=(0,Ne.zK)(r),s=(0,Le.QB)(t,r),i=a?.path===s?.path;return null===s||s.unlisted&&!i?null:(0,u.jsx)(ae,{exact:!0,...o,isActive:()=>i||!!a?.sidebar&&a.sidebar===s.sidebar,label:n??s.id,to:s.path})},docSidebar:function(e){let{sidebarId:t,label:n,docsPluginId:r,...o}=e;const{activeDoc:a}=(0,Ne.zK)(r),s=(0,Le.fW)(t,r).link;if(!s)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${t}" doesn't have anything to be linked to.`);return(0,u.jsx)(ae,{exact:!0,...o,isActive:()=>a?.sidebar===t,label:n??s.label,to:s.path})},docsVersion:function(e){let{label:t,to:n,docsPluginId:r,...o}=e;const a=(0,Le.Vd)(r)[0],s=t??a.label,i=n??(e=>e.docs.find((t=>t.id===e.mainDocId)))(a).path;return(0,u.jsx)(ae,{...o,label:s,to:i})},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:n,dropdownActiveClassDisabled:r,dropdownItemsBefore:o,dropdownItemsAfter:a,...s}=e;const{search:c,hash:d}=(0,i.zy)(),p=(0,Ne.zK)(n),f=(0,Ne.jh)(n),{savePreferredVersionName:g}=(0,De.g1)(n),m=[...o,...f.map((function(e){const t=Me(e,p);return{label:e.label,to:`${t.path}${c}${d}`,isActive:()=>e===p.activeVersion,onClick:()=>g(e.name)}})),...a],h=(0,Le.Vd)(n)[0],b=t&&m.length>1?(0,l.T)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):h.label,v=t&&m.length>1?void 0:Me(h,p).path;return m.length<=1?(0,u.jsx)(ae,{...s,mobile:t,label:b,to:v,isActive:r?()=>!1:void 0}):(0,u.jsx)(fe,{...s,mobile:t,label:b,to:v,items:m,isActive:r?()=>!1:void 0})}};function Be(e){let{type:t,...n}=e;const r=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),o=Fe[r];if(!o)throw new Error(`No NavbarItem component found for type "${t}".`);return(0,u.jsx)(o,{...n})}function ze(){const e=(0,A.M)(),t=(0,w.p)().navbar.items;return(0,u.jsx)("ul",{className:"menu__list",children:t.map(((t,n)=>(0,r.createElement)(Be,{mobile:!0,...t,onClick:()=>e.toggle(),key:n})))})}function Ue(e){return(0,u.jsx)("button",{...e,type:"button",className:"clean-btn navbar-sidebar__back",children:(0,u.jsx)(l.A,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)",children:"\u2190 Back to main menu"})})}function qe(){const e=0===(0,w.p)().navbar.items.length,t=D();return(0,u.jsxs)(u.Fragment,{children:[!e&&(0,u.jsx)(Ue,{onClick:()=>t.hide()}),t.content]})}function $e(){const e=(0,A.M)();var t;return void 0===(t=e.shown)&&(t=!0),(0,r.useEffect)((()=>(document.body.style.overflow=t?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[t]),e.shouldRender?(0,u.jsx)(M,{header:(0,u.jsx)(Y,{}),primaryMenu:(0,u.jsx)(ze,{}),secondaryMenu:(0,u.jsx)(qe,{})}):null}const He={navbarHideable:"navbarHideable_m1mJ",navbarHidden:"navbarHidden_jGov"};function Ve(e){return(0,u.jsx)("div",{role:"presentation",...e,className:(0,o.A)("navbar-sidebar__backdrop",e.className)})}function Ge(e){let{children:t}=e;const{navbar:{hideOnScroll:n,style:a}}=(0,w.p)(),s=(0,A.M)(),{navbarRef:i,isNavbarVisible:d}=function(e){const[t,n]=(0,r.useState)(e),o=(0,r.useRef)(!1),a=(0,r.useRef)(0),s=(0,r.useCallback)((e=>{null!==e&&(a.current=e.getBoundingClientRect().height)}),[]);return(0,P.Mq)(((t,r)=>{let{scrollY:s}=t;if(!e)return;if(s<a.current)return void n(!0);if(o.current)return void(o.current=!1);const i=r?.scrollY,l=document.documentElement.scrollHeight-a.current,c=window.innerHeight;i&&s>=i?n(!1):s+c<l&&n(!0)})),(0,c.$)((t=>{if(!e)return;const r=t.location.hash;if(r?document.getElementById(r.substring(1)):void 0)return o.current=!0,void n(!1);n(!0)})),{navbarRef:s,isNavbarVisible:t}}(n);return(0,u.jsxs)("nav",{ref:i,"aria-label":(0,l.T)({id:"theme.NavBar.navAriaLabel",message:"Main",description:"The ARIA label for the main navigation"}),className:(0,o.A)("navbar","navbar--fixed-top",n&&[He.navbarHideable,!d&&He.navbarHidden],{"navbar--dark":"dark"===a,"navbar--primary":"primary"===a,"navbar-sidebar--show":s.shown}),children:[t,(0,u.jsx)(Ve,{onClick:s.toggle}),(0,u.jsx)($e,{})]})}var We=n(440);const Ke={errorBoundaryError:"errorBoundaryError_a6uf",errorBoundaryFallback:"errorBoundaryFallback_VBag"};function Qe(e){return(0,u.jsx)("button",{type:"button",...e,children:(0,u.jsx)(l.A,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again rendering when the React error boundary captures an error",children:"Try again"})})}function Ye(e){let{error:t}=e;const n=(0,We.rA)(t).map((e=>e.message)).join("\n\nCause:\n");return(0,u.jsx)("p",{className:Ke.errorBoundaryError,children:n})}class Ze extends r.Component{componentDidCatch(e,t){throw this.props.onError(e,t)}render(){return this.props.children}}const Je="right";function Xe(e){let{width:t=30,height:n=30,className:r,...o}=e;return(0,u.jsx)("svg",{className:r,width:t,height:n,viewBox:"0 0 30 30","aria-hidden":"true",...o,children:(0,u.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"})})}function et(){const{toggle:e,shown:t}=(0,A.M)();return(0,u.jsx)("button",{onClick:e,"aria-label":(0,l.T)({id:"theme.docs.sidebar.toggleSidebarButtonAriaLabel",message:"Toggle navigation bar",description:"The ARIA label for hamburger menu button of mobile navigation"}),"aria-expanded":t,className:"navbar__toggle clean-btn",type:"button",children:(0,u.jsx)(Xe,{})})}const tt={colorModeToggle:"colorModeToggle_DEke"};function nt(e){let{items:t}=e;return(0,u.jsx)(u.Fragment,{children:t.map(((e,t)=>(0,u.jsx)(Ze,{onError:t=>new Error(`A theme navbar item failed to render.\nPlease double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:\n${JSON.stringify(e,null,2)}`,{cause:t}),children:(0,u.jsx)(Be,{...e})},t)))})}function rt(e){let{left:t,right:n}=e;return(0,u.jsxs)("div",{className:"navbar__inner",children:[(0,u.jsx)("div",{className:"navbar__items",children:t}),(0,u.jsx)("div",{className:"navbar__items navbar__items--right",children:n})]})}function ot(){const e=(0,A.M)(),t=(0,w.p)().navbar.items,[n,r]=function(e){function t(e){return"left"===(e.position??Je)}return[e.filter(t),e.filter((e=>!t(e)))]}(t),o=t.find((e=>"search"===e.type));return(0,u.jsx)(rt,{left:(0,u.jsxs)(u.Fragment,{children:[!e.disabled&&(0,u.jsx)(et,{}),(0,u.jsx)(K,{}),(0,u.jsx)(nt,{items:n})]}),right:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(nt,{items:r}),(0,u.jsx)(G,{className:tt.colorModeToggle}),!o&&(0,u.jsx)(Re,{children:(0,u.jsx)(Te,{})})]})})}function at(){return(0,u.jsx)(Ge,{children:(0,u.jsx)(ot,{})})}function st(e){let{item:t}=e;const{to:n,href:r,label:a,prependBaseUrlToHref:s,className:i,...l}=t,c=(0,J.Ay)(n),d=(0,J.Ay)(r,{forcePrependBaseUrl:!0});return(0,u.jsxs)(Z.A,{className:(0,o.A)("footer__link-item",i),...r?{href:s?d:r}:{to:c},...l,children:[a,r&&!(0,X.A)(r)&&(0,u.jsx)(te.A,{})]})}function it(e){let{item:t}=e;return t.html?(0,u.jsx)("li",{className:(0,o.A)("footer__item",t.className),dangerouslySetInnerHTML:{__html:t.html}}):(0,u.jsx)("li",{className:"footer__item",children:(0,u.jsx)(st,{item:t})},t.href??t.to)}function lt(e){let{column:t}=e;return(0,u.jsxs)("div",{className:(0,o.A)("col footer__col",t.className),children:[(0,u.jsx)("div",{className:"footer__title",children:t.title}),(0,u.jsx)("ul",{className:"footer__items clean-list",children:t.items.map(((e,t)=>(0,u.jsx)(it,{item:e},t)))})]})}function ct(e){let{columns:t}=e;return(0,u.jsx)("div",{className:"row footer__links",children:t.map(((e,t)=>(0,u.jsx)(lt,{column:e},t)))})}function ut(){return(0,u.jsx)("span",{className:"footer__link-separator",children:"\xb7"})}function dt(e){let{item:t}=e;return t.html?(0,u.jsx)("span",{className:(0,o.A)("footer__link-item",t.className),dangerouslySetInnerHTML:{__html:t.html}}):(0,u.jsx)(st,{item:t})}function pt(e){let{links:t}=e;return(0,u.jsx)("div",{className:"footer__links text--center",children:(0,u.jsx)("div",{className:"footer__links",children:t.map(((e,n)=>(0,u.jsxs)(r.Fragment,{children:[(0,u.jsx)(dt,{item:e}),t.length!==n+1&&(0,u.jsx)(ut,{})]},n)))})})}function ft(e){let{links:t}=e;return function(e){return"title"in e[0]}(t)?(0,u.jsx)(ct,{columns:t}):(0,u.jsx)(pt,{links:t})}var gt=n(1122);const mt={footerLogoLink:"footerLogoLink_BH7S"};function ht(e){let{logo:t}=e;const{withBaseUrl:n}=(0,J.hH)(),r={light:n(t.src),dark:n(t.srcDark??t.src)};return(0,u.jsx)(gt.A,{className:(0,o.A)("footer__logo",t.className),alt:t.alt,sources:r,width:t.width,height:t.height,style:t.style})}function bt(e){let{logo:t}=e;return t.href?(0,u.jsx)(Z.A,{href:t.href,className:mt.footerLogoLink,target:t.target,children:(0,u.jsx)(ht,{logo:t})}):(0,u.jsx)(ht,{logo:t})}function vt(e){let{copyright:t}=e;return(0,u.jsx)("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function yt(e){let{style:t,links:n,logo:r,copyright:a}=e;return(0,u.jsx)("footer",{className:(0,o.A)("footer",{"footer--dark":"dark"===t}),children:(0,u.jsxs)("div",{className:"container container-fluid",children:[n,(r||a)&&(0,u.jsxs)("div",{className:"footer__bottom text--center",children:[r&&(0,u.jsx)("div",{className:"margin-bottom--sm",children:r}),a]})]})})}function wt(){const{footer:e}=(0,w.p)();if(!e)return null;const{copyright:t,links:n,logo:r,style:o}=e;return(0,u.jsx)(yt,{style:o,links:n&&n.length>0&&(0,u.jsx)(ft,{links:n}),logo:r&&(0,u.jsx)(bt,{logo:r}),copyright:t&&(0,u.jsx)(vt,{copyright:t})})}const xt=r.memo(wt),jt=(0,T.fM)([F.a,x.o,P.Tv,De.VQ,s.Jx,function(e){let{children:t}=e;return(0,u.jsx)(I.y_,{children:(0,u.jsx)(A.e,{children:(0,u.jsx)(N,{children:t})})})}]);function kt(e){let{children:t}=e;return(0,u.jsx)(jt,{children:t})}var St=n(1107);function _t(e){let{error:t,tryAgain:n}=e;return(0,u.jsx)("main",{className:"container margin-vert--xl",children:(0,u.jsx)("div",{className:"row",children:(0,u.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,u.jsx)(St.A,{as:"h1",className:"hero__title",children:(0,u.jsx)(l.A,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed",children:"This page crashed."})}),(0,u.jsx)("div",{className:"margin-vert--lg",children:(0,u.jsx)(Qe,{onClick:n,className:"button button--primary shadow--lw"})}),(0,u.jsx)("hr",{}),(0,u.jsx)("div",{className:"margin-vert--md",children:(0,u.jsx)(Ye,{error:t})})]})})})}const Et={mainWrapper:"mainWrapper_z2l0"};function Ot(e){const{children:t,noFooter:n,wrapperClassName:r,title:i,description:l}=e;return(0,b.J)(),(0,u.jsxs)(kt,{children:[(0,u.jsx)(s.be,{title:i,description:l}),(0,u.jsx)(y,{}),(0,u.jsx)(C,{}),(0,u.jsx)(at,{}),(0,u.jsx)("div",{id:d,className:(0,o.A)(h.G.wrapper.main,Et.mainWrapper,r),children:(0,u.jsx)(a.A,{fallback:e=>(0,u.jsx)(_t,{...e}),children:t})}),!n&&(0,u.jsx)(xt,{})]})}},3465:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});n(6540);var r=n(8774),o=n(6025),a=n(4586),s=n(6342),i=n(1122),l=n(4848);function c(e){let{logo:t,alt:n,imageClassName:r}=e;const a={light:(0,o.Ay)(t.src),dark:(0,o.Ay)(t.srcDark||t.src)},s=(0,l.jsx)(i.A,{className:t.className,sources:a,height:t.height,width:t.width,alt:n,style:t.style});return r?(0,l.jsx)("div",{className:r,children:s}):s}function u(e){const{siteConfig:{title:t}}=(0,a.A)(),{navbar:{title:n,logo:i}}=(0,s.p)(),{imageClassName:u,titleClassName:d,...p}=e,f=(0,o.Ay)(i?.href||"/"),g=n?"":t,m=i?.alt??g;return(0,l.jsxs)(r.A,{to:f,...p,...i?.target&&{target:i.target},children:[i&&(0,l.jsx)(c,{logo:i,alt:m,imageClassName:u}),null!=n&&(0,l.jsx)("b",{className:d,children:n})]})}},1463:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});n(6540);var r=n(5260),o=n(4848);function a(e){let{locale:t,version:n,tag:a}=e;const s=t;return(0,o.jsxs)(r.A,{children:[t&&(0,o.jsx)("meta",{name:"docusaurus_locale",content:t}),n&&(0,o.jsx)("meta",{name:"docusaurus_version",content:n}),a&&(0,o.jsx)("meta",{name:"docusaurus_tag",content:a}),s&&(0,o.jsx)("meta",{name:"docsearch:language",content:s}),n&&(0,o.jsx)("meta",{name:"docsearch:version",content:n}),a&&(0,o.jsx)("meta",{name:"docsearch:docusaurus_tag",content:a})]})}},1122:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(6540),o=n(4164),a=n(2303),s=n(5293);const i={themedComponent:"themedComponent_mlkZ","themedComponent--light":"themedComponent--light_NVdE","themedComponent--dark":"themedComponent--dark_xIcU"};var l=n(4848);function c(e){let{className:t,children:n}=e;const c=(0,a.A)(),{colorMode:u}=(0,s.G)();return(0,l.jsx)(l.Fragment,{children:(c?"dark"===u?["dark"]:["light"]:["light","dark"]).map((e=>{const a=n({theme:e,className:(0,o.A)(t,i.themedComponent,i[`themedComponent--${e}`])});return(0,l.jsx)(r.Fragment,{children:a},e)}))})}function u(e){const{sources:t,className:n,alt:r,...o}=e;return(0,l.jsx)(c,{className:n,children:e=>{let{theme:n,className:a}=e;return(0,l.jsx)("img",{src:t[n],alt:r,className:a,...o})}})}},1422:(e,t,n)=>{"use strict";n.d(t,{N:()=>b,u:()=>c});var r=n(6540),o=n(2303),a=n(205),s=n(3109),i=n(4848);const l="ease-in-out";function c(e){let{initialState:t}=e;const[n,o]=(0,r.useState)(t??!1),a=(0,r.useCallback)((()=>{o((e=>!e))}),[]);return{collapsed:n,setCollapsed:o,toggleCollapsed:a}}const u={display:"none",overflow:"hidden",height:"0px"},d={display:"block",overflow:"visible",height:"auto"};function p(e,t){const n=t?u:d;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function f(e){let{collapsibleRef:t,collapsed:n,animation:o}=e;const a=(0,r.useRef)(!1);(0,r.useEffect)((()=>{const e=t.current;function r(){const t=e.scrollHeight,n=o?.duration??function(e){if((0,s.O)())return 1;const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${n}ms ${o?.easing??l}`,height:`${t}px`}}function i(){const t=r();e.style.transition=t.transition,e.style.height=t.height}if(!a.current)return p(e,n),void(a.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{n?(i(),requestAnimationFrame((()=>{e.style.height=u.height,e.style.overflow=u.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{i()})))}));return()=>cancelAnimationFrame(t)}()}),[t,n,o])}function g(e){let{collapsed:t,isBrowser:n}=e;if(!n)return t?u:d}function m(e){let{as:t="div",collapsed:n,children:a,animation:s,onCollapseTransitionEnd:l,className:c,disableSSRStyle:u}=e;const d=(0,o.A)(),m=(0,r.useRef)(null);return f({collapsibleRef:m,collapsed:n,animation:s}),(0,i.jsx)(t,{ref:m,style:u?void 0:g({collapsed:n,isBrowser:d}),onTransitionEnd:e=>{"height"===e.propertyName&&(p(m.current,n),l?.(n))},className:c,children:a})}function h(e){let{collapsed:t,...n}=e;const[o,s]=(0,r.useState)(!t),[l,c]=(0,r.useState)(t);return(0,a.A)((()=>{t||s(!0)}),[t]),(0,a.A)((()=>{o&&c(t)}),[o,t]),o?(0,i.jsx)(m,{...n,collapsed:l}):null}function b(e){let{lazy:t,...n}=e;const r=t?h:m;return(0,i.jsx)(r,{...n})}},5041:(e,t,n)=>{"use strict";n.d(t,{M:()=>m,o:()=>g});var r=n(6540),o=n(2303),a=n(679),s=n(9532),i=n(6342),l=n(4848);const c=(0,a.Wf)("docusaurus.announcement.dismiss"),u=(0,a.Wf)("docusaurus.announcement.id"),d=()=>"true"===c.get(),p=e=>c.set(String(e)),f=r.createContext(null);function g(e){let{children:t}=e;const n=function(){const{announcementBar:e}=(0,i.p)(),t=(0,o.A)(),[n,a]=(0,r.useState)((()=>!!t&&d()));(0,r.useEffect)((()=>{a(d())}),[]);const s=(0,r.useCallback)((()=>{p(!0),a(!0)}),[]);return(0,r.useEffect)((()=>{if(!e)return;const{id:t}=e;let n=u.get();"annoucement-bar"===n&&(n="announcement-bar");const r=t!==n;u.set(t),r&&p(!1),!r&&d()||a(!1)}),[e]),(0,r.useMemo)((()=>({isActive:!!e&&!n,close:s})),[e,n,s])}();return(0,l.jsx)(f.Provider,{value:n,children:t})}function m(){const e=(0,r.useContext)(f);if(!e)throw new s.dV("AnnouncementBarProvider");return e}},5293:(e,t,n)=>{"use strict";n.d(t,{G:()=>b,a:()=>h});var r=n(6540),o=n(8193),a=n(9532),s=n(679),i=n(6342),l=n(4848);const c=r.createContext(void 0),u="theme",d=(0,s.Wf)(u),p={light:"light",dark:"dark"},f=e=>e===p.dark?p.dark:p.light,g=e=>o.A.canUseDOM?f(document.documentElement.getAttribute("data-theme")):f(e),m=e=>{d.set(f(e))};function h(e){let{children:t}=e;const n=function(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:n}}=(0,i.p)(),[o,a]=(0,r.useState)(g(e));(0,r.useEffect)((()=>{t&&d.del()}),[t]);const s=(0,r.useCallback)((function(t,r){void 0===r&&(r={});const{persist:o=!0}=r;t?(a(t),o&&m(t)):(a(n?window.matchMedia("(prefers-color-scheme: dark)").matches?p.dark:p.light:e),d.del())}),[n,e]);(0,r.useEffect)((()=>{document.documentElement.setAttribute("data-theme",f(o))}),[o]),(0,r.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==u)return;const t=d.get();null!==t&&s(f(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,s]);const l=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{if(t&&!n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{window.matchMedia("print").matches||l.current?l.current=window.matchMedia("print").matches:s(null)};return e.addListener(r),()=>e.removeListener(r)}),[s,t,n]),(0,r.useMemo)((()=>({colorMode:o,setColorMode:s,get isDarkTheme(){return o===p.dark},setLightTheme(){s(p.light)},setDarkTheme(){s(p.dark)}})),[o,s])}();return(0,l.jsx)(c.Provider,{value:n,children:t})}function b(){const e=(0,r.useContext)(c);if(null==e)throw new a.dV("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},2069:(e,t,n)=>{"use strict";n.d(t,{M:()=>f,e:()=>p});var r=n(6540),o=n(5600),a=n(4581),s=n(7485),i=n(6342),l=n(9532),c=n(4848);const u=r.createContext(void 0);function d(){const e=function(){const e=(0,o.YL)(),{items:t}=(0,i.p)().navbar;return 0===t.length&&!e.component}(),t=(0,a.l)(),n=!e&&"mobile"===t,[l,c]=(0,r.useState)(!1);(0,s.$Z)((()=>{if(l)return c(!1),!1}));const u=(0,r.useCallback)((()=>{c((e=>!e))}),[]);return(0,r.useEffect)((()=>{"desktop"===t&&c(!1)}),[t]),(0,r.useMemo)((()=>({disabled:e,shouldRender:n,toggle:u,shown:l})),[e,n,u,l])}function p(e){let{children:t}=e;const n=d();return(0,c.jsx)(u.Provider,{value:n,children:t})}function f(){const e=r.useContext(u);if(void 0===e)throw new l.dV("NavbarMobileSidebarProvider");return e}},5600:(e,t,n)=>{"use strict";n.d(t,{GX:()=>c,YL:()=>l,y_:()=>i});var r=n(6540),o=n(9532),a=n(4848);const s=r.createContext(null);function i(e){let{children:t}=e;const n=(0,r.useState)({component:null,props:null});return(0,a.jsx)(s.Provider,{value:n,children:t})}function l(){const e=(0,r.useContext)(s);if(!e)throw new o.dV("NavbarSecondaryMenuContentProvider");return e[0]}function c(e){let{component:t,props:n}=e;const a=(0,r.useContext)(s);if(!a)throw new o.dV("NavbarSecondaryMenuContentProvider");const[,i]=a,l=(0,o.Be)(n);return(0,r.useEffect)((()=>{i({component:t,props:l})}),[i,t,l]),(0,r.useEffect)((()=>()=>i({component:null,props:null})),[i]),null}},4090:(e,t,n)=>{"use strict";n.d(t,{w:()=>o,J:()=>a});var r=n(6540);const o="navigation-with-keyboard";function a(){(0,r.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(o),"mousedown"===e.type&&document.body.classList.remove(o)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(o),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},4255:(e,t,n)=>{"use strict";n.d(t,{b:()=>i,w:()=>l});var r=n(6540),o=n(4586),a=n(7485);const s="q";function i(){return(0,a.l)(s)}function l(){const{siteConfig:{baseUrl:e,themeConfig:t}}=(0,o.A)(),{algolia:{searchPagePath:n}}=t;return(0,r.useCallback)((t=>`${e}${n}?${s}=${encodeURIComponent(t)}`),[e,n])}},4581:(e,t,n)=>{"use strict";n.d(t,{l:()=>i});var r=n(6540),o=n(8193);const a={desktop:"desktop",mobile:"mobile",ssr:"ssr"},s=996;function i(e){let{desktopBreakpoint:t=s}=void 0===e?{}:e;const[n,i]=(0,r.useState)((()=>"ssr"));return(0,r.useEffect)((()=>{function e(){i(function(e){if(!o.A.canUseDOM)throw new Error("getWindowSize() should only be called after React hydration");return window.innerWidth>e?a.desktop:a.mobile}(t))}return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[t]),n}},7559:(e,t,n)=>{"use strict";n.d(t,{G:()=>r});const r={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",blogAuthorsListPage:"blog-authors-list-page",blogAuthorsPostsPage:"blog-authors-posts-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",unlistedBanner:"theme-unlisted-banner",draftBanner:"theme-draft-banner",admonitionType:e=>`theme-admonition-${e}`},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{blogFooterTagsRow:"theme-blog-footer-tags-row",blogFooterEditMetaRow:"theme-blog-footer-edit-meta-row"},pages:{pageFooterEditMetaRow:"theme-pages-footer-edit-meta-row"}}},3109:(e,t,n)=>{"use strict";function r(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}n.d(t,{O:()=>r})},481:(e,t,n)=>{"use strict";n.d(t,{s:()=>o});var r=n(4586);function o(e){const{siteConfig:t}=(0,r.A)(),{title:n,titleDelimiter:o}=t;return e?.trim().length?`${e.trim()} ${o} ${n}`:n}},7485:(e,t,n)=>{"use strict";n.d(t,{$Z:()=>s,aZ:()=>l,l:()=>c});var r=n(6540),o=n(6347),a=n(9532);function s(e){!function(e){const t=(0,o.W6)(),n=(0,a._q)(e);(0,r.useEffect)((()=>t.block(((e,t)=>n(e,t)))),[t,n])}(((t,n)=>{if("POP"===n)return e(t,n)}))}function i(e){const t=(0,o.W6)();return(0,r.useSyncExternalStore)(t.listen,(()=>e(t)),(()=>e(t)))}function l(e){return i((t=>null===e?null:new URLSearchParams(t.location.search).get(e)))}function c(e){const t=l(e)??"",n=function(e){const t=(0,o.W6)();return(0,r.useCallback)(((n,r)=>{const o=new URLSearchParams(t.location.search);n?o.set(e,n):o.delete(e),(r?.push?t.push:t.replace)({search:o.toString()})}),[e,t])}(e);return[t,n]}},1682:(e,t,n)=>{"use strict";function r(e,t){return void 0===t&&(t=(e,t)=>e===t),e.filter(((n,r)=>e.findIndex((e=>t(e,n)))!==r))}function o(e){return Array.from(new Set(e))}n.d(t,{XI:()=>r,sb:()=>o})},9024:(e,t,n)=>{"use strict";n.d(t,{e3:()=>f,be:()=>d,Jx:()=>g});var r=n(6540),o=n(4164),a=n(5260),s=n(3102);function i(){const e=r.useContext(s.o);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var l=n(6025),c=n(481),u=n(4848);function d(e){let{title:t,description:n,keywords:r,image:o,children:s}=e;const i=(0,c.s)(t),{withBaseUrl:d}=(0,l.hH)(),p=o?d(o,{absolute:!0}):void 0;return(0,u.jsxs)(a.A,{children:[t&&(0,u.jsx)("title",{children:i}),t&&(0,u.jsx)("meta",{property:"og:title",content:i}),n&&(0,u.jsx)("meta",{name:"description",content:n}),n&&(0,u.jsx)("meta",{property:"og:description",content:n}),r&&(0,u.jsx)("meta",{name:"keywords",content:Array.isArray(r)?r.join(","):r}),p&&(0,u.jsx)("meta",{property:"og:image",content:p}),p&&(0,u.jsx)("meta",{name:"twitter:image",content:p}),s]})}const p=r.createContext(void 0);function f(e){let{className:t,children:n}=e;const s=r.useContext(p),i=(0,o.A)(s,t);return(0,u.jsxs)(p.Provider,{value:i,children:[(0,u.jsx)(a.A,{children:(0,u.jsx)("html",{className:i})}),n]})}function g(e){let{children:t}=e;const n=i(),r=`plugin-${n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const a=`plugin-id-${n.plugin.id}`;return(0,u.jsx)(f,{className:(0,o.A)(r,a),children:t})}},9532:(e,t,n)=>{"use strict";n.d(t,{Be:()=>c,ZC:()=>i,_q:()=>s,dV:()=>l,fM:()=>u});var r=n(6540),o=n(205),a=n(4848);function s(e){const t=(0,r.useRef)(e);return(0,o.A)((()=>{t.current=e}),[e]),(0,r.useCallback)((function(){return t.current(...arguments)}),[])}function i(e){const t=(0,r.useRef)();return(0,o.A)((()=>{t.current=e})),t.current}class l extends Error{constructor(e,t){super(),this.name="ReactContextError",this.message=`Hook ${this.stack?.split("\n")[1]?.match(/at (?:\w+\.)?(?<name>\w+)/)?.groups.name??""} is called outside the <${e}>. ${t??""}`}}function c(e){const t=Object.entries(e);return t.sort(((e,t)=>e[0].localeCompare(t[0]))),(0,r.useMemo)((()=>e),t.flat())}function u(e){return t=>{let{children:n}=t;return(0,a.jsx)(a.Fragment,{children:e.reduceRight(((e,t)=>(0,a.jsx)(t,{children:e})),n)})}}},1252:(e,t,n)=>{"use strict";function r(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}n.d(t,{G:()=>r})},9169:(e,t,n)=>{"use strict";n.d(t,{Dt:()=>i,ys:()=>s});var r=n(6540),o=n(8328),a=n(4586);function s(e,t){const n=e=>(!e||e.endsWith("/")?e:`${e}/`)?.toLowerCase();return n(e)===n(t)}function i(){const{baseUrl:e}=(0,a.A)().siteConfig;return(0,r.useMemo)((()=>function(e){let{baseUrl:t,routes:n}=e;function r(e){return e.path===t&&!0===e.exact}function o(e){return e.path===t&&!e.exact}return function e(t){if(0===t.length)return;return t.find(r)||e(t.filter(o).flatMap((e=>e.routes??[])))}(n)}({routes:o.A,baseUrl:e})),[e])}},3104:(e,t,n)=>{"use strict";n.d(t,{Mq:()=>f,Tv:()=>u,a_:()=>g,gk:()=>m});var r=n(6540),o=n(8193),a=n(2303),s=n(205),i=n(9532),l=n(4848);const c=r.createContext(void 0);function u(e){let{children:t}=e;const n=function(){const e=(0,r.useRef)(!0);return(0,r.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return(0,l.jsx)(c.Provider,{value:n,children:t})}function d(){const e=(0,r.useContext)(c);if(null==e)throw new i.dV("ScrollControllerProvider");return e}const p=()=>o.A.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function f(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:n}=d(),o=(0,r.useRef)(p()),a=(0,i._q)(e);(0,r.useEffect)((()=>{const e=()=>{if(!n.current)return;const e=p();a(e,o.current),o.current=e},t={passive:!0};return e(),window.addEventListener("scroll",e,t),()=>window.removeEventListener("scroll",e,t)}),[a,n,...t])}function g(){const e=d(),t=function(){const e=(0,r.useRef)({elem:null,top:0}),t=(0,r.useCallback)((t=>{e.current={elem:t,top:t.getBoundingClientRect().top}}),[]),n=(0,r.useCallback)((()=>{const{current:{elem:t,top:n}}=e;if(!t)return{restored:!1};const r=t.getBoundingClientRect().top-n;return r&&window.scrollBy({left:0,top:r}),e.current={elem:null,top:0},{restored:0!==r}}),[]);return(0,r.useMemo)((()=>({save:t,restore:n})),[n,t])}(),n=(0,r.useRef)(void 0),o=(0,r.useCallback)((r=>{t.save(r),e.disableScrollEvents(),n.current=()=>{const{restored:r}=t.restore();if(n.current=void 0,r){const t=()=>{e.enableScrollEvents(),window.removeEventListener("scroll",t)};window.addEventListener("scroll",t)}else e.enableScrollEvents()}}),[e,t]);return(0,s.A)((()=>{queueMicrotask((()=>n.current?.()))})),{blockElementScrollPositionUntilNextRender:o}}function m(){const e=(0,r.useRef)(null),t=(0,a.A)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:n=>{e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(n):function(e){let t=null;const n=document.documentElement.scrollTop>e;return function r(){const o=document.documentElement.scrollTop;(n&&o>e||!n&&o<e)&&(t=requestAnimationFrame(r),window.scrollTo(0,Math.floor(.85*(o-e))+e))}(),()=>t&&cancelAnimationFrame(t)}(n)},cancelScroll:()=>e.current?.()}}},2967:(e,t,n)=>{"use strict";n.d(t,{C:()=>r});const r="default"},679:(e,t,n)=>{"use strict";n.d(t,{Wf:()=>u,Dv:()=>d});var r=n(6540);const o=JSON.parse('{"N":"localStorage","M":""}'),a=o.N;function s(e){let{key:t,oldValue:n,newValue:r,storage:o}=e;if(n===r)return;const a=document.createEvent("StorageEvent");a.initStorageEvent("storage",!1,!1,t,n,r,window.location.href,o),window.dispatchEvent(a)}function i(e){if(void 0===e&&(e=a),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(n){return t=n,l||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),l=!0),null}var t}let l=!1;const c={get:()=>null,set:()=>{},del:()=>{},listen:()=>()=>{}};function u(e,t){const n=`${e}${o.M}`;if("undefined"==typeof window)return function(e){function t(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:t,set:t,del:t,listen:t}}(n);const r=i(t?.persistence);return null===r?c:{get:()=>{try{return r.getItem(n)}catch(e){return console.error(`Docusaurus storage error, can't get key=${n}`,e),null}},set:e=>{try{const t=r.getItem(n);r.setItem(n,e),s({key:n,oldValue:t,newValue:e,storage:r})}catch(t){console.error(`Docusaurus storage error, can't set ${n}=${e}`,t)}},del:()=>{try{const e=r.getItem(n);r.removeItem(n),s({key:n,oldValue:e,newValue:null,storage:r})}catch(e){console.error(`Docusaurus storage error, can't delete key=${n}`,e)}},listen:e=>{try{const t=t=>{t.storageArea===r&&t.key===n&&e(t)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}catch(t){return console.error(`Docusaurus storage error, can't listen for changes of key=${n}`,t),()=>{}}}}}function d(e,t){const n=(0,r.useRef)((()=>null===e?c:u(e,t))).current(),o=(0,r.useCallback)((e=>"undefined"==typeof window?()=>{}:n.listen(e)),[n]);return[(0,r.useSyncExternalStore)(o,(()=>n.get()),(()=>null)),n]}},2131:(e,t,n)=>{"use strict";n.d(t,{o:()=>s});var r=n(4586),o=n(6347),a=n(440);function s(){const{siteConfig:{baseUrl:e,url:t,trailingSlash:n},i18n:{defaultLocale:s,currentLocale:i}}=(0,r.A)(),{pathname:l}=(0,o.zy)(),c=(0,a.Ks)(l,{trailingSlash:n,baseUrl:e}),u=i===s?e:e.replace(`/${i}/`,"/"),d=c.replace(e,"");return{createUrl:function(e){let{locale:n,fullyQualified:r}=e;return`${r?t:""}${function(e){return e===s?`${u}`:`${u}${e}/`}(n)}${d}`}}}},5062:(e,t,n)=>{"use strict";n.d(t,{$:()=>s});var r=n(6540),o=n(6347),a=n(9532);function s(e){const t=(0,o.zy)(),n=(0,a.ZC)(t),s=(0,a._q)(e);(0,r.useEffect)((()=>{n&&t!==n&&s({location:t,previousLocation:n})}),[s,t,n])}},6342:(e,t,n)=>{"use strict";n.d(t,{p:()=>o});var r=n(4586);function o(){return(0,r.A)().siteConfig.themeConfig}},8126:(e,t,n)=>{"use strict";n.d(t,{c:()=>o});var r=n(4586);function o(){const{siteConfig:{themeConfig:e}}=(0,r.A)();return e}},1062:(e,t,n)=>{"use strict";n.d(t,{C:()=>i});var r=n(6540),o=n(1252),a=n(6025),s=n(8126);function i(){const{withBaseUrl:e}=(0,a.hH)(),{algolia:{externalUrlRegex:t,replaceSearchResultPathname:n}}=(0,s.c)();return(0,r.useCallback)((r=>{const a=new URL(r);if((0,o.G)(t,a.href))return r;const s=`${a.pathname+a.hash}`;return e(function(e,t){return t?e.replaceAll(new RegExp(t.from,"g"),t.to):e}(s,n))}),[e,t,n])}},2983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addTrailingSlash=o,t.default=function(e,t){const{trailingSlash:n,baseUrl:r}=t;if(e.startsWith("#"))return e;if(void 0===n)return e;const[s]=e.split(/[#?]/),i="/"===s||s===r?s:(l=s,c=n,c?o(l):a(l));var l,c;return e.replace(s,i)},t.addLeadingSlash=function(e){return(0,r.addPrefix)(e,"/")},t.removeTrailingSlash=a;const r=n(2566);function o(e){return e.endsWith("/")?e:`${e}/`}function a(e){return(0,r.removeSuffix)(e,"/")}},253:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCausalChain=function e(t){if(t.cause)return[t,...e(t.cause)];return[t]}},440:(e,t,n)=>{"use strict";t.rA=t.Ks=void 0;const r=n(1635);var o=n(2983);Object.defineProperty(t,"Ks",{enumerable:!0,get:function(){return r.__importDefault(o).default}});var a=n(2566);var s=n(253);Object.defineProperty(t,"rA",{enumerable:!0,get:function(){return s.getErrorCausalChain}})},2566:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addPrefix=function(e,t){return e.startsWith(t)?e:`${t}${e}`},t.removeSuffix=function(e,t){if(""===t)return e;return e.endsWith(t)?e.slice(0,-t.length):e},t.addSuffix=function(e,t){return e.endsWith(t)?e:`${e}${t}`},t.removePrefix=function(e,t){return e.startsWith(t)?e.slice(t.length):e}},1513:(e,t,n)=>{"use strict";n.d(t,{zR:()=>w,TM:()=>E,yJ:()=>f,sC:()=>C,AO:()=>p});var r=n(8168);function o(e){return"/"===e.charAt(0)}function a(e,t){for(var n=t,r=n+1,o=e.length;r<o;n+=1,r+=1)e[n]=e[r];e.pop()}const s=function(e,t){void 0===t&&(t="");var n,r=e&&e.split("/")||[],s=t&&t.split("/")||[],i=e&&o(e),l=t&&o(t),c=i||l;if(e&&o(e)?s=r:r.length&&(s.pop(),s=s.concat(r)),!s.length)return"/";if(s.length){var u=s[s.length-1];n="."===u||".."===u||""===u}else n=!1;for(var d=0,p=s.length;p>=0;p--){var f=s[p];"."===f?a(s,p):".."===f?(a(s,p),d++):d&&(a(s,p),d--)}if(!c)for(;d--;d)s.unshift("..");!c||""===s[0]||s[0]&&o(s[0])||s.unshift("");var g=s.join("/");return n&&"/"!==g.substr(-1)&&(g+="/"),g};var i=n(8997);function l(e){return"/"===e.charAt(0)?e:"/"+e}function c(e){return"/"===e.charAt(0)?e.substr(1):e}function u(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function d(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function p(e){var t=e.pathname,n=e.search,r=e.hash,o=t||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}function f(e,t,n,o){var a;"string"==typeof e?(a=function(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substr(o),t=t.substr(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),a.state=t):(void 0===(a=(0,r.A)({},e)).pathname&&(a.pathname=""),a.search?"?"!==a.search.charAt(0)&&(a.search="?"+a.search):a.search="",a.hash?"#"!==a.hash.charAt(0)&&(a.hash="#"+a.hash):a.hash="",void 0!==t&&void 0===a.state&&(a.state=t));try{a.pathname=decodeURI(a.pathname)}catch(i){throw i instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):i}return n&&(a.key=n),o?a.pathname?"/"!==a.pathname.charAt(0)&&(a.pathname=s(a.pathname,o.pathname)):a.pathname=o.pathname:a.pathname||(a.pathname="/"),a}function g(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,o){if(null!=e){var a="function"==typeof e?e(t,n):e;"string"==typeof a?"function"==typeof r?r(a,o):o(!0):o(!1!==a)}else o(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.forEach((function(e){return e.apply(void 0,n)}))}}}var m=!("undefined"==typeof window||!window.document||!window.document.createElement);function h(e,t){t(window.confirm(e))}var b="popstate",v="hashchange";function y(){try{return window.history.state||{}}catch(e){return{}}}function w(e){void 0===e&&(e={}),m||(0,i.A)(!1);var t,n=window.history,o=(-1===(t=window.navigator.userAgent).indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,a=!(-1===window.navigator.userAgent.indexOf("Trident")),s=e,c=s.forceRefresh,w=void 0!==c&&c,x=s.getUserConfirmation,j=void 0===x?h:x,k=s.keyLength,S=void 0===k?6:k,_=e.basename?d(l(e.basename)):"";function E(e){var t=e||{},n=t.key,r=t.state,o=window.location,a=o.pathname+o.search+o.hash;return _&&(a=u(a,_)),f(a,r,n)}function O(){return Math.random().toString(36).substr(2,S)}var C=g();function A(e){(0,r.A)(U,e),U.length=n.length,C.notifyListeners(U.location,U.action)}function P(e){(function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")})(e)||R(E(e.state))}function T(){R(E(y()))}var I=!1;function R(e){if(I)I=!1,A();else{C.confirmTransitionTo(e,"POP",j,(function(t){t?A({action:"POP",location:e}):function(e){var t=U.location,n=L.indexOf(t.key);-1===n&&(n=0);var r=L.indexOf(e.key);-1===r&&(r=0);var o=n-r;o&&(I=!0,M(o))}(e)}))}}var N=E(y()),L=[N.key];function D(e){return _+p(e)}function M(e){n.go(e)}var F=0;function B(e){1===(F+=e)&&1===e?(window.addEventListener(b,P),a&&window.addEventListener(v,T)):0===F&&(window.removeEventListener(b,P),a&&window.removeEventListener(v,T))}var z=!1;var U={length:n.length,action:"POP",location:N,createHref:D,push:function(e,t){var r="PUSH",a=f(e,t,O(),U.location);C.confirmTransitionTo(a,r,j,(function(e){if(e){var t=D(a),s=a.key,i=a.state;if(o)if(n.pushState({key:s,state:i},null,t),w)window.location.href=t;else{var l=L.indexOf(U.location.key),c=L.slice(0,l+1);c.push(a.key),L=c,A({action:r,location:a})}else window.location.href=t}}))},replace:function(e,t){var r="REPLACE",a=f(e,t,O(),U.location);C.confirmTransitionTo(a,r,j,(function(e){if(e){var t=D(a),s=a.key,i=a.state;if(o)if(n.replaceState({key:s,state:i},null,t),w)window.location.replace(t);else{var l=L.indexOf(U.location.key);-1!==l&&(L[l]=a.key),A({action:r,location:a})}else window.location.replace(t)}}))},go:M,goBack:function(){M(-1)},goForward:function(){M(1)},block:function(e){void 0===e&&(e=!1);var t=C.setPrompt(e);return z||(B(1),z=!0),function(){return z&&(z=!1,B(-1)),t()}},listen:function(e){var t=C.appendListener(e);return B(1),function(){B(-1),t()}}};return U}var x="hashchange",j={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!/"+c(e)},decodePath:function(e){return"!"===e.charAt(0)?e.substr(1):e}},noslash:{encodePath:c,decodePath:l},slash:{encodePath:l,decodePath:l}};function k(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function S(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.substring(t+1)}function _(e){window.location.replace(k(window.location.href)+"#"+e)}function E(e){void 0===e&&(e={}),m||(0,i.A)(!1);var t=window.history,n=(window.navigator.userAgent.indexOf("Firefox"),e),o=n.getUserConfirmation,a=void 0===o?h:o,s=n.hashType,c=void 0===s?"slash":s,b=e.basename?d(l(e.basename)):"",v=j[c],y=v.encodePath,w=v.decodePath;function E(){var e=w(S());return b&&(e=u(e,b)),f(e)}var O=g();function C(e){(0,r.A)(z,e),z.length=t.length,O.notifyListeners(z.location,z.action)}var A=!1,P=null;function T(){var e,t,n=S(),r=y(n);if(n!==r)_(r);else{var o=E(),s=z.location;if(!A&&(t=o,(e=s).pathname===t.pathname&&e.search===t.search&&e.hash===t.hash))return;if(P===p(o))return;P=null,function(e){if(A)A=!1,C();else{var t="POP";O.confirmTransitionTo(e,t,a,(function(n){n?C({action:t,location:e}):function(e){var t=z.location,n=L.lastIndexOf(p(t));-1===n&&(n=0);var r=L.lastIndexOf(p(e));-1===r&&(r=0);var o=n-r;o&&(A=!0,D(o))}(e)}))}}(o)}}var I=S(),R=y(I);I!==R&&_(R);var N=E(),L=[p(N)];function D(e){t.go(e)}var M=0;function F(e){1===(M+=e)&&1===e?window.addEventListener(x,T):0===M&&window.removeEventListener(x,T)}var B=!1;var z={length:t.length,action:"POP",location:N,createHref:function(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=k(window.location.href)),n+"#"+y(b+p(e))},push:function(e,t){var n="PUSH",r=f(e,void 0,void 0,z.location);O.confirmTransitionTo(r,n,a,(function(e){if(e){var t=p(r),o=y(b+t);if(S()!==o){P=t,function(e){window.location.hash=e}(o);var a=L.lastIndexOf(p(z.location)),s=L.slice(0,a+1);s.push(t),L=s,C({action:n,location:r})}else C()}}))},replace:function(e,t){var n="REPLACE",r=f(e,void 0,void 0,z.location);O.confirmTransitionTo(r,n,a,(function(e){if(e){var t=p(r),o=y(b+t);S()!==o&&(P=t,_(o));var a=L.indexOf(p(z.location));-1!==a&&(L[a]=t),C({action:n,location:r})}}))},go:D,goBack:function(){D(-1)},goForward:function(){D(1)},block:function(e){void 0===e&&(e=!1);var t=O.setPrompt(e);return B||(F(1),B=!0),function(){return B&&(B=!1,F(-1)),t()}},listen:function(e){var t=O.appendListener(e);return F(1),function(){F(-1),t()}}};return z}function O(e,t,n){return Math.min(Math.max(e,t),n)}function C(e){void 0===e&&(e={});var t=e,n=t.getUserConfirmation,o=t.initialEntries,a=void 0===o?["/"]:o,s=t.initialIndex,i=void 0===s?0:s,l=t.keyLength,c=void 0===l?6:l,u=g();function d(e){(0,r.A)(w,e),w.length=w.entries.length,u.notifyListeners(w.location,w.action)}function m(){return Math.random().toString(36).substr(2,c)}var h=O(i,0,a.length-1),b=a.map((function(e){return f(e,void 0,"string"==typeof e?m():e.key||m())})),v=p;function y(e){var t=O(w.index+e,0,w.entries.length-1),r=w.entries[t];u.confirmTransitionTo(r,"POP",n,(function(e){e?d({action:"POP",location:r,index:t}):d()}))}var w={length:b.length,action:"POP",location:b[h],index:h,entries:b,createHref:v,push:function(e,t){var r="PUSH",o=f(e,t,m(),w.location);u.confirmTransitionTo(o,r,n,(function(e){if(e){var t=w.index+1,n=w.entries.slice(0);n.length>t?n.splice(t,n.length-t,o):n.push(o),d({action:r,location:o,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",o=f(e,t,m(),w.location);u.confirmTransitionTo(o,r,n,(function(e){e&&(w.entries[w.index]=o,d({action:r,location:o}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t<w.entries.length},block:function(e){return void 0===e&&(e=!1),u.setPrompt(e)},listen:function(e){return u.appendListener(e)}};return w}},4146:(e,t,n)=>{"use strict";var r=n(4363),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function l(e){return r.isMemo(e)?s:i[e.$$typeof]||o}i[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[r.Memo]=s;var c=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,g=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(g){var o=f(n);o&&o!==g&&e(t,o,r)}var s=u(n);d&&(s=s.concat(d(n)));for(var i=l(t),m=l(n),h=0;h<s.length;++h){var b=s[h];if(!(a[b]||r&&r[b]||m&&m[b]||i&&i[b])){var v=p(n,b);try{c(t,b,v)}catch(y){}}}}return t}},311:e=>{"use strict";e.exports=function(e,t,n,r,o,a,s,i){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,a,s,i],u=0;(l=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},4634:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},119:(e,t,n)=>{"use strict";n.r(t)},1043:(e,t,n)=>{"use strict";n.r(t)},5947:function(e,t,n){var r,o;r=function(){var e,t,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function o(e,t,n){return e<t?t:e>n?n:e}function a(e){return 100*(-1+e)}function s(e,t,n){var o;return(o="translate3d"===r.positionUsing?{transform:"translate3d("+a(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+a(e)+"%,0)"}:{"margin-left":a(e)+"%"}).transition="all "+t+"ms "+n,o}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=o(e,r.minimum,1),n.status=1===e?null:e;var a=n.render(!t),c=a.querySelector(r.barSelector),u=r.speed,d=r.easing;return a.offsetWidth,i((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),l(c,s(e,u,d)),1===e?(l(a,{transition:"none",opacity:1}),a.offsetWidth,setTimeout((function(){l(a,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*o(Math.random()*t,.1,.95)),t=o(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var o,s=t.querySelector(r.barSelector),i=e?"-100":a(n.status||0),c=document.querySelector(r.parent);return l(s,{transition:"all 0 linear",transform:"translate3d("+i+"%,0,0)"}),r.showSpinner||(o=t.querySelector(r.spinnerSelector))&&f(o),c!=document.body&&u(c,"nprogress-custom-parent"),c.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&f(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var i=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),l=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,o=e.length,a=t.charAt(0).toUpperCase()+t.slice(1);o--;)if((r=e[o]+a)in n)return r;return t}function o(e){return e=n(e),t[e]||(t[e]=r(e))}function a(e,t,n){t=o(t),e.style[t]=n}return function(e,t){var n,r,o=arguments;if(2==o.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&a(e,n,r);else a(e,o[1],o[2])}}();function c(e,t){return("string"==typeof e?e:p(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=p(e),r=n+t;c(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=p(e);c(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function f(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(o="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=o)},6969:e=>{e.exports&&(e.exports={core:{meta:{path:"components/prism-core.js",option:"mandatory"},core:"Core"},themes:{meta:{path:"themes/{id}.css",link:"index.html?theme={id}",exclusive:!0},prism:{title:"Default",option:"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{title:"Okaidia",owner:"ocodia"},"prism-twilight":{title:"Twilight",owner:"remybach"},"prism-coy":{title:"Coy",owner:"tshedor"},"prism-solarizedlight":{title:"Solarized Light",owner:"hectormatos2011 "},"prism-tomorrow":{title:"Tomorrow Night",owner:"Rosey"}},languages:{meta:{path:"components/prism-{id}",noCSS:!0,examplesPath:"examples/prism-{id}",addCheckAll:!0},markup:{title:"Markup",alias:["html","xml","svg","mathml","ssml","atom","rss"],aliasTitles:{html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",atom:"Atom",rss:"RSS"},option:"default"},css:{title:"CSS",option:"default",modify:"markup"},clike:{title:"C-like",option:"default"},javascript:{title:"JavaScript",require:"clike",modify:"markup",optional:"regex",alias:"js",option:"default"},abap:{title:"ABAP",owner:"dellagustin"},abnf:{title:"ABNF",owner:"RunDevelopment"},actionscript:{title:"ActionScript",require:"javascript",modify:"markup",owner:"Golmote"},ada:{title:"Ada",owner:"Lucretia"},agda:{title:"Agda",owner:"xy-ren"},al:{title:"AL",owner:"RunDevelopment"},antlr4:{title:"ANTLR4",alias:"g4",owner:"RunDevelopment"},apacheconf:{title:"Apache Configuration",owner:"GuiTeK"},apex:{title:"Apex",require:["clike","sql"],owner:"RunDevelopment"},apl:{title:"APL",owner:"ngn"},applescript:{title:"AppleScript",owner:"Golmote"},aql:{title:"AQL",owner:"RunDevelopment"},arduino:{title:"Arduino",require:"cpp",alias:"ino",owner:"dkern"},arff:{title:"ARFF",owner:"Golmote"},armasm:{title:"ARM Assembly",alias:"arm-asm",owner:"RunDevelopment"},arturo:{title:"Arturo",alias:"art",optional:["bash","css","javascript","markup","markdown","sql"],owner:"drkameleon"},asciidoc:{alias:"adoc",title:"AsciiDoc",owner:"Golmote"},aspnet:{title:"ASP.NET (C#)",require:["markup","csharp"],owner:"nauzilus"},asm6502:{title:"6502 Assembly",owner:"kzurawel"},asmatmel:{title:"Atmel AVR Assembly",owner:"cerkit"},autohotkey:{title:"AutoHotkey",owner:"aviaryan"},autoit:{title:"AutoIt",owner:"Golmote"},avisynth:{title:"AviSynth",alias:"avs",owner:"Zinfidel"},"avro-idl":{title:"Avro IDL",alias:"avdl",owner:"RunDevelopment"},awk:{title:"AWK",alias:"gawk",aliasTitles:{gawk:"GAWK"},owner:"RunDevelopment"},bash:{title:"Bash",alias:["sh","shell"],aliasTitles:{sh:"Shell",shell:"Shell"},owner:"zeitgeist87"},basic:{title:"BASIC",owner:"Golmote"},batch:{title:"Batch",owner:"Golmote"},bbcode:{title:"BBcode",alias:"shortcode",aliasTitles:{shortcode:"Shortcode"},owner:"RunDevelopment"},bbj:{title:"BBj",owner:"hyyan"},bicep:{title:"Bicep",owner:"johnnyreilly"},birb:{title:"Birb",require:"clike",owner:"Calamity210"},bison:{title:"Bison",require:"c",owner:"Golmote"},bnf:{title:"BNF",alias:"rbnf",aliasTitles:{rbnf:"RBNF"},owner:"RunDevelopment"},bqn:{title:"BQN",owner:"yewscion"},brainfuck:{title:"Brainfuck",owner:"Golmote"},brightscript:{title:"BrightScript",owner:"RunDevelopment"},bro:{title:"Bro",owner:"wayward710"},bsl:{title:"BSL (1C:Enterprise)",alias:"oscript",aliasTitles:{oscript:"OneScript"},owner:"Diversus23"},c:{title:"C",require:"clike",owner:"zeitgeist87"},csharp:{title:"C#",require:"clike",alias:["cs","dotnet"],owner:"mvalipour"},cpp:{title:"C++",require:"c",owner:"zeitgeist87"},cfscript:{title:"CFScript",require:"clike",alias:"cfc",owner:"mjclemente"},chaiscript:{title:"ChaiScript",require:["clike","cpp"],owner:"RunDevelopment"},cil:{title:"CIL",owner:"sbrl"},cilkc:{title:"Cilk/C",require:"c",alias:"cilk-c",owner:"OpenCilk"},cilkcpp:{title:"Cilk/C++",require:"cpp",alias:["cilk-cpp","cilk"],owner:"OpenCilk"},clojure:{title:"Clojure",owner:"troglotit"},cmake:{title:"CMake",owner:"mjrogozinski"},cobol:{title:"COBOL",owner:"RunDevelopment"},coffeescript:{title:"CoffeeScript",require:"javascript",alias:"coffee",owner:"R-osey"},concurnas:{title:"Concurnas",alias:"conc",owner:"jasontatton"},csp:{title:"Content-Security-Policy",owner:"ScottHelme"},cooklang:{title:"Cooklang",owner:"ahue"},coq:{title:"Coq",owner:"RunDevelopment"},crystal:{title:"Crystal",require:"ruby",owner:"MakeNowJust"},"css-extras":{title:"CSS Extras",require:"css",modify:"css",owner:"milesj"},csv:{title:"CSV",owner:"RunDevelopment"},cue:{title:"CUE",owner:"RunDevelopment"},cypher:{title:"Cypher",owner:"RunDevelopment"},d:{title:"D",require:"clike",owner:"Golmote"},dart:{title:"Dart",require:"clike",owner:"Golmote"},dataweave:{title:"DataWeave",owner:"machaval"},dax:{title:"DAX",owner:"peterbud"},dhall:{title:"Dhall",owner:"RunDevelopment"},diff:{title:"Diff",owner:"uranusjr"},django:{title:"Django/Jinja2",require:"markup-templating",alias:"jinja2",owner:"romanvm"},"dns-zone-file":{title:"DNS zone file",owner:"RunDevelopment",alias:"dns-zone"},docker:{title:"Docker",alias:"dockerfile",owner:"JustinBeckwith"},dot:{title:"DOT (Graphviz)",alias:"gv",optional:"markup",owner:"RunDevelopment"},ebnf:{title:"EBNF",owner:"RunDevelopment"},editorconfig:{title:"EditorConfig",owner:"osipxd"},eiffel:{title:"Eiffel",owner:"Conaclos"},ejs:{title:"EJS",require:["javascript","markup-templating"],owner:"RunDevelopment",alias:"eta",aliasTitles:{eta:"Eta"}},elixir:{title:"Elixir",owner:"Golmote"},elm:{title:"Elm",owner:"zwilias"},etlua:{title:"Embedded Lua templating",require:["lua","markup-templating"],owner:"RunDevelopment"},erb:{title:"ERB",require:["ruby","markup-templating"],owner:"Golmote"},erlang:{title:"Erlang",owner:"Golmote"},"excel-formula":{title:"Excel Formula",alias:["xlsx","xls"],owner:"RunDevelopment"},fsharp:{title:"F#",require:"clike",owner:"simonreynolds7"},factor:{title:"Factor",owner:"catb0t"},false:{title:"False",owner:"edukisto"},"firestore-security-rules":{title:"Firestore security rules",require:"clike",owner:"RunDevelopment"},flow:{title:"Flow",require:"javascript",owner:"Golmote"},fortran:{title:"Fortran",owner:"Golmote"},ftl:{title:"FreeMarker Template Language",require:"markup-templating",owner:"RunDevelopment"},gml:{title:"GameMaker Language",alias:"gamemakerlanguage",require:"clike",owner:"LiarOnce"},gap:{title:"GAP (CAS)",owner:"RunDevelopment"},gcode:{title:"G-code",owner:"RunDevelopment"},gdscript:{title:"GDScript",owner:"RunDevelopment"},gedcom:{title:"GEDCOM",owner:"Golmote"},gettext:{title:"gettext",alias:"po",owner:"RunDevelopment"},gherkin:{title:"Gherkin",owner:"hason"},git:{title:"Git",owner:"lgiraudel"},glsl:{title:"GLSL",require:"c",owner:"Golmote"},gn:{title:"GN",alias:"gni",owner:"RunDevelopment"},"linker-script":{title:"GNU Linker Script",alias:"ld",owner:"RunDevelopment"},go:{title:"Go",require:"clike",owner:"arnehormann"},"go-module":{title:"Go module",alias:"go-mod",owner:"RunDevelopment"},gradle:{title:"Gradle",require:"clike",owner:"zeabdelkhalek-badido18"},graphql:{title:"GraphQL",optional:"markdown",owner:"Golmote"},groovy:{title:"Groovy",require:"clike",owner:"robfletcher"},haml:{title:"Haml",require:"ruby",optional:["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],owner:"Golmote"},handlebars:{title:"Handlebars",require:"markup-templating",alias:["hbs","mustache"],aliasTitles:{mustache:"Mustache"},owner:"Golmote"},haskell:{title:"Haskell",alias:"hs",owner:"bholst"},haxe:{title:"Haxe",require:"clike",optional:"regex",owner:"Golmote"},hcl:{title:"HCL",owner:"outsideris"},hlsl:{title:"HLSL",require:"c",owner:"RunDevelopment"},hoon:{title:"Hoon",owner:"matildepark"},http:{title:"HTTP",optional:["csp","css","hpkp","hsts","javascript","json","markup","uri"],owner:"danielgtaylor"},hpkp:{title:"HTTP Public-Key-Pins",owner:"ScottHelme"},hsts:{title:"HTTP Strict-Transport-Security",owner:"ScottHelme"},ichigojam:{title:"IchigoJam",owner:"BlueCocoa"},icon:{title:"Icon",owner:"Golmote"},"icu-message-format":{title:"ICU Message Format",owner:"RunDevelopment"},idris:{title:"Idris",alias:"idr",owner:"KeenS",require:"haskell"},ignore:{title:".ignore",owner:"osipxd",alias:["gitignore","hgignore","npmignore"],aliasTitles:{gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore"}},inform7:{title:"Inform 7",owner:"Golmote"},ini:{title:"Ini",owner:"aviaryan"},io:{title:"Io",owner:"AlesTsurko"},j:{title:"J",owner:"Golmote"},java:{title:"Java",require:"clike",owner:"sherblot"},javadoc:{title:"JavaDoc",require:["markup","java","javadoclike"],modify:"java",optional:"scala",owner:"RunDevelopment"},javadoclike:{title:"JavaDoc-like",modify:["java","javascript","php"],owner:"RunDevelopment"},javastacktrace:{title:"Java stack trace",owner:"RunDevelopment"},jexl:{title:"Jexl",owner:"czosel"},jolie:{title:"Jolie",require:"clike",owner:"thesave"},jq:{title:"JQ",owner:"RunDevelopment"},jsdoc:{title:"JSDoc",require:["javascript","javadoclike","typescript"],modify:"javascript",optional:["actionscript","coffeescript"],owner:"RunDevelopment"},"js-extras":{title:"JS Extras",require:"javascript",modify:"javascript",optional:["actionscript","coffeescript","flow","n4js","typescript"],owner:"RunDevelopment"},json:{title:"JSON",alias:"webmanifest",aliasTitles:{webmanifest:"Web App Manifest"},owner:"CupOfTea696"},json5:{title:"JSON5",require:"json",owner:"RunDevelopment"},jsonp:{title:"JSONP",require:"json",owner:"RunDevelopment"},jsstacktrace:{title:"JS stack trace",owner:"sbrl"},"js-templates":{title:"JS Templates",require:"javascript",modify:"javascript",optional:["css","css-extras","graphql","markdown","markup","sql"],owner:"RunDevelopment"},julia:{title:"Julia",owner:"cdagnino"},keepalived:{title:"Keepalived Configure",owner:"dev-itsheng"},keyman:{title:"Keyman",owner:"mcdurdin"},kotlin:{title:"Kotlin",alias:["kt","kts"],aliasTitles:{kts:"Kotlin Script"},require:"clike",owner:"Golmote"},kumir:{title:"KuMir (\u041a\u0443\u041c\u0438\u0440)",alias:"kum",owner:"edukisto"},kusto:{title:"Kusto",owner:"RunDevelopment"},latex:{title:"LaTeX",alias:["tex","context"],aliasTitles:{tex:"TeX",context:"ConTeXt"},owner:"japborst"},latte:{title:"Latte",require:["clike","markup-templating","php"],owner:"nette"},less:{title:"Less",require:"css",optional:"css-extras",owner:"Golmote"},lilypond:{title:"LilyPond",require:"scheme",alias:"ly",owner:"RunDevelopment"},liquid:{title:"Liquid",require:"markup-templating",owner:"cinhtau"},lisp:{title:"Lisp",alias:["emacs","elisp","emacs-lisp"],owner:"JuanCaicedo"},livescript:{title:"LiveScript",owner:"Golmote"},llvm:{title:"LLVM IR",owner:"porglezomp"},log:{title:"Log file",optional:"javastacktrace",owner:"RunDevelopment"},lolcode:{title:"LOLCODE",owner:"Golmote"},lua:{title:"Lua",owner:"Golmote"},magma:{title:"Magma (CAS)",owner:"RunDevelopment"},makefile:{title:"Makefile",owner:"Golmote"},markdown:{title:"Markdown",require:"markup",optional:"yaml",alias:"md",owner:"Golmote"},"markup-templating":{title:"Markup templating",require:"markup",owner:"Golmote"},mata:{title:"Mata",owner:"RunDevelopment"},matlab:{title:"MATLAB",owner:"Golmote"},maxscript:{title:"MAXScript",owner:"RunDevelopment"},mel:{title:"MEL",owner:"Golmote"},mermaid:{title:"Mermaid",owner:"RunDevelopment"},metafont:{title:"METAFONT",owner:"LaeriExNihilo"},mizar:{title:"Mizar",owner:"Golmote"},mongodb:{title:"MongoDB",owner:"airs0urce",require:"javascript"},monkey:{title:"Monkey",owner:"Golmote"},moonscript:{title:"MoonScript",alias:"moon",owner:"RunDevelopment"},n1ql:{title:"N1QL",owner:"TMWilds"},n4js:{title:"N4JS",require:"javascript",optional:"jsdoc",alias:"n4jsd",owner:"bsmith-n4"},"nand2tetris-hdl":{title:"Nand To Tetris HDL",owner:"stephanmax"},naniscript:{title:"Naninovel Script",owner:"Elringus",alias:"nani"},nasm:{title:"NASM",owner:"rbmj"},neon:{title:"NEON",owner:"nette"},nevod:{title:"Nevod",owner:"nezaboodka"},nginx:{title:"nginx",owner:"volado"},nim:{title:"Nim",owner:"Golmote"},nix:{title:"Nix",owner:"Golmote"},nsis:{title:"NSIS",owner:"idleberg"},objectivec:{title:"Objective-C",require:"c",alias:"objc",owner:"uranusjr"},ocaml:{title:"OCaml",owner:"Golmote"},odin:{title:"Odin",owner:"edukisto"},opencl:{title:"OpenCL",require:"c",modify:["c","cpp"],owner:"Milania1"},openqasm:{title:"OpenQasm",alias:"qasm",owner:"RunDevelopment"},oz:{title:"Oz",owner:"Golmote"},parigp:{title:"PARI/GP",owner:"Golmote"},parser:{title:"Parser",require:"markup",owner:"Golmote"},pascal:{title:"Pascal",alias:"objectpascal",aliasTitles:{objectpascal:"Object Pascal"},owner:"Golmote"},pascaligo:{title:"Pascaligo",owner:"DefinitelyNotAGoat"},psl:{title:"PATROL Scripting Language",owner:"bertysentry"},pcaxis:{title:"PC-Axis",alias:"px",owner:"RunDevelopment"},peoplecode:{title:"PeopleCode",alias:"pcode",owner:"RunDevelopment"},perl:{title:"Perl",owner:"Golmote"},php:{title:"PHP",require:"markup-templating",owner:"milesj"},phpdoc:{title:"PHPDoc",require:["php","javadoclike"],modify:"php",owner:"RunDevelopment"},"php-extras":{title:"PHP Extras",require:"php",modify:"php",owner:"milesj"},"plant-uml":{title:"PlantUML",alias:"plantuml",owner:"RunDevelopment"},plsql:{title:"PL/SQL",require:"sql",owner:"Golmote"},powerquery:{title:"PowerQuery",alias:["pq","mscript"],owner:"peterbud"},powershell:{title:"PowerShell",owner:"nauzilus"},processing:{title:"Processing",require:"clike",owner:"Golmote"},prolog:{title:"Prolog",owner:"Golmote"},promql:{title:"PromQL",owner:"arendjr"},properties:{title:".properties",owner:"Golmote"},protobuf:{title:"Protocol Buffers",require:"clike",owner:"just-boris"},pug:{title:"Pug",require:["markup","javascript"],optional:["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],owner:"Golmote"},puppet:{title:"Puppet",owner:"Golmote"},pure:{title:"Pure",optional:["c","cpp","fortran"],owner:"Golmote"},purebasic:{title:"PureBasic",require:"clike",alias:"pbfasm",owner:"HeX0R101"},purescript:{title:"PureScript",require:"haskell",alias:"purs",owner:"sriharshachilakapati"},python:{title:"Python",alias:"py",owner:"multipetros"},qsharp:{title:"Q#",require:"clike",alias:"qs",owner:"fedonman"},q:{title:"Q (kdb+ database)",owner:"Golmote"},qml:{title:"QML",require:"javascript",owner:"RunDevelopment"},qore:{title:"Qore",require:"clike",owner:"temnroegg"},r:{title:"R",owner:"Golmote"},racket:{title:"Racket",require:"scheme",alias:"rkt",owner:"RunDevelopment"},cshtml:{title:"Razor C#",alias:"razor",require:["markup","csharp"],optional:["css","css-extras","javascript","js-extras"],owner:"RunDevelopment"},jsx:{title:"React JSX",require:["markup","javascript"],optional:["jsdoc","js-extras","js-templates"],owner:"vkbansal"},tsx:{title:"React TSX",require:["jsx","typescript"]},reason:{title:"Reason",require:"clike",owner:"Golmote"},regex:{title:"Regex",owner:"RunDevelopment"},rego:{title:"Rego",owner:"JordanSh"},renpy:{title:"Ren'py",alias:"rpy",owner:"HyuchiaDiego"},rescript:{title:"ReScript",alias:"res",owner:"vmarcosp"},rest:{title:"reST (reStructuredText)",owner:"Golmote"},rip:{title:"Rip",owner:"ravinggenius"},roboconf:{title:"Roboconf",owner:"Golmote"},robotframework:{title:"Robot Framework",alias:"robot",owner:"RunDevelopment"},ruby:{title:"Ruby",require:"clike",alias:"rb",owner:"samflores"},rust:{title:"Rust",owner:"Golmote"},sas:{title:"SAS",optional:["groovy","lua","sql"],owner:"Golmote"},sass:{title:"Sass (Sass)",require:"css",optional:"css-extras",owner:"Golmote"},scss:{title:"Sass (SCSS)",require:"css",optional:"css-extras",owner:"MoOx"},scala:{title:"Scala",require:"java",owner:"jozic"},scheme:{title:"Scheme",owner:"bacchus123"},"shell-session":{title:"Shell session",require:"bash",alias:["sh-session","shellsession"],owner:"RunDevelopment"},smali:{title:"Smali",owner:"RunDevelopment"},smalltalk:{title:"Smalltalk",owner:"Golmote"},smarty:{title:"Smarty",require:"markup-templating",optional:"php",owner:"Golmote"},sml:{title:"SML",alias:"smlnj",aliasTitles:{smlnj:"SML/NJ"},owner:"RunDevelopment"},solidity:{title:"Solidity (Ethereum)",alias:"sol",require:"clike",owner:"glachaud"},"solution-file":{title:"Solution file",alias:"sln",owner:"RunDevelopment"},soy:{title:"Soy (Closure Template)",require:"markup-templating",owner:"Golmote"},sparql:{title:"SPARQL",require:"turtle",owner:"Triply-Dev",alias:"rq"},"splunk-spl":{title:"Splunk SPL",owner:"RunDevelopment"},sqf:{title:"SQF: Status Quo Function (Arma 3)",require:"clike",owner:"RunDevelopment"},sql:{title:"SQL",owner:"multipetros"},squirrel:{title:"Squirrel",require:"clike",owner:"RunDevelopment"},stan:{title:"Stan",owner:"RunDevelopment"},stata:{title:"Stata Ado",require:["mata","java","python"],owner:"RunDevelopment"},iecst:{title:"Structured Text (IEC 61131-3)",owner:"serhioromano"},stylus:{title:"Stylus",owner:"vkbansal"},supercollider:{title:"SuperCollider",alias:"sclang",owner:"RunDevelopment"},swift:{title:"Swift",owner:"chrischares"},systemd:{title:"Systemd configuration file",owner:"RunDevelopment"},"t4-templating":{title:"T4 templating",owner:"RunDevelopment"},"t4-cs":{title:"T4 Text Templates (C#)",require:["t4-templating","csharp"],alias:"t4",owner:"RunDevelopment"},"t4-vb":{title:"T4 Text Templates (VB)",require:["t4-templating","vbnet"],owner:"RunDevelopment"},tap:{title:"TAP",owner:"isaacs",require:"yaml"},tcl:{title:"Tcl",owner:"PeterChaplin"},tt2:{title:"Template Toolkit 2",require:["clike","markup-templating"],owner:"gflohr"},textile:{title:"Textile",require:"markup",optional:"css",owner:"Golmote"},toml:{title:"TOML",owner:"RunDevelopment"},tremor:{title:"Tremor",alias:["trickle","troy"],owner:"darach",aliasTitles:{trickle:"trickle",troy:"troy"}},turtle:{title:"Turtle",alias:"trig",aliasTitles:{trig:"TriG"},owner:"jakubklimek"},twig:{title:"Twig",require:"markup-templating",owner:"brandonkelly"},typescript:{title:"TypeScript",require:"javascript",optional:"js-templates",alias:"ts",owner:"vkbansal"},typoscript:{title:"TypoScript",alias:"tsconfig",aliasTitles:{tsconfig:"TSConfig"},owner:"dkern"},unrealscript:{title:"UnrealScript",alias:["uscript","uc"],owner:"RunDevelopment"},uorazor:{title:"UO Razor Script",owner:"jaseowns"},uri:{title:"URI",alias:"url",aliasTitles:{url:"URL"},owner:"RunDevelopment"},v:{title:"V",require:"clike",owner:"taggon"},vala:{title:"Vala",require:"clike",optional:"regex",owner:"TemplarVolk"},vbnet:{title:"VB.Net",require:"basic",owner:"Bigsby"},velocity:{title:"Velocity",require:"markup",owner:"Golmote"},verilog:{title:"Verilog",owner:"a-rey"},vhdl:{title:"VHDL",owner:"a-rey"},vim:{title:"vim",owner:"westonganger"},"visual-basic":{title:"Visual Basic",alias:["vb","vba"],aliasTitles:{vba:"VBA"},owner:"Golmote"},warpscript:{title:"WarpScript",owner:"RunDevelopment"},wasm:{title:"WebAssembly",owner:"Golmote"},"web-idl":{title:"Web IDL",alias:"webidl",owner:"RunDevelopment"},wgsl:{title:"WGSL",owner:"Dr4gonthree"},wiki:{title:"Wiki markup",require:"markup",owner:"Golmote"},wolfram:{title:"Wolfram language",alias:["mathematica","nb","wl"],aliasTitles:{mathematica:"Mathematica",nb:"Mathematica Notebook"},owner:"msollami"},wren:{title:"Wren",owner:"clsource"},xeora:{title:"Xeora",require:"markup",alias:"xeoracube",aliasTitles:{xeoracube:"XeoraCube"},owner:"freakmaxi"},"xml-doc":{title:"XML doc (.net)",require:"markup",modify:["csharp","fsharp","vbnet"],owner:"RunDevelopment"},xojo:{title:"Xojo (REALbasic)",owner:"Golmote"},xquery:{title:"XQuery",require:"markup",owner:"Golmote"},yaml:{title:"YAML",alias:"yml",owner:"hason"},yang:{title:"YANG",owner:"RunDevelopment"},zig:{title:"Zig",owner:"RunDevelopment"}},plugins:{meta:{path:"plugins/{id}/prism-{id}",link:"plugins/{id}/"},"line-highlight":{title:"Line Highlight",description:"Highlights specific lines and/or line ranges."},"line-numbers":{title:"Line Numbers",description:"Line number at the beginning of code lines.",owner:"kuba-kubula"},"show-invisibles":{title:"Show Invisibles",description:"Show hidden characters such as tabs and line breaks.",optional:["autolinker","data-uri-highlight"]},autolinker:{title:"Autolinker",description:"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},wpd:{title:"WebPlatform Docs",description:'Makes tokens link to <a href="https://webplatform.github.io/docs/">WebPlatform.org documentation</a>. The links open in a new tab.'},"custom-class":{title:"Custom Class",description:"This plugin allows you to prefix Prism's default classes (<code>.comment</code> can become <code>.namespace--comment</code>) or replace them with your defined ones (like <code>.editor__comment</code>). You can even add new classes.",owner:"dvkndn",noCSS:!0},"file-highlight":{title:"File Highlight",description:"Fetch external files and highlight them with Prism. Used on the Prism website itself.",noCSS:!0},"show-language":{title:"Show Language",description:"Display the highlighted language in code blocks (inline code does not show the label).",owner:"nauzilus",noCSS:!0,require:"toolbar"},"jsonp-highlight":{title:"JSONP Highlight",description:"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).",noCSS:!0,owner:"nauzilus"},"highlight-keywords":{title:"Highlight Keywords",description:"Adds special CSS classes for each keyword for fine-grained highlighting.",owner:"vkbansal",noCSS:!0},"remove-initial-line-feed":{title:"Remove initial line feed",description:"Removes the initial line feed in code blocks.",owner:"Golmote",noCSS:!0},"inline-color":{title:"Inline color",description:"Adds a small inline preview for colors in style sheets.",require:"css-extras",owner:"RunDevelopment"},previewers:{title:"Previewers",description:"Previewers for angles, colors, gradients, easing and time.",require:"css-extras",owner:"Golmote"},autoloader:{title:"Autoloader",description:"Automatically loads the needed languages to highlight the code blocks.",owner:"Golmote",noCSS:!0},"keep-markup":{title:"Keep Markup",description:"Prevents custom markup from being dropped out during highlighting.",owner:"Golmote",optional:"normalize-whitespace",noCSS:!0},"command-line":{title:"Command Line",description:"Display a command line with a prompt and, optionally, the output/response from the commands.",owner:"chriswells0"},"unescaped-markup":{title:"Unescaped Markup",description:"Write markup without having to escape anything."},"normalize-whitespace":{title:"Normalize Whitespace",description:"Supports multiple operations to normalize whitespace in code blocks.",owner:"zeitgeist87",optional:"unescaped-markup",noCSS:!0},"data-uri-highlight":{title:"Data-URI Highlight",description:"Highlights data-URI contents.",owner:"Golmote",noCSS:!0},toolbar:{title:"Toolbar",description:"Attach a toolbar for plugins to easily register buttons on the top of a code block.",owner:"mAAdhaTTah"},"copy-to-clipboard":{title:"Copy to Clipboard Button",description:"Add a button that copies the code block to the clipboard when clicked.",owner:"mAAdhaTTah",require:"toolbar",noCSS:!0},"download-button":{title:"Download Button",description:"A button in the toolbar of a code block adding a convenient way to download a code file.",owner:"Golmote",require:"toolbar",noCSS:!0},"match-braces":{title:"Match braces",description:"Highlights matching braces.",owner:"RunDevelopment"},"diff-highlight":{title:"Diff Highlight",description:"Highlights the code inside diff blocks.",owner:"RunDevelopment",require:"diff"},"filter-highlight-all":{title:"Filter highlightAll",description:"Filters the elements the <code>highlightAll</code> and <code>highlightAllUnder</code> methods actually highlight.",owner:"RunDevelopment",noCSS:!0},treeview:{title:"Treeview",description:"A language with special styles to highlight file system tree structures.",owner:"Golmote"}}})},8722:(e,t,n)=>{const r=n(6969),o=n(8380),a=new Set;function s(e){void 0===e?e=Object.keys(r.languages).filter((e=>"meta"!=e)):Array.isArray(e)||(e=[e]);const t=[...a,...Object.keys(Prism.languages)];o(r,e,t).load((e=>{if(!(e in r.languages))return void(s.silent||console.warn("Language does not exist: "+e));const t="./prism-"+e;delete n.c[n(3157).resolve(t)],delete Prism.languages[e],n(3157)(t),a.add(e)}))}s.silent=!1,e.exports=s},9700:()=>{!function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,o,a){if(n.language===r){var s=n.tokenStack=[];n.code=n.code.replace(o,(function(e){if("function"==typeof a&&!a(e))return e;for(var o,i=s.length;-1!==n.code.indexOf(o=t(r,i));)++i;return s[i]=e,o})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var o=0,a=Object.keys(n.tokenStack);!function s(i){for(var l=0;l<i.length&&!(o>=a.length);l++){var c=i[l];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=a[o],d=n.tokenStack[u],p="string"==typeof c?c:c.content,f=t(r,u),g=p.indexOf(f);if(g>-1){++o;var m=p.substring(0,g),h=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),b=p.substring(g+f.length),v=[];m&&v.push.apply(v,s([m])),v.push(h),b&&v.push.apply(v,s([b])),"string"==typeof c?i.splice.apply(i,[l,1].concat(v)):c.content=v}}else c.content&&s(c.content)}return i}(n.tokens)}}}})}(Prism)},8692:(e,t,n)=>{var r={"./":8722};function o(e){var t=a(e);return n(t)}function a(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=a,e.exports=o,o.id=8692},3157:(e,t,n)=>{var r={"./":8722};function o(e){var t=a(e);return n(t)}function a(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=a,e.exports=o,o.id=3157},8380:e=>{"use strict";var t=function(){var e=function(){};function t(e,t){Array.isArray(e)?e.forEach(t):null!=e&&t(e,0)}function n(e){for(var t={},n=0,r=e.length;n<r;n++)t[e[n]]=!0;return t}function r(e){var n={},r=[];function o(r,a){if(!(r in n)){a.push(r);var s=a.indexOf(r);if(s<a.length-1)throw new Error("Circular dependency: "+a.slice(s).join(" -> "));var i={},l=e[r];if(l){function c(t){if(!(t in e))throw new Error(r+" depends on an unknown component "+t);if(!(t in i))for(var s in o(t,a),i[t]=!0,n[t])i[s]=!0}t(l.require,c),t(l.optional,c),t(l.modify,c)}n[r]=i,a.pop()}}return function(e){var t=n[e];return t||(o(e,r),t=n[e]),t}}function o(e){for(var t in e)return!0;return!1}return function(a,s,i){var l=function(e){var t={};for(var n in e){var r=e[n];for(var o in r)if("meta"!=o){var a=r[o];t[o]="string"==typeof a?{title:a}:a}}return t}(a),c=function(e){var n;return function(r){if(r in e)return r;if(!n)for(var o in n={},e){var a=e[o];t(a&&a.alias,(function(t){if(t in n)throw new Error(t+" cannot be alias for both "+o+" and "+n[t]);if(t in e)throw new Error(t+" cannot be alias of "+o+" because it is a component.");n[t]=o}))}return n[r]||r}}(l);s=s.map(c),i=(i||[]).map(c);var u=n(s),d=n(i);s.forEach((function e(n){var r=l[n];t(r&&r.require,(function(t){t in d||(u[t]=!0,e(t))}))}));for(var p,f=r(l),g=u;o(g);){for(var m in p={},g){var h=l[m];t(h&&h.modify,(function(e){e in d&&(p[e]=!0)}))}for(var b in d)if(!(b in u))for(var v in f(b))if(v in u){p[b]=!0;break}for(var y in g=p)u[y]=!0}var w={getIds:function(){var e=[];return w.load((function(t){e.push(t)})),e},load:function(t,n){return function(t,n,r,o){var a=o?o.series:void 0,s=o?o.parallel:e,i={},l={};function c(e){if(e in i)return i[e];l[e]=!0;var o,u=[];for(var d in t(e))d in n&&u.push(d);if(0===u.length)o=r(e);else{var p=s(u.map((function(e){var t=c(e);return delete l[e],t})));a?o=a(p,(function(){return r(e)})):r(e)}return i[e]=o}for(var u in n)c(u);var d=[];for(var p in l)d.push(i[p]);return s(d)}(f,u,t,n)}};return w}}();e.exports=t},2694:(e,t,n)=>{"use strict";var r=n(6925);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,s){if(s!==r){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return n.PropTypes=n,n}},5556:(e,t,n)=>{e.exports=n(2694)()},6925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},2551:(e,t,n)=>{"use strict";var r=n(6540),o=n(9982);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function l(e,t){c(e,t),c(e+"Capture",t)}function c(e,t){for(i[e]=t,e=0;e<t.length;e++)s.add(t[e])}var u=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),d=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},g={};function m(e,t,n,r,o,a,s){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=s}var h={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){h[e]=new m(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];h[t]=new m(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){h[e]=new m(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){h[e]=new m(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){h[e]=new m(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){h[e]=new m(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){h[e]=new m(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){h[e]=new m(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){h[e]=new m(e,5,!1,e.toLowerCase(),null,!1,!1)}));var b=/[\-:]([a-z])/g;function v(e){return e[1].toUpperCase()}function y(e,t,n,r){var o=h.hasOwnProperty(t)?h[t]:null;(null!==o?0!==o.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,o,r)&&(n=null),r||null===o?function(e){return!!d.call(g,e)||!d.call(f,e)&&(p.test(e)?g[e]=!0:(f[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=null===n?3!==o.type&&"":n:(t=o.attributeName,r=o.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(o=o.type)||4===o&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(b,v);h[t]=new m(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(b,v);h[t]=new m(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(b,v);h[t]=new m(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){h[e]=new m(e,1,!1,e.toLowerCase(),null,!1,!1)})),h.xlinkHref=new m("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){h[e]=new m(e,1,!1,e.toLowerCase(),null,!0,!0)}));var w=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,x=Symbol.for("react.element"),j=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),O=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),I=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var R=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var N=Symbol.iterator;function L(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=N&&e[N]||e["@@iterator"])?e:null}var D,M=Object.assign;function F(e){if(void 0===D)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);D=t&&t[1]||""}return"\n"+D+e}var B=!1;function z(e,t){if(!e||B)return"";B=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&"string"==typeof c.stack){for(var o=c.stack.split("\n"),a=r.stack.split("\n"),s=o.length-1,i=a.length-1;1<=s&&0<=i&&o[s]!==a[i];)i--;for(;1<=s&&0<=i;s--,i--)if(o[s]!==a[i]){if(1!==s||1!==i)do{if(s--,0>--i||o[s]!==a[i]){var l="\n"+o[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=s&&0<=i);break}}}finally{B=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?F(e):""}function U(e){switch(e.tag){case 5:return F(e.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return e=z(e.type,!1);case 11:return e=z(e.type.render,!1);case 1:return e=z(e.type,!0);default:return""}}function q(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case k:return"Fragment";case j:return"Portal";case _:return"Profiler";case S:return"StrictMode";case A:return"Suspense";case P:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case O:return(e.displayName||"Context")+".Consumer";case E:return(e._context.displayName||"Context")+".Provider";case C:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case T:return null!==(t=e.displayName||null)?t:q(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return q(e(t))}catch(n){}}return null}function $(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return q(t);case 8:return t===S?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function H(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function V(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function G(e){e._valueTracker||(e._valueTracker=function(e){var t=V(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var o=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(e){r=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function W(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=V(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function K(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Q(e,t){var n=t.checked;return M({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function Y(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=H(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Z(e,t){null!=(t=t.checked)&&y(e,"checked",t,!1)}function J(e,t){Z(e,t);var n=H(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,n):t.hasOwnProperty("defaultValue")&&ee(e,t.type,H(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function X(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ee(e,t,n){"number"===t&&K(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var te=Array.isArray;function ne(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+H(n),t=null,o=0;o<e.length;o++){if(e[o].value===n)return e[o].selected=!0,void(r&&(e[o].defaultSelected=!0));null!==t||e[o].disabled||(t=e[o])}null!==t&&(t.selected=!0)}}function re(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(a(91));return M({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function oe(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(a(92));if(te(n)){if(1<n.length)throw Error(a(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:H(n)}}function ae(e,t){var n=H(t.value),r=H(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function se(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function ie(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function le(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?ie(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var ce,ue,de=(ue=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((ce=ce||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ce.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return ue(e,t)}))}:ue);function pe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var fe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ge=["Webkit","ms","Moz","O"];function me(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||fe.hasOwnProperty(e)&&fe[e]?(""+t).trim():t+"px"}function he(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),o=me(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}Object.keys(fe).forEach((function(e){ge.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fe[t]=fe[e]}))}));var be=M({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ve(e,t){if(t){if(be[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(a(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(a(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(a(62))}}function ye(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var we=null;function xe(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var je=null,ke=null,Se=null;function _e(e){if(e=wo(e)){if("function"!=typeof je)throw Error(a(280));var t=e.stateNode;t&&(t=jo(t),je(e.stateNode,e.type,t))}}function Ee(e){ke?Se?Se.push(e):Se=[e]:ke=e}function Oe(){if(ke){var e=ke,t=Se;if(Se=ke=null,_e(e),t)for(e=0;e<t.length;e++)_e(t[e])}}function Ce(e,t){return e(t)}function Ae(){}var Pe=!1;function Te(e,t,n){if(Pe)return e(t,n);Pe=!0;try{return Ce(e,t,n)}finally{Pe=!1,(null!==ke||null!==Se)&&(Ae(),Oe())}}function Ie(e,t){var n=e.stateNode;if(null===n)return null;var r=jo(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(a(231,t,typeof n));return n}var Re=!1;if(u)try{var Ne={};Object.defineProperty(Ne,"passive",{get:function(){Re=!0}}),window.addEventListener("test",Ne,Ne),window.removeEventListener("test",Ne,Ne)}catch(ue){Re=!1}function Le(e,t,n,r,o,a,s,i,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var De=!1,Me=null,Fe=!1,Be=null,ze={onError:function(e){De=!0,Me=e}};function Ue(e,t,n,r,o,a,s,i,l){De=!1,Me=null,Le.apply(ze,arguments)}function qe(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function $e(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function He(e){if(qe(e)!==e)throw Error(a(188))}function Ve(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=qe(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(null===o)break;var s=o.alternate;if(null===s){if(null!==(r=o.return)){n=r;continue}break}if(o.child===s.child){for(s=o.child;s;){if(s===n)return He(o),e;if(s===r)return He(o),t;s=s.sibling}throw Error(a(188))}if(n.return!==r.return)n=o,r=s;else{for(var i=!1,l=o.child;l;){if(l===n){i=!0,n=o,r=s;break}if(l===r){i=!0,r=o,n=s;break}l=l.sibling}if(!i){for(l=s.child;l;){if(l===n){i=!0,n=s,r=o;break}if(l===r){i=!0,r=s,n=o;break}l=l.sibling}if(!i)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}(e))?Ge(e):null}function Ge(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Ge(e);if(null!==t)return t;e=e.sibling}return null}var We=o.unstable_scheduleCallback,Ke=o.unstable_cancelCallback,Qe=o.unstable_shouldYield,Ye=o.unstable_requestPaint,Ze=o.unstable_now,Je=o.unstable_getCurrentPriorityLevel,Xe=o.unstable_ImmediatePriority,et=o.unstable_UserBlockingPriority,tt=o.unstable_NormalPriority,nt=o.unstable_LowPriority,rt=o.unstable_IdlePriority,ot=null,at=null;var st=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(it(e)/lt|0)|0},it=Math.log,lt=Math.LN2;var ct=64,ut=4194304;function dt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function pt(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,o=e.suspendedLanes,a=e.pingedLanes,s=268435455&n;if(0!==s){var i=s&~o;0!==i?r=dt(i):0!==(a&=s)&&(r=dt(a))}else 0!==(s=n&~o)?r=dt(s):0!==a&&(r=dt(a));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&o)&&((o=r&-r)>=(a=t&-t)||16===o&&0!=(4194240&a)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)o=1<<(n=31-st(t)),r|=e[n],t&=~o;return r}function ft(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function gt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function mt(){var e=ct;return 0==(4194240&(ct<<=1))&&(ct=64),e}function ht(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function bt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-st(t)]=n}function vt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-st(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var yt=0;function wt(e){return 1<(e&=-e)?4<e?0!=(268435455&e)?16:536870912:4:1}var xt,jt,kt,St,_t,Et=!1,Ot=[],Ct=null,At=null,Pt=null,Tt=new Map,It=new Map,Rt=[],Nt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Lt(e,t){switch(e){case"focusin":case"focusout":Ct=null;break;case"dragenter":case"dragleave":At=null;break;case"mouseover":case"mouseout":Pt=null;break;case"pointerover":case"pointerout":Tt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":It.delete(t.pointerId)}}function Dt(e,t,n,r,o,a){return null===e||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[o]},null!==t&&(null!==(t=wo(t))&&jt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==o&&-1===t.indexOf(o)&&t.push(o),e)}function Mt(e){var t=yo(e.target);if(null!==t){var n=qe(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=$e(n)))return e.blockedOn=t,void _t(e.priority,(function(){kt(n)}))}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Ft(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Qt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=wo(n))&&jt(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);we=r,n.target.dispatchEvent(r),we=null,t.shift()}return!0}function Bt(e,t,n){Ft(e)&&n.delete(t)}function zt(){Et=!1,null!==Ct&&Ft(Ct)&&(Ct=null),null!==At&&Ft(At)&&(At=null),null!==Pt&&Ft(Pt)&&(Pt=null),Tt.forEach(Bt),It.forEach(Bt)}function Ut(e,t){e.blockedOn===t&&(e.blockedOn=null,Et||(Et=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,zt)))}function qt(e){function t(t){return Ut(t,e)}if(0<Ot.length){Ut(Ot[0],e);for(var n=1;n<Ot.length;n++){var r=Ot[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==Ct&&Ut(Ct,e),null!==At&&Ut(At,e),null!==Pt&&Ut(Pt,e),Tt.forEach(t),It.forEach(t),n=0;n<Rt.length;n++)(r=Rt[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Rt.length&&null===(n=Rt[0]).blockedOn;)Mt(n),null===n.blockedOn&&Rt.shift()}var $t=w.ReactCurrentBatchConfig,Ht=!0;function Vt(e,t,n,r){var o=yt,a=$t.transition;$t.transition=null;try{yt=1,Wt(e,t,n,r)}finally{yt=o,$t.transition=a}}function Gt(e,t,n,r){var o=yt,a=$t.transition;$t.transition=null;try{yt=4,Wt(e,t,n,r)}finally{yt=o,$t.transition=a}}function Wt(e,t,n,r){if(Ht){var o=Qt(e,t,n,r);if(null===o)Hr(e,t,r,Kt,n),Lt(e,r);else if(function(e,t,n,r,o){switch(t){case"focusin":return Ct=Dt(Ct,e,t,n,r,o),!0;case"dragenter":return At=Dt(At,e,t,n,r,o),!0;case"mouseover":return Pt=Dt(Pt,e,t,n,r,o),!0;case"pointerover":var a=o.pointerId;return Tt.set(a,Dt(Tt.get(a)||null,e,t,n,r,o)),!0;case"gotpointercapture":return a=o.pointerId,It.set(a,Dt(It.get(a)||null,e,t,n,r,o)),!0}return!1}(o,e,t,n,r))r.stopPropagation();else if(Lt(e,r),4&t&&-1<Nt.indexOf(e)){for(;null!==o;){var a=wo(o);if(null!==a&&xt(a),null===(a=Qt(e,t,n,r))&&Hr(e,t,r,Kt,n),a===o)break;o=a}null!==o&&r.stopPropagation()}else Hr(e,t,r,null,n)}}var Kt=null;function Qt(e,t,n,r){if(Kt=null,null!==(e=yo(e=xe(r))))if(null===(t=qe(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=$e(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Kt=e,null}function Yt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Je()){case Xe:return 1;case et:return 4;case tt:case nt:return 16;case rt:return 536870912;default:return 16}default:return 16}}var Zt=null,Jt=null,Xt=null;function en(){if(Xt)return Xt;var e,t,n=Jt,r=n.length,o="value"in Zt?Zt.value:Zt.textContent,a=o.length;for(e=0;e<r&&n[e]===o[e];e++);var s=r-e;for(t=1;t<=s&&n[r-t]===o[a-t];t++);return Xt=o.slice(e,1<t?1-t:void 0)}function tn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function nn(){return!0}function rn(){return!1}function on(e){function t(t,n,r,o,a){for(var s in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=o,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(s)&&(t=e[s],this[s]=t?t(o):o[s]);return this.isDefaultPrevented=(null!=o.defaultPrevented?o.defaultPrevented:!1===o.returnValue)?nn:rn,this.isPropagationStopped=rn,this}return M(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var an,sn,ln,cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},un=on(cn),dn=M({},cn,{view:0,detail:0}),pn=on(dn),fn=M({},dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_n,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ln&&(ln&&"mousemove"===e.type?(an=e.screenX-ln.screenX,sn=e.screenY-ln.screenY):sn=an=0,ln=e),an)},movementY:function(e){return"movementY"in e?e.movementY:sn}}),gn=on(fn),mn=on(M({},fn,{dataTransfer:0})),hn=on(M({},dn,{relatedTarget:0})),bn=on(M({},cn,{animationName:0,elapsedTime:0,pseudoElement:0})),vn=M({},cn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yn=on(vn),wn=on(M({},cn,{data:0})),xn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},kn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=kn[e])&&!!t[e]}function _n(){return Sn}var En=M({},dn,{key:function(e){if(e.key){var t=xn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?jn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_n,charCode:function(e){return"keypress"===e.type?tn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),On=on(En),Cn=on(M({},fn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),An=on(M({},dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_n})),Pn=on(M({},cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Tn=M({},fn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),In=on(Tn),Rn=[9,13,27,32],Nn=u&&"CompositionEvent"in window,Ln=null;u&&"documentMode"in document&&(Ln=document.documentMode);var Dn=u&&"TextEvent"in window&&!Ln,Mn=u&&(!Nn||Ln&&8<Ln&&11>=Ln),Fn=String.fromCharCode(32),Bn=!1;function zn(e,t){switch(e){case"keyup":return-1!==Rn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Un(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var qn=!1;var $n={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Hn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!$n[e.type]:"textarea"===t}function Vn(e,t,n,r){Ee(r),0<(t=Gr(t,"onChange")).length&&(n=new un("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Gn=null,Wn=null;function Kn(e){Fr(e,0)}function Qn(e){if(W(xo(e)))return e}function Yn(e,t){if("change"===e)return t}var Zn=!1;if(u){var Jn;if(u){var Xn="oninput"in document;if(!Xn){var er=document.createElement("div");er.setAttribute("oninput","return;"),Xn="function"==typeof er.oninput}Jn=Xn}else Jn=!1;Zn=Jn&&(!document.documentMode||9<document.documentMode)}function tr(){Gn&&(Gn.detachEvent("onpropertychange",nr),Wn=Gn=null)}function nr(e){if("value"===e.propertyName&&Qn(Wn)){var t=[];Vn(t,Wn,e,xe(e)),Te(Kn,t)}}function rr(e,t,n){"focusin"===e?(tr(),Wn=n,(Gn=t).attachEvent("onpropertychange",nr)):"focusout"===e&&tr()}function or(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qn(Wn)}function ar(e,t){if("click"===e)return Qn(t)}function sr(e,t){if("input"===e||"change"===e)return Qn(t)}var ir="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function lr(e,t){if(ir(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!d.call(t,o)||!ir(e[o],t[o]))return!1}return!0}function cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ur(e,t){var n,r=cr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=cr(r)}}function dr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?dr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function pr(){for(var e=window,t=K();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=K((e=t.contentWindow).document)}return t}function fr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function gr(e){var t=pr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&dr(n.ownerDocument.documentElement,n)){if(null!==r&&fr(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var o=n.textContent.length,a=Math.min(r.start,o);r=void 0===r.end?a:Math.min(r.end,o),!e.extend&&a>r&&(o=r,r=a,a=o),o=ur(n,a);var s=ur(n,r);o&&s&&(1!==e.rangeCount||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&((t=t.createRange()).setStart(o.node,o.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var mr=u&&"documentMode"in document&&11>=document.documentMode,hr=null,br=null,vr=null,yr=!1;function wr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;yr||null==hr||hr!==K(r)||("selectionStart"in(r=hr)&&fr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},vr&&lr(vr,r)||(vr=r,0<(r=Gr(br,"onSelect")).length&&(t=new un("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=hr)))}function xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var jr={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionend:xr("Transition","TransitionEnd")},kr={},Sr={};function _r(e){if(kr[e])return kr[e];if(!jr[e])return e;var t,n=jr[e];for(t in n)if(n.hasOwnProperty(t)&&t in Sr)return kr[e]=n[t];return e}u&&(Sr=document.createElement("div").style,"AnimationEvent"in window||(delete jr.animationend.animation,delete jr.animationiteration.animation,delete jr.animationstart.animation),"TransitionEvent"in window||delete jr.transitionend.transition);var Er=_r("animationend"),Or=_r("animationiteration"),Cr=_r("animationstart"),Ar=_r("transitionend"),Pr=new Map,Tr="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ir(e,t){Pr.set(e,t),l(t,[e])}for(var Rr=0;Rr<Tr.length;Rr++){var Nr=Tr[Rr];Ir(Nr.toLowerCase(),"on"+(Nr[0].toUpperCase()+Nr.slice(1)))}Ir(Er,"onAnimationEnd"),Ir(Or,"onAnimationIteration"),Ir(Cr,"onAnimationStart"),Ir("dblclick","onDoubleClick"),Ir("focusin","onFocus"),Ir("focusout","onBlur"),Ir(Ar,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Dr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Lr));function Mr(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,o,s,i,l,c){if(Ue.apply(this,arguments),De){if(!De)throw Error(a(198));var u=Me;De=!1,Me=null,Fe||(Fe=!0,Be=u)}}(r,t,void 0,e),e.currentTarget=null}function Fr(e,t){t=0!=(4&t);for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var s=r.length-1;0<=s;s--){var i=r[s],l=i.instance,c=i.currentTarget;if(i=i.listener,l!==a&&o.isPropagationStopped())break e;Mr(o,i,c),a=l}else for(s=0;s<r.length;s++){if(l=(i=r[s]).instance,c=i.currentTarget,i=i.listener,l!==a&&o.isPropagationStopped())break e;Mr(o,i,c),a=l}}}if(Fe)throw e=Be,Fe=!1,Be=null,e}function Br(e,t){var n=t[ho];void 0===n&&(n=t[ho]=new Set);var r=e+"__bubble";n.has(r)||($r(t,e,2,!1),n.add(r))}function zr(e,t,n){var r=0;t&&(r|=4),$r(n,e,r,t)}var Ur="_reactListening"+Math.random().toString(36).slice(2);function qr(e){if(!e[Ur]){e[Ur]=!0,s.forEach((function(t){"selectionchange"!==t&&(Dr.has(t)||zr(t,!1,e),zr(t,!0,e))}));var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Ur]||(t[Ur]=!0,zr("selectionchange",!1,t))}}function $r(e,t,n,r){switch(Yt(t)){case 1:var o=Vt;break;case 4:o=Gt;break;default:o=Wt}n=o.bind(null,t,n,e),o=void 0,!Re||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(o=!0),r?void 0!==o?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):void 0!==o?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Hr(e,t,n,r,o){var a=r;if(0==(1&t)&&0==(2&t)&&null!==r)e:for(;;){if(null===r)return;var s=r.tag;if(3===s||4===s){var i=r.stateNode.containerInfo;if(i===o||8===i.nodeType&&i.parentNode===o)break;if(4===s)for(s=r.return;null!==s;){var l=s.tag;if((3===l||4===l)&&((l=s.stateNode.containerInfo)===o||8===l.nodeType&&l.parentNode===o))return;s=s.return}for(;null!==i;){if(null===(s=yo(i)))return;if(5===(l=s.tag)||6===l){r=a=s;continue e}i=i.parentNode}}r=r.return}Te((function(){var r=a,o=xe(n),s=[];e:{var i=Pr.get(e);if(void 0!==i){var l=un,c=e;switch(e){case"keypress":if(0===tn(n))break e;case"keydown":case"keyup":l=On;break;case"focusin":c="focus",l=hn;break;case"focusout":c="blur",l=hn;break;case"beforeblur":case"afterblur":l=hn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=gn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=mn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=An;break;case Er:case Or:case Cr:l=bn;break;case Ar:l=Pn;break;case"scroll":l=pn;break;case"wheel":l=In;break;case"copy":case"cut":case"paste":l=yn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Cn}var u=0!=(4&t),d=!u&&"scroll"===e,p=u?null!==i?i+"Capture":null:i;u=[];for(var f,g=r;null!==g;){var m=(f=g).stateNode;if(5===f.tag&&null!==m&&(f=m,null!==p&&(null!=(m=Ie(g,p))&&u.push(Vr(g,m,f)))),d)break;g=g.return}0<u.length&&(i=new l(i,c,null,n,o),s.push({event:i,listeners:u}))}}if(0==(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(i="mouseover"===e||"pointerover"===e)||n===we||!(c=n.relatedTarget||n.fromElement)||!yo(c)&&!c[mo])&&(l||i)&&(i=o.window===o?o:(i=o.ownerDocument)?i.defaultView||i.parentWindow:window,l?(l=r,null!==(c=(c=n.relatedTarget||n.toElement)?yo(c):null)&&(c!==(d=qe(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=r),l!==c)){if(u=gn,m="onMouseLeave",p="onMouseEnter",g="mouse","pointerout"!==e&&"pointerover"!==e||(u=Cn,m="onPointerLeave",p="onPointerEnter",g="pointer"),d=null==l?i:xo(l),f=null==c?i:xo(c),(i=new u(m,g+"leave",l,n,o)).target=d,i.relatedTarget=f,m=null,yo(o)===r&&((u=new u(p,g+"enter",c,n,o)).target=f,u.relatedTarget=d,m=u),d=m,l&&c)e:{for(p=c,g=0,f=u=l;f;f=Wr(f))g++;for(f=0,m=p;m;m=Wr(m))f++;for(;0<g-f;)u=Wr(u),g--;for(;0<f-g;)p=Wr(p),f--;for(;g--;){if(u===p||null!==p&&u===p.alternate)break e;u=Wr(u),p=Wr(p)}u=null}else u=null;null!==l&&Kr(s,i,l,u,!1),null!==c&&null!==d&&Kr(s,d,c,u,!0)}if("select"===(l=(i=r?xo(r):window).nodeName&&i.nodeName.toLowerCase())||"input"===l&&"file"===i.type)var h=Yn;else if(Hn(i))if(Zn)h=sr;else{h=or;var b=rr}else(l=i.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===i.type||"radio"===i.type)&&(h=ar);switch(h&&(h=h(e,r))?Vn(s,h,n,o):(b&&b(e,i,r),"focusout"===e&&(b=i._wrapperState)&&b.controlled&&"number"===i.type&&ee(i,"number",i.value)),b=r?xo(r):window,e){case"focusin":(Hn(b)||"true"===b.contentEditable)&&(hr=b,br=r,vr=null);break;case"focusout":vr=br=hr=null;break;case"mousedown":yr=!0;break;case"contextmenu":case"mouseup":case"dragend":yr=!1,wr(s,n,o);break;case"selectionchange":if(mr)break;case"keydown":case"keyup":wr(s,n,o)}var v;if(Nn)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else qn?zn(e,n)&&(y="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(y="onCompositionStart");y&&(Mn&&"ko"!==n.locale&&(qn||"onCompositionStart"!==y?"onCompositionEnd"===y&&qn&&(v=en()):(Jt="value"in(Zt=o)?Zt.value:Zt.textContent,qn=!0)),0<(b=Gr(r,y)).length&&(y=new wn(y,e,null,n,o),s.push({event:y,listeners:b}),v?y.data=v:null!==(v=Un(n))&&(y.data=v))),(v=Dn?function(e,t){switch(e){case"compositionend":return Un(t);case"keypress":return 32!==t.which?null:(Bn=!0,Fn);case"textInput":return(e=t.data)===Fn&&Bn?null:e;default:return null}}(e,n):function(e,t){if(qn)return"compositionend"===e||!Nn&&zn(e,t)?(e=en(),Xt=Jt=Zt=null,qn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Mn&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=Gr(r,"onBeforeInput")).length&&(o=new wn("onBeforeInput","beforeinput",null,n,o),s.push({event:o,listeners:r}),o.data=v))}Fr(s,t)}))}function Vr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Gr(e,t){for(var n=t+"Capture",r=[];null!==e;){var o=e,a=o.stateNode;5===o.tag&&null!==a&&(o=a,null!=(a=Ie(e,n))&&r.unshift(Vr(e,a,o)),null!=(a=Ie(e,t))&&r.push(Vr(e,a,o))),e=e.return}return r}function Wr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Kr(e,t,n,r,o){for(var a=t._reactName,s=[];null!==n&&n!==r;){var i=n,l=i.alternate,c=i.stateNode;if(null!==l&&l===r)break;5===i.tag&&null!==c&&(i=c,o?null!=(l=Ie(n,a))&&s.unshift(Vr(n,l,i)):o||null!=(l=Ie(n,a))&&s.push(Vr(n,l,i))),n=n.return}0!==s.length&&e.push({event:t,listeners:s})}var Qr=/\r\n?/g,Yr=/\u0000|\uFFFD/g;function Zr(e){return("string"==typeof e?e:""+e).replace(Qr,"\n").replace(Yr,"")}function Jr(e,t,n){if(t=Zr(t),Zr(e)!==t&&n)throw Error(a(425))}function Xr(){}var eo=null,to=null;function no(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ro="function"==typeof setTimeout?setTimeout:void 0,oo="function"==typeof clearTimeout?clearTimeout:void 0,ao="function"==typeof Promise?Promise:void 0,so="function"==typeof queueMicrotask?queueMicrotask:void 0!==ao?function(e){return ao.resolve(null).then(e).catch(io)}:ro;function io(e){setTimeout((function(){throw e}))}function lo(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&8===o.nodeType)if("/$"===(n=o.data)){if(0===r)return e.removeChild(o),void qt(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=o}while(n);qt(t)}function co(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function uo(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var po=Math.random().toString(36).slice(2),fo="__reactFiber$"+po,go="__reactProps$"+po,mo="__reactContainer$"+po,ho="__reactEvents$"+po,bo="__reactListeners$"+po,vo="__reactHandles$"+po;function yo(e){var t=e[fo];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mo]||n[fo]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=uo(e);null!==e;){if(n=e[fo])return n;e=uo(e)}return t}n=(e=n).parentNode}return null}function wo(e){return!(e=e[fo]||e[mo])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function xo(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(a(33))}function jo(e){return e[go]||null}var ko=[],So=-1;function _o(e){return{current:e}}function Eo(e){0>So||(e.current=ko[So],ko[So]=null,So--)}function Oo(e,t){So++,ko[So]=e.current,e.current=t}var Co={},Ao=_o(Co),Po=_o(!1),To=Co;function Io(e,t){var n=e.type.contextTypes;if(!n)return Co;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,a={};for(o in n)a[o]=t[o];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Ro(e){return null!=(e=e.childContextTypes)}function No(){Eo(Po),Eo(Ao)}function Lo(e,t,n){if(Ao.current!==Co)throw Error(a(168));Oo(Ao,t),Oo(Po,n)}function Do(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in t))throw Error(a(108,$(e)||"Unknown",o));return M({},n,r)}function Mo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Co,To=Ao.current,Oo(Ao,e),Oo(Po,Po.current),!0}function Fo(e,t,n){var r=e.stateNode;if(!r)throw Error(a(169));n?(e=Do(e,t,To),r.__reactInternalMemoizedMergedChildContext=e,Eo(Po),Eo(Ao),Oo(Ao,e)):Eo(Po),Oo(Po,n)}var Bo=null,zo=!1,Uo=!1;function qo(e){null===Bo?Bo=[e]:Bo.push(e)}function $o(){if(!Uo&&null!==Bo){Uo=!0;var e=0,t=yt;try{var n=Bo;for(yt=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Bo=null,zo=!1}catch(o){throw null!==Bo&&(Bo=Bo.slice(e+1)),We(Xe,$o),o}finally{yt=t,Uo=!1}}return null}var Ho=[],Vo=0,Go=null,Wo=0,Ko=[],Qo=0,Yo=null,Zo=1,Jo="";function Xo(e,t){Ho[Vo++]=Wo,Ho[Vo++]=Go,Go=e,Wo=t}function ea(e,t,n){Ko[Qo++]=Zo,Ko[Qo++]=Jo,Ko[Qo++]=Yo,Yo=e;var r=Zo;e=Jo;var o=32-st(r)-1;r&=~(1<<o),n+=1;var a=32-st(t)+o;if(30<a){var s=o-o%5;a=(r&(1<<s)-1).toString(32),r>>=s,o-=s,Zo=1<<32-st(t)+o|n<<o|r,Jo=a+e}else Zo=1<<a|n<<o|r,Jo=e}function ta(e){null!==e.return&&(Xo(e,1),ea(e,1,0))}function na(e){for(;e===Go;)Go=Ho[--Vo],Ho[Vo]=null,Wo=Ho[--Vo],Ho[Vo]=null;for(;e===Yo;)Yo=Ko[--Qo],Ko[Qo]=null,Jo=Ko[--Qo],Ko[Qo]=null,Zo=Ko[--Qo],Ko[Qo]=null}var ra=null,oa=null,aa=!1,sa=null;function ia(e,t){var n=Ic(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function la(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ra=e,oa=co(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ra=e,oa=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Yo?{id:Zo,overflow:Jo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=Ic(18,null,null,0)).stateNode=t,n.return=e,e.child=n,ra=e,oa=null,!0);default:return!1}}function ca(e){return 0!=(1&e.mode)&&0==(128&e.flags)}function ua(e){if(aa){var t=oa;if(t){var n=t;if(!la(e,t)){if(ca(e))throw Error(a(418));t=co(n.nextSibling);var r=ra;t&&la(e,t)?ia(r,n):(e.flags=-4097&e.flags|2,aa=!1,ra=e)}}else{if(ca(e))throw Error(a(418));e.flags=-4097&e.flags|2,aa=!1,ra=e}}}function da(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ra=e}function pa(e){if(e!==ra)return!1;if(!aa)return da(e),aa=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!no(e.type,e.memoizedProps)),t&&(t=oa)){if(ca(e))throw fa(),Error(a(418));for(;t;)ia(e,t),t=co(t.nextSibling)}if(da(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){oa=co(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}oa=null}}else oa=ra?co(e.stateNode.nextSibling):null;return!0}function fa(){for(var e=oa;e;)e=co(e.nextSibling)}function ga(){oa=ra=null,aa=!1}function ma(e){null===sa?sa=[e]:sa.push(e)}var ha=w.ReactCurrentBatchConfig;function ba(e,t){if(e&&e.defaultProps){for(var n in t=M({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var va=_o(null),ya=null,wa=null,xa=null;function ja(){xa=wa=ya=null}function ka(e){var t=va.current;Eo(va),e._currentValue=t}function Sa(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function _a(e,t){ya=e,xa=wa=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(wi=!0),e.firstContext=null)}function Ea(e){var t=e._currentValue;if(xa!==e)if(e={context:e,memoizedValue:t,next:null},null===wa){if(null===ya)throw Error(a(308));wa=e,ya.dependencies={lanes:0,firstContext:e}}else wa=wa.next=e;return t}var Oa=null;function Ca(e){null===Oa?Oa=[e]:Oa.push(e)}function Aa(e,t,n,r){var o=t.interleaved;return null===o?(n.next=n,Ca(t)):(n.next=o.next,o.next=n),t.interleaved=n,Pa(e,r)}function Pa(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var Ta=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ra(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Na(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,0!=(2&Al)){var o=r.pending;return null===o?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Pa(e,n)}return null===(o=r.interleaved)?(t.next=t,Ca(r)):(t.next=o.next,o.next=t),r.interleaved=t,Pa(e,n)}function Da(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,0!=(4194240&n))){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,vt(e,n)}}function Ma(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var o=null,a=null;if(null!==(n=n.firstBaseUpdate)){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===a?o=a=s:a=a.next=s,n=n.next}while(null!==n);null===a?o=a=t:a=a.next=t}else o=a=t;return n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:a,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Fa(e,t,n,r){var o=e.updateQueue;Ta=!1;var a=o.firstBaseUpdate,s=o.lastBaseUpdate,i=o.shared.pending;if(null!==i){o.shared.pending=null;var l=i,c=l.next;l.next=null,null===s?a=c:s.next=c,s=l;var u=e.alternate;null!==u&&((i=(u=u.updateQueue).lastBaseUpdate)!==s&&(null===i?u.firstBaseUpdate=c:i.next=c,u.lastBaseUpdate=l))}if(null!==a){var d=o.baseState;for(s=0,u=c=l=null,i=a;;){var p=i.lane,f=i.eventTime;if((r&p)===p){null!==u&&(u=u.next={eventTime:f,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var g=e,m=i;switch(p=t,f=n,m.tag){case 1:if("function"==typeof(g=m.payload)){d=g.call(f,d,p);break e}d=g;break e;case 3:g.flags=-65537&g.flags|128;case 0:if(null==(p="function"==typeof(g=m.payload)?g.call(f,d,p):g))break e;d=M({},d,p);break e;case 2:Ta=!0}}null!==i.callback&&0!==i.lane&&(e.flags|=64,null===(p=o.effects)?o.effects=[i]:p.push(i))}else f={eventTime:f,lane:p,tag:i.tag,payload:i.payload,callback:i.callback,next:null},null===u?(c=u=f,l=d):u=u.next=f,s|=p;if(null===(i=i.next)){if(null===(i=o.shared.pending))break;i=(p=i).next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}if(null===u&&(l=d),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=u,null!==(t=o.shared.interleaved)){o=t;do{s|=o.lane,o=o.next}while(o!==t)}else null===a&&(o.shared.lanes=0);Ml|=s,e.lanes=s,e.memoizedState=d}}function Ba(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(null!==o){if(r.callback=null,r=n,"function"!=typeof o)throw Error(a(191,o));o.call(r)}}}var za=(new r.Component).refs;function Ua(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:M({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var qa={isMounted:function(e){return!!(e=e._reactInternals)&&qe(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=tc(),o=nc(e),a=Na(r,o);a.payload=t,null!=n&&(a.callback=n),null!==(t=La(e,a,o))&&(rc(t,e,o,r),Da(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=tc(),o=nc(e),a=Na(r,o);a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=La(e,a,o))&&(rc(t,e,o,r),Da(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=tc(),r=nc(e),o=Na(n,r);o.tag=2,null!=t&&(o.callback=t),null!==(t=La(e,o,r))&&(rc(t,e,r,n),Da(t,e,r))}};function $a(e,t,n,r,o,a,s){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,s):!t.prototype||!t.prototype.isPureReactComponent||(!lr(n,r)||!lr(o,a))}function Ha(e,t,n){var r=!1,o=Co,a=t.contextType;return"object"==typeof a&&null!==a?a=Ea(a):(o=Ro(t)?To:Ao.current,a=(r=null!=(r=t.contextTypes))?Io(e,o):Co),t=new t(n,a),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=qa,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=a),t}function Va(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&qa.enqueueReplaceState(t,t.state,null)}function Ga(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs=za,Ia(e);var a=t.contextType;"object"==typeof a&&null!==a?o.context=Ea(a):(a=Ro(t)?To:Ao.current,o.context=Io(e,a)),o.state=e.memoizedState,"function"==typeof(a=t.getDerivedStateFromProps)&&(Ua(e,t,a,n),o.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(t=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),t!==o.state&&qa.enqueueReplaceState(o,o.state,null),Fa(e,n,o,r),o.state=e.memoizedState),"function"==typeof o.componentDidMount&&(e.flags|=4194308)}function Wa(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(a(309));var r=n.stateNode}if(!r)throw Error(a(147,e));var o=r,s=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===s?t.ref:(t=function(e){var t=o.refs;t===za&&(t=o.refs={}),null===e?delete t[s]:t[s]=e},t._stringRef=s,t)}if("string"!=typeof e)throw Error(a(284));if(!n._owner)throw Error(a(290,e))}return e}function Ka(e,t){throw e=Object.prototype.toString.call(t),Error(a(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Qa(e){return(0,e._init)(e._payload)}function Ya(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function o(e,t){return(e=Nc(e,t)).index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function i(t){return e&&null===t.alternate&&(t.flags|=2),t}function l(e,t,n,r){return null===t||6!==t.tag?((t=Fc(n,e.mode,r)).return=e,t):((t=o(t,n)).return=e,t)}function c(e,t,n,r){var a=n.type;return a===k?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===a||"object"==typeof a&&null!==a&&a.$$typeof===I&&Qa(a)===t.type)?((r=o(t,n.props)).ref=Wa(e,t,n),r.return=e,r):((r=Lc(n.type,n.key,n.props,null,e.mode,r)).ref=Wa(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Bc(n,e.mode,r)).return=e,t):((t=o(t,n.children||[])).return=e,t)}function d(e,t,n,r,a){return null===t||7!==t.tag?((t=Dc(n,e.mode,r,a)).return=e,t):((t=o(t,n)).return=e,t)}function p(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Fc(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case x:return(n=Lc(t.type,t.key,t.props,null,e.mode,n)).ref=Wa(e,null,t),n.return=e,n;case j:return(t=Bc(t,e.mode,n)).return=e,t;case I:return p(e,(0,t._init)(t._payload),n)}if(te(t)||L(t))return(t=Dc(t,e.mode,n,null)).return=e,t;Ka(e,t)}return null}function f(e,t,n,r){var o=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==o?null:l(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case x:return n.key===o?c(e,t,n,r):null;case j:return n.key===o?u(e,t,n,r):null;case I:return f(e,t,(o=n._init)(n._payload),r)}if(te(n)||L(n))return null!==o?null:d(e,t,n,r,null);Ka(e,n)}return null}function g(e,t,n,r,o){if("string"==typeof r&&""!==r||"number"==typeof r)return l(t,e=e.get(n)||null,""+r,o);if("object"==typeof r&&null!==r){switch(r.$$typeof){case x:return c(t,e=e.get(null===r.key?n:r.key)||null,r,o);case j:return u(t,e=e.get(null===r.key?n:r.key)||null,r,o);case I:return g(e,t,n,(0,r._init)(r._payload),o)}if(te(r)||L(r))return d(t,e=e.get(n)||null,r,o,null);Ka(t,r)}return null}function m(o,a,i,l){for(var c=null,u=null,d=a,m=a=0,h=null;null!==d&&m<i.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var b=f(o,d,i[m],l);if(null===b){null===d&&(d=h);break}e&&d&&null===b.alternate&&t(o,d),a=s(b,a,m),null===u?c=b:u.sibling=b,u=b,d=h}if(m===i.length)return n(o,d),aa&&Xo(o,m),c;if(null===d){for(;m<i.length;m++)null!==(d=p(o,i[m],l))&&(a=s(d,a,m),null===u?c=d:u.sibling=d,u=d);return aa&&Xo(o,m),c}for(d=r(o,d);m<i.length;m++)null!==(h=g(d,o,m,i[m],l))&&(e&&null!==h.alternate&&d.delete(null===h.key?m:h.key),a=s(h,a,m),null===u?c=h:u.sibling=h,u=h);return e&&d.forEach((function(e){return t(o,e)})),aa&&Xo(o,m),c}function h(o,i,l,c){var u=L(l);if("function"!=typeof u)throw Error(a(150));if(null==(l=u.call(l)))throw Error(a(151));for(var d=u=null,m=i,h=i=0,b=null,v=l.next();null!==m&&!v.done;h++,v=l.next()){m.index>h?(b=m,m=null):b=m.sibling;var y=f(o,m,v.value,c);if(null===y){null===m&&(m=b);break}e&&m&&null===y.alternate&&t(o,m),i=s(y,i,h),null===d?u=y:d.sibling=y,d=y,m=b}if(v.done)return n(o,m),aa&&Xo(o,h),u;if(null===m){for(;!v.done;h++,v=l.next())null!==(v=p(o,v.value,c))&&(i=s(v,i,h),null===d?u=v:d.sibling=v,d=v);return aa&&Xo(o,h),u}for(m=r(o,m);!v.done;h++,v=l.next())null!==(v=g(m,o,h,v.value,c))&&(e&&null!==v.alternate&&m.delete(null===v.key?h:v.key),i=s(v,i,h),null===d?u=v:d.sibling=v,d=v);return e&&m.forEach((function(e){return t(o,e)})),aa&&Xo(o,h),u}return function e(r,a,s,l){if("object"==typeof s&&null!==s&&s.type===k&&null===s.key&&(s=s.props.children),"object"==typeof s&&null!==s){switch(s.$$typeof){case x:e:{for(var c=s.key,u=a;null!==u;){if(u.key===c){if((c=s.type)===k){if(7===u.tag){n(r,u.sibling),(a=o(u,s.props.children)).return=r,r=a;break e}}else if(u.elementType===c||"object"==typeof c&&null!==c&&c.$$typeof===I&&Qa(c)===u.type){n(r,u.sibling),(a=o(u,s.props)).ref=Wa(r,u,s),a.return=r,r=a;break e}n(r,u);break}t(r,u),u=u.sibling}s.type===k?((a=Dc(s.props.children,r.mode,l,s.key)).return=r,r=a):((l=Lc(s.type,s.key,s.props,null,r.mode,l)).ref=Wa(r,a,s),l.return=r,r=l)}return i(r);case j:e:{for(u=s.key;null!==a;){if(a.key===u){if(4===a.tag&&a.stateNode.containerInfo===s.containerInfo&&a.stateNode.implementation===s.implementation){n(r,a.sibling),(a=o(a,s.children||[])).return=r,r=a;break e}n(r,a);break}t(r,a),a=a.sibling}(a=Bc(s,r.mode,l)).return=r,r=a}return i(r);case I:return e(r,a,(u=s._init)(s._payload),l)}if(te(s))return m(r,a,s,l);if(L(s))return h(r,a,s,l);Ka(r,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==a&&6===a.tag?(n(r,a.sibling),(a=o(a,s)).return=r,r=a):(n(r,a),(a=Fc(s,r.mode,l)).return=r,r=a),i(r)):n(r,a)}}var Za=Ya(!0),Ja=Ya(!1),Xa={},es=_o(Xa),ts=_o(Xa),ns=_o(Xa);function rs(e){if(e===Xa)throw Error(a(174));return e}function os(e,t){switch(Oo(ns,t),Oo(ts,e),Oo(es,Xa),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:le(null,"");break;default:t=le(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Eo(es),Oo(es,t)}function as(){Eo(es),Eo(ts),Eo(ns)}function ss(e){rs(ns.current);var t=rs(es.current),n=le(t,e.type);t!==n&&(Oo(ts,e),Oo(es,n))}function is(e){ts.current===e&&(Eo(es),Eo(ts))}var ls=_o(0);function cs(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var us=[];function ds(){for(var e=0;e<us.length;e++)us[e]._workInProgressVersionPrimary=null;us.length=0}var ps=w.ReactCurrentDispatcher,fs=w.ReactCurrentBatchConfig,gs=0,ms=null,hs=null,bs=null,vs=!1,ys=!1,ws=0,xs=0;function js(){throw Error(a(321))}function ks(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ir(e[n],t[n]))return!1;return!0}function Ss(e,t,n,r,o,s){if(gs=s,ms=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ps.current=null===e||null===e.memoizedState?ii:li,e=n(r,o),ys){s=0;do{if(ys=!1,ws=0,25<=s)throw Error(a(301));s+=1,bs=hs=null,t.updateQueue=null,ps.current=ci,e=n(r,o)}while(ys)}if(ps.current=si,t=null!==hs&&null!==hs.next,gs=0,bs=hs=ms=null,vs=!1,t)throw Error(a(300));return e}function _s(){var e=0!==ws;return ws=0,e}function Es(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===bs?ms.memoizedState=bs=e:bs=bs.next=e,bs}function Os(){if(null===hs){var e=ms.alternate;e=null!==e?e.memoizedState:null}else e=hs.next;var t=null===bs?ms.memoizedState:bs.next;if(null!==t)bs=t,hs=e;else{if(null===e)throw Error(a(310));e={memoizedState:(hs=e).memoizedState,baseState:hs.baseState,baseQueue:hs.baseQueue,queue:hs.queue,next:null},null===bs?ms.memoizedState=bs=e:bs=bs.next=e}return bs}function Cs(e,t){return"function"==typeof t?t(e):t}function As(e){var t=Os(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=hs,o=r.baseQueue,s=n.pending;if(null!==s){if(null!==o){var i=o.next;o.next=s.next,s.next=i}r.baseQueue=o=s,n.pending=null}if(null!==o){s=o.next,r=r.baseState;var l=i=null,c=null,u=s;do{var d=u.lane;if((gs&d)===d)null!==c&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var p={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===c?(l=c=p,i=r):c=c.next=p,ms.lanes|=d,Ml|=d}u=u.next}while(null!==u&&u!==s);null===c?i=r:c.next=l,ir(r,t.memoizedState)||(wi=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=c,n.lastRenderedState=r}if(null!==(e=n.interleaved)){o=e;do{s=o.lane,ms.lanes|=s,Ml|=s,o=o.next}while(o!==e)}else null===o&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ps(e){var t=Os(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,s=t.memoizedState;if(null!==o){n.pending=null;var i=o=o.next;do{s=e(s,i.action),i=i.next}while(i!==o);ir(s,t.memoizedState)||(wi=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Ts(){}function Is(e,t){var n=ms,r=Os(),o=t(),s=!ir(r.memoizedState,o);if(s&&(r.memoizedState=o,wi=!0),r=r.queue,Hs(Ls.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||null!==bs&&1&bs.memoizedState.tag){if(n.flags|=2048,Bs(9,Ns.bind(null,n,r,o,t),void 0,null),null===Pl)throw Error(a(349));0!=(30&gs)||Rs(n,t,o)}return o}function Rs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=ms.updateQueue)?(t={lastEffect:null,stores:null},ms.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Ns(e,t,n,r){t.value=n,t.getSnapshot=r,Ds(t)&&Ms(e)}function Ls(e,t,n){return n((function(){Ds(t)&&Ms(e)}))}function Ds(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ir(e,n)}catch(r){return!0}}function Ms(e){var t=Pa(e,1);null!==t&&rc(t,e,1,-1)}function Fs(e){var t=Es();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Cs,lastRenderedState:e},t.queue=e,e=e.dispatch=ni.bind(null,ms,e),[t.memoizedState,e]}function Bs(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=ms.updateQueue)?(t={lastEffect:null,stores:null},ms.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function zs(){return Os().memoizedState}function Us(e,t,n,r){var o=Es();ms.flags|=e,o.memoizedState=Bs(1|t,n,void 0,void 0===r?null:r)}function qs(e,t,n,r){var o=Os();r=void 0===r?null:r;var a=void 0;if(null!==hs){var s=hs.memoizedState;if(a=s.destroy,null!==r&&ks(r,s.deps))return void(o.memoizedState=Bs(t,n,a,r))}ms.flags|=e,o.memoizedState=Bs(1|t,n,a,r)}function $s(e,t){return Us(8390656,8,e,t)}function Hs(e,t){return qs(2048,8,e,t)}function Vs(e,t){return qs(4,2,e,t)}function Gs(e,t){return qs(4,4,e,t)}function Ws(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Ks(e,t,n){return n=null!=n?n.concat([e]):null,qs(4,4,Ws.bind(null,t,e),n)}function Qs(){}function Ys(e,t){var n=Os();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ks(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Zs(e,t){var n=Os();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ks(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Js(e,t,n){return 0==(21&gs)?(e.baseState&&(e.baseState=!1,wi=!0),e.memoizedState=n):(ir(n,t)||(n=mt(),ms.lanes|=n,Ml|=n,e.baseState=!0),t)}function Xs(e,t){var n=yt;yt=0!==n&&4>n?n:4,e(!0);var r=fs.transition;fs.transition={};try{e(!1),t()}finally{yt=n,fs.transition=r}}function ei(){return Os().memoizedState}function ti(e,t,n){var r=nc(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ri(e))oi(t,n);else if(null!==(n=Aa(e,t,n,r))){rc(n,e,r,tc()),ai(n,t,r)}}function ni(e,t,n){var r=nc(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ri(e))oi(t,o);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var s=t.lastRenderedState,i=a(s,n);if(o.hasEagerState=!0,o.eagerState=i,ir(i,s)){var l=t.interleaved;return null===l?(o.next=o,Ca(t)):(o.next=l.next,l.next=o),void(t.interleaved=o)}}catch(c){}null!==(n=Aa(e,t,o,r))&&(rc(n,e,r,o=tc()),ai(n,t,r))}}function ri(e){var t=e.alternate;return e===ms||null!==t&&t===ms}function oi(e,t){ys=vs=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ai(e,t,n){if(0!=(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,vt(e,n)}}var si={readContext:Ea,useCallback:js,useContext:js,useEffect:js,useImperativeHandle:js,useInsertionEffect:js,useLayoutEffect:js,useMemo:js,useReducer:js,useRef:js,useState:js,useDebugValue:js,useDeferredValue:js,useTransition:js,useMutableSource:js,useSyncExternalStore:js,useId:js,unstable_isNewReconciler:!1},ii={readContext:Ea,useCallback:function(e,t){return Es().memoizedState=[e,void 0===t?null:t],e},useContext:Ea,useEffect:$s,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Us(4194308,4,Ws.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Us(4194308,4,e,t)},useInsertionEffect:function(e,t){return Us(4,2,e,t)},useMemo:function(e,t){var n=Es();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Es();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ti.bind(null,ms,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Es().memoizedState=e},useState:Fs,useDebugValue:Qs,useDeferredValue:function(e){return Es().memoizedState=e},useTransition:function(){var e=Fs(!1),t=e[0];return e=Xs.bind(null,e[1]),Es().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ms,o=Es();if(aa){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===Pl)throw Error(a(349));0!=(30&gs)||Rs(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,$s(Ls.bind(null,r,s,e),[e]),r.flags|=2048,Bs(9,Ns.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Es(),t=Pl.identifierPrefix;if(aa){var n=Jo;t=":"+t+"R"+(n=(Zo&~(1<<32-st(Zo)-1)).toString(32)+n),0<(n=ws++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=xs++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},li={readContext:Ea,useCallback:Ys,useContext:Ea,useEffect:Hs,useImperativeHandle:Ks,useInsertionEffect:Vs,useLayoutEffect:Gs,useMemo:Zs,useReducer:As,useRef:zs,useState:function(){return As(Cs)},useDebugValue:Qs,useDeferredValue:function(e){return Js(Os(),hs.memoizedState,e)},useTransition:function(){return[As(Cs)[0],Os().memoizedState]},useMutableSource:Ts,useSyncExternalStore:Is,useId:ei,unstable_isNewReconciler:!1},ci={readContext:Ea,useCallback:Ys,useContext:Ea,useEffect:Hs,useImperativeHandle:Ks,useInsertionEffect:Vs,useLayoutEffect:Gs,useMemo:Zs,useReducer:Ps,useRef:zs,useState:function(){return Ps(Cs)},useDebugValue:Qs,useDeferredValue:function(e){var t=Os();return null===hs?t.memoizedState=e:Js(t,hs.memoizedState,e)},useTransition:function(){return[Ps(Cs)[0],Os().memoizedState]},useMutableSource:Ts,useSyncExternalStore:Is,useId:ei,unstable_isNewReconciler:!1};function ui(e,t){try{var n="",r=t;do{n+=U(r),r=r.return}while(r);var o=n}catch(a){o="\nError generating stack: "+a.message+"\n"+a.stack}return{value:e,source:t,stack:o,digest:null}}function di(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function pi(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}var fi="function"==typeof WeakMap?WeakMap:Map;function gi(e,t,n){(n=Na(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vl||(Vl=!0,Gl=r),pi(0,t)},n}function mi(e,t,n){(n=Na(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){pi(0,t)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(n.callback=function(){pi(0,t),"function"!=typeof r&&(null===Wl?Wl=new Set([this]):Wl.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function hi(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new fi;var o=new Set;r.set(t,o)}else void 0===(o=r.get(t))&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=Ec.bind(null,e,t,n),t.then(e,e))}function bi(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function vi(e,t,n,r,o){return 0==(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Na(-1,1)).tag=2,La(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=o,e)}var yi=w.ReactCurrentOwner,wi=!1;function xi(e,t,n,r){t.child=null===e?Ja(t,null,n,r):Za(t,e.child,n,r)}function ji(e,t,n,r,o){n=n.render;var a=t.ref;return _a(t,o),r=Ss(e,t,n,r,a,o),n=_s(),null===e||wi?(aa&&n&&ta(t),t.flags|=1,xi(e,t,r,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Vi(e,t,o))}function ki(e,t,n,r,o){if(null===e){var a=n.type;return"function"!=typeof a||Rc(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Lc(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,Si(e,t,a,r,o))}if(a=e.child,0==(e.lanes&o)){var s=a.memoizedProps;if((n=null!==(n=n.compare)?n:lr)(s,r)&&e.ref===t.ref)return Vi(e,t,o)}return t.flags|=1,(e=Nc(a,r)).ref=t.ref,e.return=t,t.child=e}function Si(e,t,n,r,o){if(null!==e){var a=e.memoizedProps;if(lr(a,r)&&e.ref===t.ref){if(wi=!1,t.pendingProps=r=a,0==(e.lanes&o))return t.lanes=e.lanes,Vi(e,t,o);0!=(131072&e.flags)&&(wi=!0)}}return Oi(e,t,n,r,o)}function _i(e,t,n){var r=t.pendingProps,o=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Oo(Nl,Rl),Rl|=n;else{if(0==(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Oo(Nl,Rl),Rl|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==a?a.baseLanes:n,Oo(Nl,Rl),Rl|=r}else null!==a?(r=a.baseLanes|n,t.memoizedState=null):r=n,Oo(Nl,Rl),Rl|=r;return xi(e,t,o,n),t.child}function Ei(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Oi(e,t,n,r,o){var a=Ro(n)?To:Ao.current;return a=Io(t,a),_a(t,o),n=Ss(e,t,n,r,a,o),r=_s(),null===e||wi?(aa&&r&&ta(t),t.flags|=1,xi(e,t,n,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Vi(e,t,o))}function Ci(e,t,n,r,o){if(Ro(n)){var a=!0;Mo(t)}else a=!1;if(_a(t,o),null===t.stateNode)Hi(e,t),Ha(t,n,r),Ga(t,n,r,o),r=!0;else if(null===e){var s=t.stateNode,i=t.memoizedProps;s.props=i;var l=s.context,c=n.contextType;"object"==typeof c&&null!==c?c=Ea(c):c=Io(t,c=Ro(n)?To:Ao.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof s.getSnapshotBeforeUpdate;d||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(i!==r||l!==c)&&Va(t,s,r,c),Ta=!1;var p=t.memoizedState;s.state=p,Fa(t,r,s,o),l=t.memoizedState,i!==r||p!==l||Po.current||Ta?("function"==typeof u&&(Ua(t,n,u,r),l=t.memoizedState),(i=Ta||$a(t,n,i,r,p,l,c))?(d||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.flags|=4194308)):("function"==typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=i):("function"==typeof s.componentDidMount&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Ra(e,t),i=t.memoizedProps,c=t.type===t.elementType?i:ba(t.type,i),s.props=c,d=t.pendingProps,p=s.context,"object"==typeof(l=n.contextType)&&null!==l?l=Ea(l):l=Io(t,l=Ro(n)?To:Ao.current);var f=n.getDerivedStateFromProps;(u="function"==typeof f||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(i!==d||p!==l)&&Va(t,s,r,l),Ta=!1,p=t.memoizedState,s.state=p,Fa(t,r,s,o);var g=t.memoizedState;i!==d||p!==g||Po.current||Ta?("function"==typeof f&&(Ua(t,n,f,r),g=t.memoizedState),(c=Ta||$a(t,n,c,r,p,g,l)||!1)?(u||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(r,g,l),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(r,g,l)),"function"==typeof s.componentDidUpdate&&(t.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof s.componentDidUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),s.props=r,s.state=g,s.context=l,r=c):("function"!=typeof s.componentDidUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Ai(e,t,n,r,a,o)}function Ai(e,t,n,r,o,a){Ei(e,t);var s=0!=(128&t.flags);if(!r&&!s)return o&&Fo(t,n,!1),Vi(e,t,a);r=t.stateNode,yi.current=t;var i=s&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&s?(t.child=Za(t,e.child,null,a),t.child=Za(t,null,i,a)):xi(e,t,i,a),t.memoizedState=r.state,o&&Fo(t,n,!0),t.child}function Pi(e){var t=e.stateNode;t.pendingContext?Lo(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Lo(0,t.context,!1),os(e,t.containerInfo)}function Ti(e,t,n,r,o){return ga(),ma(o),t.flags|=256,xi(e,t,n,r),t.child}var Ii,Ri,Ni,Li,Di={dehydrated:null,treeContext:null,retryLane:0};function Mi(e){return{baseLanes:e,cachePool:null,transitions:null}}function Fi(e,t,n){var r,o=t.pendingProps,s=ls.current,i=!1,l=0!=(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&0!=(2&s)),r?(i=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(s|=1),Oo(ls,1&s),null===e)return ua(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0==(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(l=o.children,e=o.fallback,i?(o=t.mode,i=t.child,l={mode:"hidden",children:l},0==(1&o)&&null!==i?(i.childLanes=0,i.pendingProps=l):i=Mc(l,o,0,null),e=Dc(e,o,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Mi(n),t.memoizedState=Di,e):Bi(t,l));if(null!==(s=e.memoizedState)&&null!==(r=s.dehydrated))return function(e,t,n,r,o,s,i){if(n)return 256&t.flags?(t.flags&=-257,zi(e,t,i,r=di(Error(a(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(s=r.fallback,o=t.mode,r=Mc({mode:"visible",children:r.children},o,0,null),(s=Dc(s,o,i,null)).flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,0!=(1&t.mode)&&Za(t,e.child,null,i),t.child.memoizedState=Mi(i),t.memoizedState=Di,s);if(0==(1&t.mode))return zi(e,t,i,null);if("$!"===o.data){if(r=o.nextSibling&&o.nextSibling.dataset)var l=r.dgst;return r=l,zi(e,t,i,r=di(s=Error(a(419)),r,void 0))}if(l=0!=(i&e.childLanes),wi||l){if(null!==(r=Pl)){switch(i&-i){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(o=0!=(o&(r.suspendedLanes|i))?0:o)&&o!==s.retryLane&&(s.retryLane=o,Pa(e,o),rc(r,e,o,-1))}return hc(),zi(e,t,i,r=di(Error(a(421))))}return"$?"===o.data?(t.flags|=128,t.child=e.child,t=Cc.bind(null,e),o._reactRetry=t,null):(e=s.treeContext,oa=co(o.nextSibling),ra=t,aa=!0,sa=null,null!==e&&(Ko[Qo++]=Zo,Ko[Qo++]=Jo,Ko[Qo++]=Yo,Zo=e.id,Jo=e.overflow,Yo=t),t=Bi(t,r.children),t.flags|=4096,t)}(e,t,l,o,r,s,n);if(i){i=o.fallback,l=t.mode,r=(s=e.child).sibling;var c={mode:"hidden",children:o.children};return 0==(1&l)&&t.child!==s?((o=t.child).childLanes=0,o.pendingProps=c,t.deletions=null):(o=Nc(s,c)).subtreeFlags=14680064&s.subtreeFlags,null!==r?i=Nc(r,i):(i=Dc(i,l,n,null)).flags|=2,i.return=t,o.return=t,o.sibling=i,t.child=o,o=i,i=t.child,l=null===(l=e.child.memoizedState)?Mi(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},i.memoizedState=l,i.childLanes=e.childLanes&~n,t.memoizedState=Di,o}return e=(i=e.child).sibling,o=Nc(i,{mode:"visible",children:o.children}),0==(1&t.mode)&&(o.lanes=n),o.return=t,o.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=o,t.memoizedState=null,o}function Bi(e,t){return(t=Mc({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function zi(e,t,n,r){return null!==r&&ma(r),Za(t,e.child,null,n),(e=Bi(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Ui(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Sa(e.return,t,n)}function qi(e,t,n,r,o){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=o)}function $i(e,t,n){var r=t.pendingProps,o=r.revealOrder,a=r.tail;if(xi(e,t,r.children,n),0!=(2&(r=ls.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Ui(e,n,t);else if(19===e.tag)Ui(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Oo(ls,r),0==(1&t.mode))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;null!==n;)null!==(e=n.alternate)&&null===cs(e)&&(o=n),n=n.sibling;null===(n=o)?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),qi(t,!1,o,n,a);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(null!==(e=o.alternate)&&null===cs(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}qi(t,!0,n,null,a);break;case"together":qi(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Hi(e,t){0==(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Vi(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Ml|=t.lanes,0==(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=Nc(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Nc(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Gi(e,t){if(!aa)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Wi(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=14680064&o.subtreeFlags,r|=14680064&o.flags,o.return=e,o=o.sibling;else for(o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ki(e,t,n){var r=t.pendingProps;switch(na(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wi(t),null;case 1:case 17:return Ro(t.type)&&No(),Wi(t),null;case 3:return r=t.stateNode,as(),Eo(Po),Eo(Ao),ds(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(pa(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,null!==sa&&(ic(sa),sa=null))),Ri(e,t),Wi(t),null;case 5:is(t);var o=rs(ns.current);if(n=t.type,null!==e&&null!=t.stateNode)Ni(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(a(166));return Wi(t),null}if(e=rs(es.current),pa(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[fo]=t,r[go]=s,e=0!=(1&t.mode),n){case"dialog":Br("cancel",r),Br("close",r);break;case"iframe":case"object":case"embed":Br("load",r);break;case"video":case"audio":for(o=0;o<Lr.length;o++)Br(Lr[o],r);break;case"source":Br("error",r);break;case"img":case"image":case"link":Br("error",r),Br("load",r);break;case"details":Br("toggle",r);break;case"input":Y(r,s),Br("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Br("invalid",r);break;case"textarea":oe(r,s),Br("invalid",r)}for(var l in ve(n,s),o=null,s)if(s.hasOwnProperty(l)){var c=s[l];"children"===l?"string"==typeof c?r.textContent!==c&&(!0!==s.suppressHydrationWarning&&Jr(r.textContent,c,e),o=["children",c]):"number"==typeof c&&r.textContent!==""+c&&(!0!==s.suppressHydrationWarning&&Jr(r.textContent,c,e),o=["children",""+c]):i.hasOwnProperty(l)&&null!=c&&"onScroll"===l&&Br("scroll",r)}switch(n){case"input":G(r),X(r,s,!0);break;case"textarea":G(r),se(r);break;case"select":case"option":break;default:"function"==typeof s.onClick&&(r.onclick=Xr)}r=o,t.updateQueue=r,null!==r&&(t.flags|=4)}else{l=9===o.nodeType?o:o.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=ie(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=l.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),"select"===n&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[fo]=t,e[go]=r,Ii(e,t,!1,!1),t.stateNode=e;e:{switch(l=ye(n,r),n){case"dialog":Br("cancel",e),Br("close",e),o=r;break;case"iframe":case"object":case"embed":Br("load",e),o=r;break;case"video":case"audio":for(o=0;o<Lr.length;o++)Br(Lr[o],e);o=r;break;case"source":Br("error",e),o=r;break;case"img":case"image":case"link":Br("error",e),Br("load",e),o=r;break;case"details":Br("toggle",e),o=r;break;case"input":Y(e,r),o=Q(e,r),Br("invalid",e);break;case"option":default:o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=M({},r,{value:void 0}),Br("invalid",e);break;case"textarea":oe(e,r),o=re(e,r),Br("invalid",e)}for(s in ve(n,o),c=o)if(c.hasOwnProperty(s)){var u=c[s];"style"===s?he(e,u):"dangerouslySetInnerHTML"===s?null!=(u=u?u.__html:void 0)&&de(e,u):"children"===s?"string"==typeof u?("textarea"!==n||""!==u)&&pe(e,u):"number"==typeof u&&pe(e,""+u):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(i.hasOwnProperty(s)?null!=u&&"onScroll"===s&&Br("scroll",e):null!=u&&y(e,s,u,l))}switch(n){case"input":G(e),X(e,r,!1);break;case"textarea":G(e),se(e);break;case"option":null!=r.value&&e.setAttribute("value",""+H(r.value));break;case"select":e.multiple=!!r.multiple,null!=(s=r.value)?ne(e,!!r.multiple,s,!1):null!=r.defaultValue&&ne(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof o.onClick&&(e.onclick=Xr)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Wi(t),null;case 6:if(e&&null!=t.stateNode)Li(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(a(166));if(n=rs(ns.current),rs(es.current),pa(t)){if(r=t.stateNode,n=t.memoizedProps,r[fo]=t,(s=r.nodeValue!==n)&&null!==(e=ra))switch(e.tag){case 3:Jr(r.nodeValue,n,0!=(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Jr(r.nodeValue,n,0!=(1&e.mode))}s&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[fo]=t,t.stateNode=r}return Wi(t),null;case 13:if(Eo(ls),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(aa&&null!==oa&&0!=(1&t.mode)&&0==(128&t.flags))fa(),ga(),t.flags|=98560,s=!1;else if(s=pa(t),null!==r&&null!==r.dehydrated){if(null===e){if(!s)throw Error(a(318));if(!(s=null!==(s=t.memoizedState)?s.dehydrated:null))throw Error(a(317));s[fo]=t}else ga(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Wi(t),s=!1}else null!==sa&&(ic(sa),sa=null),s=!0;if(!s)return 65536&t.flags?t:null}return 0!=(128&t.flags)?(t.lanes=n,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,0!=(1&t.mode)&&(null===e||0!=(1&ls.current)?0===Ll&&(Ll=3):hc())),null!==t.updateQueue&&(t.flags|=4),Wi(t),null);case 4:return as(),Ri(e,t),null===e&&qr(t.stateNode.containerInfo),Wi(t),null;case 10:return ka(t.type._context),Wi(t),null;case 19:if(Eo(ls),null===(s=t.memoizedState))return Wi(t),null;if(r=0!=(128&t.flags),null===(l=s.rendering))if(r)Gi(s,!1);else{if(0!==Ll||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(l=cs(e))){for(t.flags|=128,Gi(s,!1),null!==(r=l.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(s=n).flags&=14680066,null===(l=s.alternate)?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,e=l.dependencies,s.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Oo(ls,1&ls.current|2),t.child}e=e.sibling}null!==s.tail&&Ze()>$l&&(t.flags|=128,r=!0,Gi(s,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=cs(l))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Gi(s,!0),null===s.tail&&"hidden"===s.tailMode&&!l.alternate&&!aa)return Wi(t),null}else 2*Ze()-s.renderingStartTime>$l&&1073741824!==n&&(t.flags|=128,r=!0,Gi(s,!1),t.lanes=4194304);s.isBackwards?(l.sibling=t.child,t.child=l):(null!==(n=s.last)?n.sibling=l:t.child=l,s.last=l)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ze(),t.sibling=null,n=ls.current,Oo(ls,r?1&n|2:1&n),t):(Wi(t),null);case 22:case 23:return pc(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&0!=(1&t.mode)?0!=(1073741824&Rl)&&(Wi(t),6&t.subtreeFlags&&(t.flags|=8192)):Wi(t),null;case 24:case 25:return null}throw Error(a(156,t.tag))}function Qi(e,t){switch(na(t),t.tag){case 1:return Ro(t.type)&&No(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return as(),Eo(Po),Eo(Ao),ds(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return is(t),null;case 13:if(Eo(ls),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));ga()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Eo(ls),null;case 4:return as(),null;case 10:return ka(t.type._context),null;case 22:case 23:return pc(),null;default:return null}}Ii=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ri=function(){},Ni=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,rs(es.current);var a,s=null;switch(n){case"input":o=Q(e,o),r=Q(e,r),s=[];break;case"select":o=M({},o,{value:void 0}),r=M({},r,{value:void 0}),s=[];break;case"textarea":o=re(e,o),r=re(e,r),s=[];break;default:"function"!=typeof o.onClick&&"function"==typeof r.onClick&&(e.onclick=Xr)}for(u in ve(n,r),n=null,o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&null!=o[u])if("style"===u){var l=o[u];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(i.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=null!=o?o[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(null!=c||null!=l))if("style"===u)if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(s||(s=[]),s.push(u,n)),n=c;else"dangerouslySetInnerHTML"===u?(c=c?c.__html:void 0,l=l?l.__html:void 0,null!=c&&l!==c&&(s=s||[]).push(u,c)):"children"===u?"string"!=typeof c&&"number"!=typeof c||(s=s||[]).push(u,""+c):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(i.hasOwnProperty(u)?(null!=c&&"onScroll"===u&&Br("scroll",e),s||l===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}},Li=function(e,t,n,r){n!==r&&(t.flags|=4)};var Yi=!1,Zi=!1,Ji="function"==typeof WeakSet?WeakSet:Set,Xi=null;function el(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(r){_c(e,t,r)}else n.current=null}function tl(e,t,n){try{n()}catch(r){_c(e,t,r)}}var nl=!1;function rl(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var o=r=r.next;do{if((o.tag&e)===e){var a=o.destroy;o.destroy=void 0,void 0!==a&&tl(t,n,a)}o=o.next}while(o!==r)}}function ol(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function al(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function sl(e){var t=e.alternate;null!==t&&(e.alternate=null,sl(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[fo],delete t[go],delete t[ho],delete t[bo],delete t[vo])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function il(e){return 5===e.tag||3===e.tag||4===e.tag}function ll(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||il(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function cl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Xr));else if(4!==r&&null!==(e=e.child))for(cl(e,t,n),e=e.sibling;null!==e;)cl(e,t,n),e=e.sibling}function ul(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(ul(e,t,n),e=e.sibling;null!==e;)ul(e,t,n),e=e.sibling}var dl=null,pl=!1;function fl(e,t,n){for(n=n.child;null!==n;)gl(e,t,n),n=n.sibling}function gl(e,t,n){if(at&&"function"==typeof at.onCommitFiberUnmount)try{at.onCommitFiberUnmount(ot,n)}catch(i){}switch(n.tag){case 5:Zi||el(n,t);case 6:var r=dl,o=pl;dl=null,fl(e,t,n),pl=o,null!==(dl=r)&&(pl?(e=dl,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):dl.removeChild(n.stateNode));break;case 18:null!==dl&&(pl?(e=dl,n=n.stateNode,8===e.nodeType?lo(e.parentNode,n):1===e.nodeType&&lo(e,n),qt(e)):lo(dl,n.stateNode));break;case 4:r=dl,o=pl,dl=n.stateNode.containerInfo,pl=!0,fl(e,t,n),dl=r,pl=o;break;case 0:case 11:case 14:case 15:if(!Zi&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){o=r=r.next;do{var a=o,s=a.destroy;a=a.tag,void 0!==s&&(0!=(2&a)||0!=(4&a))&&tl(n,t,s),o=o.next}while(o!==r)}fl(e,t,n);break;case 1:if(!Zi&&(el(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(i){_c(n,t,i)}fl(e,t,n);break;case 21:fl(e,t,n);break;case 22:1&n.mode?(Zi=(r=Zi)||null!==n.memoizedState,fl(e,t,n),Zi=r):fl(e,t,n);break;default:fl(e,t,n)}}function ml(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Ji),t.forEach((function(t){var r=Ac.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function hl(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var o=n[r];try{var s=e,i=t,l=i;e:for(;null!==l;){switch(l.tag){case 5:dl=l.stateNode,pl=!1;break e;case 3:case 4:dl=l.stateNode.containerInfo,pl=!0;break e}l=l.return}if(null===dl)throw Error(a(160));gl(s,i,o),dl=null,pl=!1;var c=o.alternate;null!==c&&(c.return=null),o.return=null}catch(u){_c(o,t,u)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)bl(t,e),t=t.sibling}function bl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(hl(t,e),vl(e),4&r){try{rl(3,e,e.return),ol(3,e)}catch(h){_c(e,e.return,h)}try{rl(5,e,e.return)}catch(h){_c(e,e.return,h)}}break;case 1:hl(t,e),vl(e),512&r&&null!==n&&el(n,n.return);break;case 5:if(hl(t,e),vl(e),512&r&&null!==n&&el(n,n.return),32&e.flags){var o=e.stateNode;try{pe(o,"")}catch(h){_c(e,e.return,h)}}if(4&r&&null!=(o=e.stateNode)){var s=e.memoizedProps,i=null!==n?n.memoizedProps:s,l=e.type,c=e.updateQueue;if(e.updateQueue=null,null!==c)try{"input"===l&&"radio"===s.type&&null!=s.name&&Z(o,s),ye(l,i);var u=ye(l,s);for(i=0;i<c.length;i+=2){var d=c[i],p=c[i+1];"style"===d?he(o,p):"dangerouslySetInnerHTML"===d?de(o,p):"children"===d?pe(o,p):y(o,d,p,u)}switch(l){case"input":J(o,s);break;case"textarea":ae(o,s);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!s.multiple;var g=s.value;null!=g?ne(o,!!s.multiple,g,!1):f!==!!s.multiple&&(null!=s.defaultValue?ne(o,!!s.multiple,s.defaultValue,!0):ne(o,!!s.multiple,s.multiple?[]:"",!1))}o[go]=s}catch(h){_c(e,e.return,h)}}break;case 6:if(hl(t,e),vl(e),4&r){if(null===e.stateNode)throw Error(a(162));o=e.stateNode,s=e.memoizedProps;try{o.nodeValue=s}catch(h){_c(e,e.return,h)}}break;case 3:if(hl(t,e),vl(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{qt(t.containerInfo)}catch(h){_c(e,e.return,h)}break;case 4:default:hl(t,e),vl(e);break;case 13:hl(t,e),vl(e),8192&(o=e.child).flags&&(s=null!==o.memoizedState,o.stateNode.isHidden=s,!s||null!==o.alternate&&null!==o.alternate.memoizedState||(ql=Ze())),4&r&&ml(e);break;case 22:if(d=null!==n&&null!==n.memoizedState,1&e.mode?(Zi=(u=Zi)||d,hl(t,e),Zi=u):hl(t,e),vl(e),8192&r){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!d&&0!=(1&e.mode))for(Xi=e,d=e.child;null!==d;){for(p=Xi=d;null!==Xi;){switch(g=(f=Xi).child,f.tag){case 0:case 11:case 14:case 15:rl(4,f,f.return);break;case 1:el(f,f.return);var m=f.stateNode;if("function"==typeof m.componentWillUnmount){r=f,n=f.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(h){_c(r,n,h)}}break;case 5:el(f,f.return);break;case 22:if(null!==f.memoizedState){jl(p);continue}}null!==g?(g.return=f,Xi=g):jl(p)}d=d.sibling}e:for(d=null,p=e;;){if(5===p.tag){if(null===d){d=p;try{o=p.stateNode,u?"function"==typeof(s=o.style).setProperty?s.setProperty("display","none","important"):s.display="none":(l=p.stateNode,i=null!=(c=p.memoizedProps.style)&&c.hasOwnProperty("display")?c.display:null,l.style.display=me("display",i))}catch(h){_c(e,e.return,h)}}}else if(6===p.tag){if(null===d)try{p.stateNode.nodeValue=u?"":p.memoizedProps}catch(h){_c(e,e.return,h)}}else if((22!==p.tag&&23!==p.tag||null===p.memoizedState||p===e)&&null!==p.child){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;null===p.sibling;){if(null===p.return||p.return===e)break e;d===p&&(d=null),p=p.return}d===p&&(d=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:hl(t,e),vl(e),4&r&&ml(e);case 21:}}function vl(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(il(n)){var r=n;break e}n=n.return}throw Error(a(160))}switch(r.tag){case 5:var o=r.stateNode;32&r.flags&&(pe(o,""),r.flags&=-33),ul(e,ll(e),o);break;case 3:case 4:var s=r.stateNode.containerInfo;cl(e,ll(e),s);break;default:throw Error(a(161))}}catch(i){_c(e,e.return,i)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function yl(e,t,n){Xi=e,wl(e,t,n)}function wl(e,t,n){for(var r=0!=(1&e.mode);null!==Xi;){var o=Xi,a=o.child;if(22===o.tag&&r){var s=null!==o.memoizedState||Yi;if(!s){var i=o.alternate,l=null!==i&&null!==i.memoizedState||Zi;i=Yi;var c=Zi;if(Yi=s,(Zi=l)&&!c)for(Xi=o;null!==Xi;)l=(s=Xi).child,22===s.tag&&null!==s.memoizedState?kl(o):null!==l?(l.return=s,Xi=l):kl(o);for(;null!==a;)Xi=a,wl(a,t,n),a=a.sibling;Xi=o,Yi=i,Zi=c}xl(e)}else 0!=(8772&o.subtreeFlags)&&null!==a?(a.return=o,Xi=a):xl(e)}}function xl(e){for(;null!==Xi;){var t=Xi;if(0!=(8772&t.flags)){var n=t.alternate;try{if(0!=(8772&t.flags))switch(t.tag){case 0:case 11:case 15:Zi||ol(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!Zi)if(null===n)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:ba(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;null!==s&&Ba(t,s,r);break;case 3:var i=t.updateQueue;if(null!==i){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Ba(t,i,n)}break;case 5:var l=t.stateNode;if(null===n&&4&t.flags){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var d=u.memoizedState;if(null!==d){var p=d.dehydrated;null!==p&&qt(p)}}}break;default:throw Error(a(163))}Zi||512&t.flags&&al(t)}catch(f){_c(t,t.return,f)}}if(t===e){Xi=null;break}if(null!==(n=t.sibling)){n.return=t.return,Xi=n;break}Xi=t.return}}function jl(e){for(;null!==Xi;){var t=Xi;if(t===e){Xi=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Xi=n;break}Xi=t.return}}function kl(e){for(;null!==Xi;){var t=Xi;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ol(4,t)}catch(l){_c(t,n,l)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var o=t.return;try{r.componentDidMount()}catch(l){_c(t,o,l)}}var a=t.return;try{al(t)}catch(l){_c(t,a,l)}break;case 5:var s=t.return;try{al(t)}catch(l){_c(t,s,l)}}}catch(l){_c(t,t.return,l)}if(t===e){Xi=null;break}var i=t.sibling;if(null!==i){i.return=t.return,Xi=i;break}Xi=t.return}}var Sl,_l=Math.ceil,El=w.ReactCurrentDispatcher,Ol=w.ReactCurrentOwner,Cl=w.ReactCurrentBatchConfig,Al=0,Pl=null,Tl=null,Il=0,Rl=0,Nl=_o(0),Ll=0,Dl=null,Ml=0,Fl=0,Bl=0,zl=null,Ul=null,ql=0,$l=1/0,Hl=null,Vl=!1,Gl=null,Wl=null,Kl=!1,Ql=null,Yl=0,Zl=0,Jl=null,Xl=-1,ec=0;function tc(){return 0!=(6&Al)?Ze():-1!==Xl?Xl:Xl=Ze()}function nc(e){return 0==(1&e.mode)?1:0!=(2&Al)&&0!==Il?Il&-Il:null!==ha.transition?(0===ec&&(ec=mt()),ec):0!==(e=yt)?e:e=void 0===(e=window.event)?16:Yt(e.type)}function rc(e,t,n,r){if(50<Zl)throw Zl=0,Jl=null,Error(a(185));bt(e,n,r),0!=(2&Al)&&e===Pl||(e===Pl&&(0==(2&Al)&&(Fl|=n),4===Ll&&lc(e,Il)),oc(e,r),1===n&&0===Al&&0==(1&t.mode)&&($l=Ze()+500,zo&&$o()))}function oc(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,a=e.pendingLanes;0<a;){var s=31-st(a),i=1<<s,l=o[s];-1===l?0!=(i&n)&&0==(i&r)||(o[s]=ft(i,t)):l<=t&&(e.expiredLanes|=i),a&=~i}}(e,t);var r=pt(e,e===Pl?Il:0);if(0===r)null!==n&&Ke(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ke(n),1===t)0===e.tag?function(e){zo=!0,qo(e)}(cc.bind(null,e)):qo(cc.bind(null,e)),so((function(){0==(6&Al)&&$o()})),n=null;else{switch(wt(r)){case 1:n=Xe;break;case 4:n=et;break;case 16:default:n=tt;break;case 536870912:n=rt}n=Pc(n,ac.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ac(e,t){if(Xl=-1,ec=0,0!=(6&Al))throw Error(a(327));var n=e.callbackNode;if(kc()&&e.callbackNode!==n)return null;var r=pt(e,e===Pl?Il:0);if(0===r)return null;if(0!=(30&r)||0!=(r&e.expiredLanes)||t)t=bc(e,r);else{t=r;var o=Al;Al|=2;var s=mc();for(Pl===e&&Il===t||(Hl=null,$l=Ze()+500,fc(e,t));;)try{yc();break}catch(l){gc(e,l)}ja(),El.current=s,Al=o,null!==Tl?t=0:(Pl=null,Il=0,t=Ll)}if(0!==t){if(2===t&&(0!==(o=gt(e))&&(r=o,t=sc(e,o))),1===t)throw n=Dl,fc(e,0),lc(e,r),oc(e,Ze()),n;if(6===t)lc(e,r);else{if(o=e.current.alternate,0==(30&r)&&!function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var o=n[r],a=o.getSnapshot;o=o.value;try{if(!ir(a(),o))return!1}catch(i){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(o)&&(2===(t=bc(e,r))&&(0!==(s=gt(e))&&(r=s,t=sc(e,s))),1===t))throw n=Dl,fc(e,0),lc(e,r),oc(e,Ze()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(a(345));case 2:case 5:jc(e,Ul,Hl);break;case 3:if(lc(e,r),(130023424&r)===r&&10<(t=ql+500-Ze())){if(0!==pt(e,0))break;if(((o=e.suspendedLanes)&r)!==r){tc(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=ro(jc.bind(null,e,Ul,Hl),t);break}jc(e,Ul,Hl);break;case 4:if(lc(e,r),(4194240&r)===r)break;for(t=e.eventTimes,o=-1;0<r;){var i=31-st(r);s=1<<i,(i=t[i])>o&&(o=i),r&=~s}if(r=o,10<(r=(120>(r=Ze()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*_l(r/1960))-r)){e.timeoutHandle=ro(jc.bind(null,e,Ul,Hl),r);break}jc(e,Ul,Hl);break;default:throw Error(a(329))}}}return oc(e,Ze()),e.callbackNode===n?ac.bind(null,e):null}function sc(e,t){var n=zl;return e.current.memoizedState.isDehydrated&&(fc(e,t).flags|=256),2!==(e=bc(e,t))&&(t=Ul,Ul=n,null!==t&&ic(t)),e}function ic(e){null===Ul?Ul=e:Ul.push.apply(Ul,e)}function lc(e,t){for(t&=~Bl,t&=~Fl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-st(t),r=1<<n;e[n]=-1,t&=~r}}function cc(e){if(0!=(6&Al))throw Error(a(327));kc();var t=pt(e,0);if(0==(1&t))return oc(e,Ze()),null;var n=bc(e,t);if(0!==e.tag&&2===n){var r=gt(e);0!==r&&(t=r,n=sc(e,r))}if(1===n)throw n=Dl,fc(e,0),lc(e,t),oc(e,Ze()),n;if(6===n)throw Error(a(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,jc(e,Ul,Hl),oc(e,Ze()),null}function uc(e,t){var n=Al;Al|=1;try{return e(t)}finally{0===(Al=n)&&($l=Ze()+500,zo&&$o())}}function dc(e){null!==Ql&&0===Ql.tag&&0==(6&Al)&&kc();var t=Al;Al|=1;var n=Cl.transition,r=yt;try{if(Cl.transition=null,yt=1,e)return e()}finally{yt=r,Cl.transition=n,0==(6&(Al=t))&&$o()}}function pc(){Rl=Nl.current,Eo(Nl)}function fc(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,oo(n)),null!==Tl)for(n=Tl.return;null!==n;){var r=n;switch(na(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&No();break;case 3:as(),Eo(Po),Eo(Ao),ds();break;case 5:is(r);break;case 4:as();break;case 13:case 19:Eo(ls);break;case 10:ka(r.type._context);break;case 22:case 23:pc()}n=n.return}if(Pl=e,Tl=e=Nc(e.current,null),Il=Rl=t,Ll=0,Dl=null,Bl=Fl=Ml=0,Ul=zl=null,null!==Oa){for(t=0;t<Oa.length;t++)if(null!==(r=(n=Oa[t]).interleaved)){n.interleaved=null;var o=r.next,a=n.pending;if(null!==a){var s=a.next;a.next=o,r.next=s}n.pending=r}Oa=null}return e}function gc(e,t){for(;;){var n=Tl;try{if(ja(),ps.current=si,vs){for(var r=ms.memoizedState;null!==r;){var o=r.queue;null!==o&&(o.pending=null),r=r.next}vs=!1}if(gs=0,bs=hs=ms=null,ys=!1,ws=0,Ol.current=null,null===n||null===n.return){Ll=1,Dl=t,Tl=null;break}e:{var s=e,i=n.return,l=n,c=t;if(t=Il,l.flags|=32768,null!==c&&"object"==typeof c&&"function"==typeof c.then){var u=c,d=l,p=d.tag;if(0==(1&d.mode)&&(0===p||11===p||15===p)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var g=bi(i);if(null!==g){g.flags&=-257,vi(g,i,l,0,t),1&g.mode&&hi(s,u,t),c=u;var m=(t=g).updateQueue;if(null===m){var h=new Set;h.add(c),t.updateQueue=h}else m.add(c);break e}if(0==(1&t)){hi(s,u,t),hc();break e}c=Error(a(426))}else if(aa&&1&l.mode){var b=bi(i);if(null!==b){0==(65536&b.flags)&&(b.flags|=256),vi(b,i,l,0,t),ma(ui(c,l));break e}}s=c=ui(c,l),4!==Ll&&(Ll=2),null===zl?zl=[s]:zl.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t,Ma(s,gi(0,c,t));break e;case 1:l=c;var v=s.type,y=s.stateNode;if(0==(128&s.flags)&&("function"==typeof v.getDerivedStateFromError||null!==y&&"function"==typeof y.componentDidCatch&&(null===Wl||!Wl.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t,Ma(s,mi(s,l,t));break e}}s=s.return}while(null!==s)}xc(n)}catch(w){t=w,Tl===n&&null!==n&&(Tl=n=n.return);continue}break}}function mc(){var e=El.current;return El.current=si,null===e?si:e}function hc(){0!==Ll&&3!==Ll&&2!==Ll||(Ll=4),null===Pl||0==(268435455&Ml)&&0==(268435455&Fl)||lc(Pl,Il)}function bc(e,t){var n=Al;Al|=2;var r=mc();for(Pl===e&&Il===t||(Hl=null,fc(e,t));;)try{vc();break}catch(o){gc(e,o)}if(ja(),Al=n,El.current=r,null!==Tl)throw Error(a(261));return Pl=null,Il=0,Ll}function vc(){for(;null!==Tl;)wc(Tl)}function yc(){for(;null!==Tl&&!Qe();)wc(Tl)}function wc(e){var t=Sl(e.alternate,e,Rl);e.memoizedProps=e.pendingProps,null===t?xc(e):Tl=t,Ol.current=null}function xc(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(32768&t.flags)){if(null!==(n=Ki(n,t,Rl)))return void(Tl=n)}else{if(null!==(n=Qi(n,t)))return n.flags&=32767,void(Tl=n);if(null===e)return Ll=6,void(Tl=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(Tl=t);Tl=t=e}while(null!==t);0===Ll&&(Ll=5)}function jc(e,t,n){var r=yt,o=Cl.transition;try{Cl.transition=null,yt=1,function(e,t,n,r){do{kc()}while(null!==Ql);if(0!=(6&Al))throw Error(a(327));n=e.finishedWork;var o=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(a(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-st(n),a=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~a}}(e,s),e===Pl&&(Tl=Pl=null,Il=0),0==(2064&n.subtreeFlags)&&0==(2064&n.flags)||Kl||(Kl=!0,Pc(tt,(function(){return kc(),null}))),s=0!=(15990&n.flags),0!=(15990&n.subtreeFlags)||s){s=Cl.transition,Cl.transition=null;var i=yt;yt=1;var l=Al;Al|=4,Ol.current=null,function(e,t){if(eo=Ht,fr(e=pr())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch(x){n=null;break e}var i=0,l=-1,c=-1,u=0,d=0,p=e,f=null;t:for(;;){for(var g;p!==n||0!==o&&3!==p.nodeType||(l=i+o),p!==s||0!==r&&3!==p.nodeType||(c=i+r),3===p.nodeType&&(i+=p.nodeValue.length),null!==(g=p.firstChild);)f=p,p=g;for(;;){if(p===e)break t;if(f===n&&++u===o&&(l=i),f===s&&++d===r&&(c=i),null!==(g=p.nextSibling))break;f=(p=f).parentNode}p=g}n=-1===l||-1===c?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(to={focusedElem:e,selectionRange:n},Ht=!1,Xi=t;null!==Xi;)if(e=(t=Xi).child,0!=(1028&t.subtreeFlags)&&null!==e)e.return=t,Xi=e;else for(;null!==Xi;){t=Xi;try{var m=t.alternate;if(0!=(1024&t.flags))switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==m){var h=m.memoizedProps,b=m.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?h:ba(t.type,h),b);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=t.stateNode.containerInfo;1===w.nodeType?w.textContent="":9===w.nodeType&&w.documentElement&&w.removeChild(w.documentElement);break;default:throw Error(a(163))}}catch(x){_c(t,t.return,x)}if(null!==(e=t.sibling)){e.return=t.return,Xi=e;break}Xi=t.return}m=nl,nl=!1}(e,n),bl(n,e),gr(to),Ht=!!eo,to=eo=null,e.current=n,yl(n,e,o),Ye(),Al=l,yt=i,Cl.transition=s}else e.current=n;if(Kl&&(Kl=!1,Ql=e,Yl=o),s=e.pendingLanes,0===s&&(Wl=null),function(e){if(at&&"function"==typeof at.onCommitFiberRoot)try{at.onCommitFiberRoot(ot,e,void 0,128==(128&e.current.flags))}catch(t){}}(n.stateNode),oc(e,Ze()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(Vl)throw Vl=!1,e=Gl,Gl=null,e;0!=(1&Yl)&&0!==e.tag&&kc(),s=e.pendingLanes,0!=(1&s)?e===Jl?Zl++:(Zl=0,Jl=e):Zl=0,$o()}(e,t,n,r)}finally{Cl.transition=o,yt=r}return null}function kc(){if(null!==Ql){var e=wt(Yl),t=Cl.transition,n=yt;try{if(Cl.transition=null,yt=16>e?16:e,null===Ql)var r=!1;else{if(e=Ql,Ql=null,Yl=0,0!=(6&Al))throw Error(a(331));var o=Al;for(Al|=4,Xi=e.current;null!==Xi;){var s=Xi,i=s.child;if(0!=(16&Xi.flags)){var l=s.deletions;if(null!==l){for(var c=0;c<l.length;c++){var u=l[c];for(Xi=u;null!==Xi;){var d=Xi;switch(d.tag){case 0:case 11:case 15:rl(8,d,s)}var p=d.child;if(null!==p)p.return=d,Xi=p;else for(;null!==Xi;){var f=(d=Xi).sibling,g=d.return;if(sl(d),d===u){Xi=null;break}if(null!==f){f.return=g,Xi=f;break}Xi=g}}}var m=s.alternate;if(null!==m){var h=m.child;if(null!==h){m.child=null;do{var b=h.sibling;h.sibling=null,h=b}while(null!==h)}}Xi=s}}if(0!=(2064&s.subtreeFlags)&&null!==i)i.return=s,Xi=i;else e:for(;null!==Xi;){if(0!=(2048&(s=Xi).flags))switch(s.tag){case 0:case 11:case 15:rl(9,s,s.return)}var v=s.sibling;if(null!==v){v.return=s.return,Xi=v;break e}Xi=s.return}}var y=e.current;for(Xi=y;null!==Xi;){var w=(i=Xi).child;if(0!=(2064&i.subtreeFlags)&&null!==w)w.return=i,Xi=w;else e:for(i=y;null!==Xi;){if(0!=(2048&(l=Xi).flags))try{switch(l.tag){case 0:case 11:case 15:ol(9,l)}}catch(j){_c(l,l.return,j)}if(l===i){Xi=null;break e}var x=l.sibling;if(null!==x){x.return=l.return,Xi=x;break e}Xi=l.return}}if(Al=o,$o(),at&&"function"==typeof at.onPostCommitFiberRoot)try{at.onPostCommitFiberRoot(ot,e)}catch(j){}r=!0}return r}finally{yt=n,Cl.transition=t}}return!1}function Sc(e,t,n){e=La(e,t=gi(0,t=ui(n,t),1),1),t=tc(),null!==e&&(bt(e,1,t),oc(e,t))}function _c(e,t,n){if(3===e.tag)Sc(e,e,n);else for(;null!==t;){if(3===t.tag){Sc(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Wl||!Wl.has(r))){t=La(t,e=mi(t,e=ui(n,e),1),1),e=tc(),null!==t&&(bt(t,1,e),oc(t,e));break}}t=t.return}}function Ec(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=tc(),e.pingedLanes|=e.suspendedLanes&n,Pl===e&&(Il&n)===n&&(4===Ll||3===Ll&&(130023424&Il)===Il&&500>Ze()-ql?fc(e,0):Bl|=n),oc(e,t)}function Oc(e,t){0===t&&(0==(1&e.mode)?t=1:(t=ut,0==(130023424&(ut<<=1))&&(ut=4194304)));var n=tc();null!==(e=Pa(e,t))&&(bt(e,t,n),oc(e,n))}function Cc(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Oc(e,n)}function Ac(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;null!==o&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(a(314))}null!==r&&r.delete(t),Oc(e,n)}function Pc(e,t){return We(e,t)}function Tc(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ic(e,t,n,r){return new Tc(e,t,n,r)}function Rc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Nc(e,t){var n=e.alternate;return null===n?((n=Ic(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Lc(e,t,n,r,o,s){var i=2;if(r=e,"function"==typeof e)Rc(e)&&(i=1);else if("string"==typeof e)i=5;else e:switch(e){case k:return Dc(n.children,o,s,t);case S:i=8,o|=8;break;case _:return(e=Ic(12,n,t,2|o)).elementType=_,e.lanes=s,e;case A:return(e=Ic(13,n,t,o)).elementType=A,e.lanes=s,e;case P:return(e=Ic(19,n,t,o)).elementType=P,e.lanes=s,e;case R:return Mc(n,o,s,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case E:i=10;break e;case O:i=9;break e;case C:i=11;break e;case T:i=14;break e;case I:i=16,r=null;break e}throw Error(a(130,null==e?e:typeof e,""))}return(t=Ic(i,n,t,o)).elementType=e,t.type=r,t.lanes=s,t}function Dc(e,t,n,r){return(e=Ic(7,e,r,t)).lanes=n,e}function Mc(e,t,n,r){return(e=Ic(22,e,r,t)).elementType=R,e.lanes=n,e.stateNode={isHidden:!1},e}function Fc(e,t,n){return(e=Ic(6,e,null,t)).lanes=n,e}function Bc(e,t,n){return(t=Ic(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function zc(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ht(0),this.expirationTimes=ht(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ht(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Uc(e,t,n,r,o,a,s,i,l){return e=new zc(e,t,n,i,l),1===t?(t=1,!0===a&&(t|=8)):t=0,a=Ic(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ia(a),e}function qc(e){if(!e)return Co;e:{if(qe(e=e._reactInternals)!==e||1!==e.tag)throw Error(a(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ro(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(a(171))}if(1===e.tag){var n=e.type;if(Ro(n))return Do(e,n,t)}return t}function $c(e,t,n,r,o,a,s,i,l){return(e=Uc(n,r,!0,e,0,a,0,i,l)).context=qc(null),n=e.current,(a=Na(r=tc(),o=nc(n))).callback=null!=t?t:null,La(n,a,o),e.current.lanes=o,bt(e,o,r),oc(e,r),e}function Hc(e,t,n,r){var o=t.current,a=tc(),s=nc(o);return n=qc(n),null===t.context?t.context=n:t.pendingContext=n,(t=Na(a,s)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=La(o,t,s))&&(rc(e,o,s,a),Da(e,o,s)),s}function Vc(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Gc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Wc(e,t){Gc(e,t),(e=e.alternate)&&Gc(e,t)}Sl=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||Po.current)wi=!0;else{if(0==(e.lanes&n)&&0==(128&t.flags))return wi=!1,function(e,t,n){switch(t.tag){case 3:Pi(t),ga();break;case 5:ss(t);break;case 1:Ro(t.type)&&Mo(t);break;case 4:os(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Oo(va,r._currentValue),r._currentValue=o;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(Oo(ls,1&ls.current),t.flags|=128,null):0!=(n&t.child.childLanes)?Fi(e,t,n):(Oo(ls,1&ls.current),null!==(e=Vi(e,t,n))?e.sibling:null);Oo(ls,1&ls.current);break;case 19:if(r=0!=(n&t.childLanes),0!=(128&e.flags)){if(r)return $i(e,t,n);t.flags|=128}if(null!==(o=t.memoizedState)&&(o.rendering=null,o.tail=null,o.lastEffect=null),Oo(ls,ls.current),r)break;return null;case 22:case 23:return t.lanes=0,_i(e,t,n)}return Vi(e,t,n)}(e,t,n);wi=0!=(131072&e.flags)}else wi=!1,aa&&0!=(1048576&t.flags)&&ea(t,Wo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hi(e,t),e=t.pendingProps;var o=Io(t,Ao.current);_a(t,n),o=Ss(null,t,r,e,o,n);var s=_s();return t.flags|=1,"object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ro(r)?(s=!0,Mo(t)):s=!1,t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,Ia(t),o.updater=qa,t.stateNode=o,o._reactInternals=t,Ga(t,r,e,n),t=Ai(null,t,r,!0,s,n)):(t.tag=0,aa&&s&&ta(t),xi(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hi(e,t),e=t.pendingProps,r=(o=r._init)(r._payload),t.type=r,o=t.tag=function(e){if("function"==typeof e)return Rc(e)?1:0;if(null!=e){if((e=e.$$typeof)===C)return 11;if(e===T)return 14}return 2}(r),e=ba(r,e),o){case 0:t=Oi(null,t,r,e,n);break e;case 1:t=Ci(null,t,r,e,n);break e;case 11:t=ji(null,t,r,e,n);break e;case 14:t=ki(null,t,r,ba(r.type,e),n);break e}throw Error(a(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,Oi(e,t,r,o=t.elementType===r?o:ba(r,o),n);case 1:return r=t.type,o=t.pendingProps,Ci(e,t,r,o=t.elementType===r?o:ba(r,o),n);case 3:e:{if(Pi(t),null===e)throw Error(a(387));r=t.pendingProps,o=(s=t.memoizedState).element,Ra(e,t),Fa(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated){if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,256&t.flags){t=Ti(e,t,r,n,o=ui(Error(a(423)),t));break e}if(r!==o){t=Ti(e,t,r,n,o=ui(Error(a(424)),t));break e}for(oa=co(t.stateNode.containerInfo.firstChild),ra=t,aa=!0,sa=null,n=Ja(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(ga(),r===o){t=Vi(e,t,n);break e}xi(e,t,r,n)}t=t.child}return t;case 5:return ss(t),null===e&&ua(t),r=t.type,o=t.pendingProps,s=null!==e?e.memoizedProps:null,i=o.children,no(r,o)?i=null:null!==s&&no(r,s)&&(t.flags|=32),Ei(e,t),xi(e,t,i,n),t.child;case 6:return null===e&&ua(t),null;case 13:return Fi(e,t,n);case 4:return os(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Za(t,null,r,n):xi(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,ji(e,t,r,o=t.elementType===r?o:ba(r,o),n);case 7:return xi(e,t,t.pendingProps,n),t.child;case 8:case 12:return xi(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,i=o.value,Oo(va,r._currentValue),r._currentValue=i,null!==s)if(ir(s.value,i)){if(s.children===o.children&&!Po.current){t=Vi(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var l=s.dependencies;if(null!==l){i=s.child;for(var c=l.firstContext;null!==c;){if(c.context===r){if(1===s.tag){(c=Na(-1,n&-n)).tag=2;var u=s.updateQueue;if(null!==u){var d=(u=u.shared).pending;null===d?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,null!==(c=s.alternate)&&(c.lanes|=n),Sa(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(10===s.tag)i=s.type===t.type?null:s.child;else if(18===s.tag){if(null===(i=s.return))throw Error(a(341));i.lanes|=n,null!==(l=i.alternate)&&(l.lanes|=n),Sa(i,n,t),i=s.sibling}else i=s.child;if(null!==i)i.return=s;else for(i=s;null!==i;){if(i===t){i=null;break}if(null!==(s=i.sibling)){s.return=i.return,i=s;break}i=i.return}s=i}xi(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,_a(t,n),r=r(o=Ea(o)),t.flags|=1,xi(e,t,r,n),t.child;case 14:return o=ba(r=t.type,t.pendingProps),ki(e,t,r,o=ba(r.type,o),n);case 15:return Si(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ba(r,o),Hi(e,t),t.tag=1,Ro(r)?(e=!0,Mo(t)):e=!1,_a(t,n),Ha(t,r,o),Ga(t,r,o,n),Ai(null,t,r,!0,e,n);case 19:return $i(e,t,n);case 22:return _i(e,t,n)}throw Error(a(156,t.tag))};var Kc="function"==typeof reportError?reportError:function(e){console.error(e)};function Qc(e){this._internalRoot=e}function Yc(e){this._internalRoot=e}function Zc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Jc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Xc(){}function eu(e,t,n,r,o){var a=n._reactRootContainer;if(a){var s=a;if("function"==typeof o){var i=o;o=function(){var e=Vc(s);i.call(e)}}Hc(t,s,e,o)}else s=function(e,t,n,r,o){if(o){if("function"==typeof r){var a=r;r=function(){var e=Vc(s);a.call(e)}}var s=$c(t,r,e,0,null,!1,0,"",Xc);return e._reactRootContainer=s,e[mo]=s.current,qr(8===e.nodeType?e.parentNode:e),dc(),s}for(;o=e.lastChild;)e.removeChild(o);if("function"==typeof r){var i=r;r=function(){var e=Vc(l);i.call(e)}}var l=Uc(e,0,!1,null,0,!1,0,"",Xc);return e._reactRootContainer=l,e[mo]=l.current,qr(8===e.nodeType?e.parentNode:e),dc((function(){Hc(t,l,n,r)})),l}(n,t,e,o,r);return Vc(s)}Yc.prototype.render=Qc.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(a(409));Hc(e,t,null,null)},Yc.prototype.unmount=Qc.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;dc((function(){Hc(null,e,null,null)})),t[mo]=null}},Yc.prototype.unstable_scheduleHydration=function(e){if(e){var t=St();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Rt.length&&0!==t&&t<Rt[n].priority;n++);Rt.splice(n,0,e),0===n&&Mt(e)}},xt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=dt(t.pendingLanes);0!==n&&(vt(t,1|n),oc(t,Ze()),0==(6&Al)&&($l=Ze()+500,$o()))}break;case 13:dc((function(){var t=Pa(e,1);if(null!==t){var n=tc();rc(t,e,1,n)}})),Wc(e,1)}},jt=function(e){if(13===e.tag){var t=Pa(e,134217728);if(null!==t)rc(t,e,134217728,tc());Wc(e,134217728)}},kt=function(e){if(13===e.tag){var t=nc(e),n=Pa(e,t);if(null!==n)rc(n,e,t,tc());Wc(e,t)}},St=function(){return yt},_t=function(e,t){var n=yt;try{return yt=e,t()}finally{yt=n}},je=function(e,t,n){switch(t){case"input":if(J(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=jo(r);if(!o)throw Error(a(90));W(r),J(r,o)}}}break;case"textarea":ae(e,n);break;case"select":null!=(t=n.value)&&ne(e,!!n.multiple,t,!1)}},Ce=uc,Ae=dc;var tu={usingClientEntryPoint:!1,Events:[wo,xo,jo,Ee,Oe,uc]},nu={findFiberByHostInstance:yo,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},ru={bundleType:nu.bundleType,version:nu.version,rendererPackageName:nu.rendererPackageName,rendererConfig:nu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:w.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Ve(e))?null:e.stateNode},findFiberByHostInstance:nu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ou.isDisabled&&ou.supportsFiber)try{ot=ou.inject(ru),at=ou}catch(ue){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tu,t.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Zc(t))throw Error(a(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:j,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},t.createRoot=function(e,t){if(!Zc(e))throw Error(a(299));var n=!1,r="",o=Kc;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(o=t.onRecoverableError)),t=Uc(e,1,!1,null,0,n,0,r,o),e[mo]=t.current,qr(8===e.nodeType?e.parentNode:e),new Qc(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw e=Object.keys(e).join(","),Error(a(268,e))}return e=null===(e=Ve(t))?null:e.stateNode},t.flushSync=function(e){return dc(e)},t.hydrate=function(e,t,n){if(!Jc(t))throw Error(a(200));return eu(null,e,t,!0,n)},t.hydrateRoot=function(e,t,n){if(!Zc(e))throw Error(a(405));var r=null!=n&&n.hydratedSources||null,o=!1,s="",i=Kc;if(null!=n&&(!0===n.unstable_strictMode&&(o=!0),void 0!==n.identifierPrefix&&(s=n.identifierPrefix),void 0!==n.onRecoverableError&&(i=n.onRecoverableError)),t=$c(t,null,e,1,null!=n?n:null,o,0,s,i),e[mo]=t.current,qr(e),r)for(e=0;e<r.length;e++)o=(o=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Yc(t)},t.render=function(e,t,n){if(!Jc(t))throw Error(a(200));return eu(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Jc(e))throw Error(a(40));return!!e._reactRootContainer&&(dc((function(){eu(null,null,e,!1,(function(){e._reactRootContainer=null,e[mo]=null}))})),!0)},t.unstable_batchedUpdates=uc,t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Jc(n))throw Error(a(200));if(null==e||void 0===e._reactInternals)throw Error(a(38));return eu(e,t,n,!1,r)},t.version="18.2.0-next-9e3b772b8-20220608"},5338:(e,t,n)=>{"use strict";var r=n(961);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},961:(e,t,n)=>{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(2551)},115:e=>{var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function a(e,s){if(e===s)return!0;if(e&&s&&"object"==typeof e&&"object"==typeof s){if(e.constructor!==s.constructor)return!1;var i,l,c,u;if(Array.isArray(e)){if((i=e.length)!=s.length)return!1;for(l=i;0!=l--;)if(!a(e[l],s[l]))return!1;return!0}if(n&&e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;for(u=e.entries();!(l=u.next()).done;)if(!a(l.value[1],s.get(l.value[0])))return!1;return!0}if(r&&e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(s)){if((i=e.length)!=s.length)return!1;for(l=i;0!=l--;)if(e[l]!==s[l])return!1;return!0}if(e.constructor===RegExp)return e.source===s.source&&e.flags===s.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===s.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===s.toString();if((i=(c=Object.keys(e)).length)!==Object.keys(s).length)return!1;for(l=i;0!=l--;)if(!Object.prototype.hasOwnProperty.call(s,c[l]))return!1;if(t&&e instanceof Element)return!1;for(l=i;0!=l--;)if(("_owner"!==c[l]&&"__v"!==c[l]&&"__o"!==c[l]||!e.$$typeof)&&!a(e[c[l]],s[c[l]]))return!1;return!0}return e!=e&&s!=s}e.exports=function(e,t){try{return a(e,t)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},545:(e,t,n)=>{"use strict";n.d(t,{mg:()=>X,vd:()=>V});var r=n(6540),o=n(5556),a=n.n(o),s=n(115),i=n.n(s),l=n(311),c=n.n(l),u=n(2833),d=n.n(u);function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,g(e,t)}function g(e,t){return g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},g(e,t)}function m(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(o[n]=e[n]);return o}var h={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},b={rel:["amphtml","canonical","alternate"]},v={type:["application/ld+json"]},y={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},w=Object.keys(h).map((function(e){return h[e]})),x={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},j=Object.keys(x).reduce((function(e,t){return e[x[t]]=t,e}),{}),k=function(e,t){for(var n=e.length-1;n>=0;n-=1){var r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},S=function(e){var t=k(e,h.TITLE),n=k(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,(function(){return t}));var r=k(e,"defaultTitle");return t||r||void 0},_=function(e){return k(e,"onChangeClientState")||function(){}},E=function(e,t){return t.filter((function(t){return void 0!==t[e]})).map((function(t){return t[e]})).reduce((function(e,t){return p({},e,t)}),{})},O=function(e,t){return t.filter((function(e){return void 0!==e[h.BASE]})).map((function(e){return e[h.BASE]})).reverse().reduce((function(t,n){if(!t.length)for(var r=Object.keys(n),o=0;o<r.length;o+=1){var a=r[o].toLowerCase();if(-1!==e.indexOf(a)&&n[a])return t.concat(n)}return t}),[])},C=function(e,t,n){var r={};return n.filter((function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)})).map((function(t){return t[e]})).reverse().reduce((function(e,n){var o={};n.filter((function(e){for(var n,a=Object.keys(e),s=0;s<a.length;s+=1){var i=a[s],l=i.toLowerCase();-1===t.indexOf(l)||"rel"===n&&"canonical"===e[n].toLowerCase()||"rel"===l&&"stylesheet"===e[l].toLowerCase()||(n=l),-1===t.indexOf(i)||"innerHTML"!==i&&"cssText"!==i&&"itemprop"!==i||(n=i)}if(!n||!e[n])return!1;var c=e[n].toLowerCase();return r[n]||(r[n]={}),o[n]||(o[n]={}),!r[n][c]&&(o[n][c]=!0,!0)})).reverse().forEach((function(t){return e.push(t)}));for(var a=Object.keys(o),s=0;s<a.length;s+=1){var i=a[s],l=p({},r[i],o[i]);r[i]=l}return e}),[]).reverse()},A=function(e,t){if(Array.isArray(e)&&e.length)for(var n=0;n<e.length;n+=1)if(e[n][t])return!0;return!1},P=function(e){return Array.isArray(e)?e.join(""):e},T=function(e,t){return Array.isArray(e)?e.reduce((function(e,n){return function(e,t){for(var n=Object.keys(e),r=0;r<n.length;r+=1)if(t[n[r]]&&t[n[r]].includes(e[n[r]]))return!0;return!1}(n,t)?e.priority.push(n):e.default.push(n),e}),{priority:[],default:[]}):{default:e}},I=function(e,t){var n;return p({},e,((n={})[t]=void 0,n))},R=[h.NOSCRIPT,h.SCRIPT,h.STYLE],N=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},L=function(e){return Object.keys(e).reduce((function(t,n){var r=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+r:r}),"")},D=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce((function(t,n){return t[x[n]||n]=e[n],t}),t)},M=function(e,t){return t.map((function(t,n){var o,a=((o={key:n})["data-rh"]=!0,o);return Object.keys(t).forEach((function(e){var n=x[e]||e;"innerHTML"===n||"cssText"===n?a.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:a[n]=t[e]})),r.createElement(e,a)}))},F=function(e,t,n){switch(e){case h.TITLE:return{toComponent:function(){return n=t.titleAttributes,(o={key:e=t.title})["data-rh"]=!0,a=D(n,o),[r.createElement(h.TITLE,a,e)];var e,n,o,a},toString:function(){return function(e,t,n,r){var o=L(n),a=P(t);return o?"<"+e+' data-rh="true" '+o+">"+N(a,r)+"</"+e+">":"<"+e+' data-rh="true">'+N(a,r)+"</"+e+">"}(e,t.title,t.titleAttributes,n)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return D(t)},toString:function(){return L(t)}};default:return{toComponent:function(){return M(e,t)},toString:function(){return function(e,t,n){return t.reduce((function(t,r){var o=Object.keys(r).filter((function(e){return!("innerHTML"===e||"cssText"===e)})).reduce((function(e,t){var o=void 0===r[t]?t:t+'="'+N(r[t],n)+'"';return e?e+" "+o:o}),""),a=r.innerHTML||r.cssText||"",s=-1===R.indexOf(e);return t+"<"+e+' data-rh="true" '+o+(s?"/>":">"+a+"</"+e+">")}),"")}(e,t,n)}}}},B=function(e){var t=e.baseTag,n=e.bodyAttributes,r=e.encode,o=e.htmlAttributes,a=e.noscriptTags,s=e.styleTags,i=e.title,l=void 0===i?"":i,c=e.titleAttributes,u=e.linkTags,d=e.metaTags,p=e.scriptTags,f={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var g=function(e){var t=e.linkTags,n=e.scriptTags,r=e.encode,o=T(e.metaTags,y),a=T(t,b),s=T(n,v);return{priorityMethods:{toComponent:function(){return[].concat(M(h.META,o.priority),M(h.LINK,a.priority),M(h.SCRIPT,s.priority))},toString:function(){return F(h.META,o.priority,r)+" "+F(h.LINK,a.priority,r)+" "+F(h.SCRIPT,s.priority,r)}},metaTags:o.default,linkTags:a.default,scriptTags:s.default}}(e);f=g.priorityMethods,u=g.linkTags,d=g.metaTags,p=g.scriptTags}return{priority:f,base:F(h.BASE,t,r),bodyAttributes:F("bodyAttributes",n,r),htmlAttributes:F("htmlAttributes",o,r),link:F(h.LINK,u,r),meta:F(h.META,d,r),noscript:F(h.NOSCRIPT,a,r),script:F(h.SCRIPT,p,r),style:F(h.STYLE,s,r),title:F(h.TITLE,{title:l,titleAttributes:c},r)}},z=[],U=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?z:n.instances},add:function(e){(n.canUseDOM?z:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?z:n.instances).indexOf(e);(n.canUseDOM?z:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=B({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},q=r.createContext({}),$=a().shape({setHelmet:a().func,helmetInstances:a().shape({get:a().func,add:a().func,remove:a().func})}),H="undefined"!=typeof document,V=function(e){function t(n){var r;return(r=e.call(this,n)||this).helmetData=new U(r.props.context,t.canUseDOM),r}return f(t,e),t.prototype.render=function(){return r.createElement(q.Provider,{value:this.helmetData.value},this.props.children)},t}(r.Component);V.canUseDOM=H,V.propTypes={context:a().shape({helmet:a().shape()}),children:a().node.isRequired},V.defaultProps={context:{}},V.displayName="HelmetProvider";var G=function(e,t){var n,r=document.head||document.querySelector(h.HEAD),o=r.querySelectorAll(e+"[data-rh]"),a=[].slice.call(o),s=[];return t&&t.length&&t.forEach((function(t){var r=document.createElement(e);for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&("innerHTML"===o?r.innerHTML=t.innerHTML:"cssText"===o?r.styleSheet?r.styleSheet.cssText=t.cssText:r.appendChild(document.createTextNode(t.cssText)):r.setAttribute(o,void 0===t[o]?"":t[o]));r.setAttribute("data-rh","true"),a.some((function(e,t){return n=t,r.isEqualNode(e)}))?a.splice(n,1):s.push(r)})),a.forEach((function(e){return e.parentNode.removeChild(e)})),s.forEach((function(e){return r.appendChild(e)})),{oldTags:a,newTags:s}},W=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var r=n.getAttribute("data-rh"),o=r?r.split(","):[],a=[].concat(o),s=Object.keys(t),i=0;i<s.length;i+=1){var l=s[i],c=t[l]||"";n.getAttribute(l)!==c&&n.setAttribute(l,c),-1===o.indexOf(l)&&o.push(l);var u=a.indexOf(l);-1!==u&&a.splice(u,1)}for(var d=a.length-1;d>=0;d-=1)n.removeAttribute(a[d]);o.length===a.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==s.join(",")&&n.setAttribute("data-rh",s.join(","))}},K=function(e,t){var n=e.baseTag,r=e.htmlAttributes,o=e.linkTags,a=e.metaTags,s=e.noscriptTags,i=e.onChangeClientState,l=e.scriptTags,c=e.styleTags,u=e.title,d=e.titleAttributes;W(h.BODY,e.bodyAttributes),W(h.HTML,r),function(e,t){void 0!==e&&document.title!==e&&(document.title=P(e)),W(h.TITLE,t)}(u,d);var p={baseTag:G(h.BASE,n),linkTags:G(h.LINK,o),metaTags:G(h.META,a),noscriptTags:G(h.NOSCRIPT,s),scriptTags:G(h.SCRIPT,l),styleTags:G(h.STYLE,c)},f={},g={};Object.keys(p).forEach((function(e){var t=p[e],n=t.newTags,r=t.oldTags;n.length&&(f[e]=n),r.length&&(g[e]=p[e].oldTags)})),t&&t(),i(e,f,g)},Q=null,Y=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).rendered=!1,t}f(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!d()(e,this.props)},n.componentDidUpdate=function(){this.emitChange()},n.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},n.emitChange=function(){var e,t,n=this.props.context,r=n.setHelmet,o=null,a=(e=n.helmetInstances.get().map((function(e){var t=p({},e.props);return delete t.context,t})),{baseTag:O(["href"],e),bodyAttributes:E("bodyAttributes",e),defer:k(e,"defer"),encode:k(e,"encodeSpecialCharacters"),htmlAttributes:E("htmlAttributes",e),linkTags:C(h.LINK,["rel","href"],e),metaTags:C(h.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:C(h.NOSCRIPT,["innerHTML"],e),onChangeClientState:_(e),scriptTags:C(h.SCRIPT,["src","innerHTML"],e),styleTags:C(h.STYLE,["cssText"],e),title:S(e),titleAttributes:E("titleAttributes",e),prioritizeSeoTags:A(e,"prioritizeSeoTags")});V.canUseDOM?(t=a,Q&&cancelAnimationFrame(Q),t.defer?Q=requestAnimationFrame((function(){K(t,(function(){Q=null}))})):(K(t),Q=null)):B&&(o=B(a)),r(o)},n.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},n.render=function(){return this.init(),null},t}(r.Component);Y.propTypes={context:$.isRequired},Y.displayName="HelmetDispatcher";var Z=["children"],J=["children"],X=function(e){function t(){return e.apply(this,arguments)||this}f(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!i()(I(this.props,"helmetData"),I(e,"helmetData"))},n.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case h.SCRIPT:case h.NOSCRIPT:return{innerHTML:t};case h.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,r=e.arrayTypeChildren;return p({},r,((t={})[n.type]=[].concat(r[n.type]||[],[p({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,r=e.child,o=e.newProps,a=e.newChildProps,s=e.nestedChildren;switch(r.type){case h.TITLE:return p({},o,((t={})[r.type]=s,t.titleAttributes=p({},a),t));case h.BODY:return p({},o,{bodyAttributes:p({},a)});case h.HTML:return p({},o,{htmlAttributes:p({},a)});default:return p({},o,((n={})[r.type]=p({},a),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=p({},t);return Object.keys(e).forEach((function(t){var r;n=p({},n,((r={})[t]=e[t],r))})),n},n.warnOnInvalidChildren=function(e,t){return c()(w.some((function(t){return e.type===t})),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+w.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),c()(!t||"string"==typeof t||Array.isArray(t)&&!t.some((function(e){return"string"!=typeof e})),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,o={};return r.Children.forEach(e,(function(e){if(e&&e.props){var r=e.props,a=r.children,s=m(r,Z),i=Object.keys(s).reduce((function(e,t){return e[j[t]||t]=s[t],e}),{}),l=e.type;switch("symbol"==typeof l?l=l.toString():n.warnOnInvalidChildren(e,a),l){case h.FRAGMENT:t=n.mapChildrenToProps(a,t);break;case h.LINK:case h.META:case h.NOSCRIPT:case h.SCRIPT:case h.STYLE:o=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:o,newChildProps:i,nestedChildren:a});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:i,nestedChildren:a})}}})),this.mapArrayTypeChildrenToProps(o,t)},n.render=function(){var e=this.props,t=e.children,n=m(e,J),o=p({},n),a=n.helmetData;return t&&(o=this.mapChildrenToProps(t,o)),!a||a instanceof U||(a=new U(a.context,a.instances)),a?r.createElement(Y,p({},o,{context:a.value,helmetData:void 0})):r.createElement(q.Consumer,null,(function(e){return r.createElement(Y,p({},o,{context:e}))}))},t}(r.Component);X.propTypes={base:a().object,bodyAttributes:a().object,children:a().oneOfType([a().arrayOf(a().node),a().node]),defaultTitle:a().string,defer:a().bool,encodeSpecialCharacters:a().bool,htmlAttributes:a().object,link:a().arrayOf(a().object),meta:a().arrayOf(a().object),noscript:a().arrayOf(a().object),onChangeClientState:a().func,script:a().arrayOf(a().object),style:a().arrayOf(a().object),title:a().string,titleAttributes:a().object,titleTemplate:a().string,prioritizeSeoTags:a().bool,helmetData:a().object},X.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},X.displayName="Helmet"},2799:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,i=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,d=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,g=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,h=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case d:case a:case i:case s:case f:return e;default:switch(e=e&&e.$$typeof){case c:case p:case h:case m:case l:return e;default:return t}}case o:return t}}}function j(e){return x(e)===d}t.AsyncMode=u,t.ConcurrentMode=d,t.ContextConsumer=c,t.ContextProvider=l,t.Element=r,t.ForwardRef=p,t.Fragment=a,t.Lazy=h,t.Memo=m,t.Portal=o,t.Profiler=i,t.StrictMode=s,t.Suspense=f,t.isAsyncMode=function(e){return j(e)||x(e)===u},t.isConcurrentMode=j,t.isContextConsumer=function(e){return x(e)===c},t.isContextProvider=function(e){return x(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return x(e)===p},t.isFragment=function(e){return x(e)===a},t.isLazy=function(e){return x(e)===h},t.isMemo=function(e){return x(e)===m},t.isPortal=function(e){return x(e)===o},t.isProfiler=function(e){return x(e)===i},t.isStrictMode=function(e){return x(e)===s},t.isSuspense=function(e){return x(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===i||e===s||e===f||e===g||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===l||e.$$typeof===c||e.$$typeof===p||e.$$typeof===v||e.$$typeof===y||e.$$typeof===w||e.$$typeof===b)},t.typeOf=x},4363:(e,t,n)=>{"use strict";e.exports=n(2799)},3259:(e,t,n)=>{"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}var i=n(6540),l=[],c=[];var u=i.createContext(null);function d(e){var t=e(),n={loading:!0,loaded:null,error:null};return n.promise=t.then((function(e){return n.loading=!1,n.loaded=e,e})).catch((function(e){throw n.loading=!1,n.error=e,e})),n}function p(e){var t={loading:!1,loaded:{},error:null},n=[];try{Object.keys(e).forEach((function(r){var o=d(e[r]);o.loading?t.loading=!0:(t.loaded[r]=o.loaded,t.error=o.error),n.push(o.promise),o.promise.then((function(e){t.loaded[r]=e})).catch((function(e){t.error=e}))}))}catch(r){t.error=r}return t.promise=Promise.all(n).then((function(e){return t.loading=!1,e})).catch((function(e){throw t.loading=!1,e})),t}function f(e,t){return i.createElement((n=e)&&n.__esModule?n.default:n,t);var n}function g(e,t){var d,p;if(!t.loading)throw new Error("react-loadable requires a `loading` component");var g=s({loader:null,loading:null,delay:200,timeout:null,render:f,webpack:null,modules:null},t),m=null;function h(){return m||(m=e(g.loader)),m.promise}return l.push(h),"function"==typeof g.webpack&&c.push((function(){if((0,g.webpack)().every((function(e){return void 0!==e&&void 0!==n.m[e]})))return h()})),p=d=function(t){function n(n){var r;return a(o(o(r=t.call(this,n)||this)),"retry",(function(){r.setState({error:null,loading:!0,timedOut:!1}),m=e(g.loader),r._loadModule()})),h(),r.state={error:m.error,pastDelay:!1,timedOut:!1,loading:m.loading,loaded:m.loaded},r}r(n,t),n.preload=function(){return h()};var s=n.prototype;return s.UNSAFE_componentWillMount=function(){this._loadModule()},s.componentDidMount=function(){this._mounted=!0},s._loadModule=function(){var e=this;if(this.context&&Array.isArray(g.modules)&&g.modules.forEach((function(t){e.context.report(t)})),m.loading){var t=function(t){e._mounted&&e.setState(t)};"number"==typeof g.delay&&(0===g.delay?this.setState({pastDelay:!0}):this._delay=setTimeout((function(){t({pastDelay:!0})}),g.delay)),"number"==typeof g.timeout&&(this._timeout=setTimeout((function(){t({timedOut:!0})}),g.timeout));var n=function(){t({error:m.error,loaded:m.loaded,loading:m.loading}),e._clearTimeouts()};m.promise.then((function(){return n(),null})).catch((function(e){return n(),null}))}},s.componentWillUnmount=function(){this._mounted=!1,this._clearTimeouts()},s._clearTimeouts=function(){clearTimeout(this._delay),clearTimeout(this._timeout)},s.render=function(){return this.state.loading||this.state.error?i.createElement(g.loading,{isLoading:this.state.loading,pastDelay:this.state.pastDelay,timedOut:this.state.timedOut,error:this.state.error,retry:this.retry}):this.state.loaded?g.render(this.state.loaded,this.props):null},n}(i.Component),a(d,"contextType",u),p}function m(e){return g(d,e)}m.Map=function(e){if("function"!=typeof e.render)throw new Error("LoadableMap requires a `render(loaded, props)` function");return g(p,e)};var h=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.prototype.render=function(){return i.createElement(u.Provider,{value:{report:this.props.report}},i.Children.only(this.props.children))},t}(i.Component);function b(e){for(var t=[];e.length;){var n=e.pop();t.push(n())}return Promise.all(t).then((function(){if(e.length)return b(e)}))}m.Capture=h,m.preloadAll=function(){return new Promise((function(e,t){b(l).then(e,t)}))},m.preloadReady=function(){return new Promise((function(e,t){b(c).then(e,e)}))},e.exports=m},2831:(e,t,n)=>{"use strict";n.d(t,{u:()=>s,v:()=>i});var r=n(6347),o=n(8168),a=n(6540);function s(e,t,n){return void 0===n&&(n=[]),e.some((function(e){var o=e.path?(0,r.B6)(t,e):n.length?n[n.length-1].match:r.Ix.computeRootMatch(t);return o&&(n.push({route:e,match:o}),e.routes&&s(e.routes,t,n)),o})),n}function i(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e?a.createElement(r.dO,n,e.map((function(e,n){return a.createElement(r.qh,{key:e.key||n,path:e.path,exact:e.exact,strict:e.strict,render:function(n){return e.render?e.render((0,o.A)({},n,{},t,{route:e})):a.createElement(e.component,(0,o.A)({},n,t,{route:e}))}})}))):null}},4625:(e,t,n)=>{"use strict";n.d(t,{I9:()=>d,Kd:()=>u,N_:()=>b,k2:()=>w});var r=n(6347),o=n(2892),a=n(6540),s=n(1513),i=n(8168),l=n(8587),c=n(8997),u=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).history=(0,s.zR)(t.props),t}return(0,o.A)(t,e),t.prototype.render=function(){return a.createElement(r.Ix,{history:this.history,children:this.props.children})},t}(a.Component);var d=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).history=(0,s.TM)(t.props),t}return(0,o.A)(t,e),t.prototype.render=function(){return a.createElement(r.Ix,{history:this.history,children:this.props.children})},t}(a.Component);var p=function(e,t){return"function"==typeof e?e(t):e},f=function(e,t){return"string"==typeof e?(0,s.yJ)(e,null,null,t):e},g=function(e){return e},m=a.forwardRef;void 0===m&&(m=g);var h=m((function(e,t){var n=e.innerRef,r=e.navigate,o=e.onClick,s=(0,l.A)(e,["innerRef","navigate","onClick"]),c=s.target,u=(0,i.A)({},s,{onClick:function(e){try{o&&o(e)}catch(t){throw e.preventDefault(),t}e.defaultPrevented||0!==e.button||c&&"_self"!==c||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||(e.preventDefault(),r())}});return u.ref=g!==m&&t||n,a.createElement("a",u)}));var b=m((function(e,t){var n=e.component,o=void 0===n?h:n,u=e.replace,d=e.to,b=e.innerRef,v=(0,l.A)(e,["component","replace","to","innerRef"]);return a.createElement(r.XZ.Consumer,null,(function(e){e||(0,c.A)(!1);var n=e.history,r=f(p(d,e.location),e.location),l=r?n.createHref(r):"",h=(0,i.A)({},v,{href:l,navigate:function(){var t=p(d,e.location),r=(0,s.AO)(e.location)===(0,s.AO)(f(t));(u||r?n.replace:n.push)(t)}});return g!==m?h.ref=t||b:h.innerRef=b,a.createElement(o,h)}))})),v=function(e){return e},y=a.forwardRef;void 0===y&&(y=v);var w=y((function(e,t){var n=e["aria-current"],o=void 0===n?"page":n,s=e.activeClassName,u=void 0===s?"active":s,d=e.activeStyle,g=e.className,m=e.exact,h=e.isActive,w=e.location,x=e.sensitive,j=e.strict,k=e.style,S=e.to,_=e.innerRef,E=(0,l.A)(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return a.createElement(r.XZ.Consumer,null,(function(e){e||(0,c.A)(!1);var n=w||e.location,s=f(p(S,n),n),l=s.pathname,O=l&&l.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),C=O?(0,r.B6)(n.pathname,{path:O,exact:m,sensitive:x,strict:j}):null,A=!!(h?h(C,n):C),P="function"==typeof g?g(A):g,T="function"==typeof k?k(A):k;A&&(P=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((function(e){return e})).join(" ")}(P,u),T=(0,i.A)({},T,d));var I=(0,i.A)({"aria-current":A&&o||null,className:P,style:T,to:s},E);return v!==y?I.ref=t||_:I.innerRef=_,a.createElement(b,I)}))}))},6347:(e,t,n)=>{"use strict";n.d(t,{B6:()=>k,Ix:()=>y,W6:()=>I,XZ:()=>v,dO:()=>P,qh:()=>S,zy:()=>R});var r=n(2892),o=n(6540),a=n(5556),s=n.n(a),i=n(1513),l=n(8997),c=n(8168),u=n(8505),d=n.n(u),p=(n(4363),n(8587)),f=(n(4146),1073741823),g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:{};var m=o.createContext||function(e,t){var n,a,i="__create-react-context-"+function(){var e="__global_unique_id__";return g[e]=(g[e]||0)+1}()+"__",l=function(e){function n(){for(var t,n,r,o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return(t=e.call.apply(e,[this].concat(a))||this).emitter=(n=t.props.value,r=[],{on:function(e){r.push(e)},off:function(e){r=r.filter((function(t){return t!==e}))},get:function(){return n},set:function(e,t){n=e,r.forEach((function(e){return e(n,t)}))}}),t}(0,r.A)(n,e);var o=n.prototype;return o.getChildContext=function(){var e;return(e={})[i]=this.emitter,e},o.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n,r=this.props.value,o=e.value;((a=r)===(s=o)?0!==a||1/a==1/s:a!=a&&s!=s)?n=0:(n="function"==typeof t?t(r,o):f,0!==(n|=0)&&this.emitter.set(e.value,n))}var a,s},o.render=function(){return this.props.children},n}(o.Component);l.childContextTypes=((n={})[i]=s().object.isRequired,n);var c=function(t){function n(){for(var e,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=t.call.apply(t,[this].concat(r))||this).observedBits=void 0,e.state={value:e.getValue()},e.onUpdate=function(t,n){0!=((0|e.observedBits)&n)&&e.setState({value:e.getValue()})},e}(0,r.A)(n,t);var o=n.prototype;return o.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?f:t},o.componentDidMount=function(){this.context[i]&&this.context[i].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?f:e},o.componentWillUnmount=function(){this.context[i]&&this.context[i].off(this.onUpdate)},o.getValue=function(){return this.context[i]?this.context[i].get():e},o.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},n}(o.Component);return c.contextTypes=((a={})[i]=s().object,a),{Provider:l,Consumer:c}},h=function(e){var t=m();return t.displayName=e,t},b=h("Router-History"),v=h("Router"),y=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._pendingLocation=e}))),n}(0,r.A)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){var e=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen((function(t){e._isMounted&&e.setState({location:t})}))),this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},n.render=function(){return o.createElement(v.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},o.createElement(b.Provider,{children:this.props.children||null,value:this.props.history}))},t}(o.Component);o.Component;o.Component;var w={},x=1e4,j=0;function k(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var n=t,r=n.path,o=n.exact,a=void 0!==o&&o,s=n.strict,i=void 0!==s&&s,l=n.sensitive,c=void 0!==l&&l;return[].concat(r).reduce((function(t,n){if(!n&&""!==n)return null;if(t)return t;var r=function(e,t){var n=""+t.end+t.strict+t.sensitive,r=w[n]||(w[n]={});if(r[e])return r[e];var o=[],a={regexp:d()(e,o,t),keys:o};return j<x&&(r[e]=a,j++),a}(n,{end:a,strict:i,sensitive:c}),o=r.regexp,s=r.keys,l=o.exec(e);if(!l)return null;var u=l[0],p=l.slice(1),f=e===u;return a&&!f?null:{path:n,url:"/"===n&&""===u?"/":u,isExact:f,params:s.reduce((function(e,t,n){return e[t.name]=p[n],e}),{})}}),null)}var S=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.A)(t,e),t.prototype.render=function(){var e=this;return o.createElement(v.Consumer,null,(function(t){t||(0,l.A)(!1);var n=e.props.location||t.location,r=e.props.computedMatch?e.props.computedMatch:e.props.path?k(n.pathname,e.props):t.match,a=(0,c.A)({},t,{location:n,match:r}),s=e.props,i=s.children,u=s.component,d=s.render;return Array.isArray(i)&&function(e){return 0===o.Children.count(e)}(i)&&(i=null),o.createElement(v.Provider,{value:a},a.match?i?"function"==typeof i?i(a):i:u?o.createElement(u,a):d?d(a):null:"function"==typeof i?i(a):null)}))},t}(o.Component);function _(e){return"/"===e.charAt(0)?e:"/"+e}function E(e,t){if(!e)return t;var n=_(e);return 0!==t.pathname.indexOf(n)?t:(0,c.A)({},t,{pathname:t.pathname.substr(n.length)})}function O(e){return"string"==typeof e?e:(0,i.AO)(e)}function C(e){return function(){(0,l.A)(!1)}}function A(){}o.Component;var P=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.A)(t,e),t.prototype.render=function(){var e=this;return o.createElement(v.Consumer,null,(function(t){t||(0,l.A)(!1);var n,r,a=e.props.location||t.location;return o.Children.forEach(e.props.children,(function(e){if(null==r&&o.isValidElement(e)){n=e;var s=e.props.path||e.props.from;r=s?k(a.pathname,(0,c.A)({},e.props,{path:s})):t.match}})),r?o.cloneElement(n,{location:a,computedMatch:r}):null}))},t}(o.Component);var T=o.useContext;function I(){return T(b)}function R(){return T(v).location}},8505:(e,t,n)=>{var r=n(4634);e.exports=f,e.exports.parse=a,e.exports.compile=function(e,t){return i(a(e,t),t)},e.exports.tokensToFunction=i,e.exports.tokensToRegExp=p;var o=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function a(e,t){for(var n,r=[],a=0,s=0,i="",u=t&&t.delimiter||"/";null!=(n=o.exec(e));){var d=n[0],p=n[1],f=n.index;if(i+=e.slice(s,f),s=f+d.length,p)i+=p[1];else{var g=e[s],m=n[2],h=n[3],b=n[4],v=n[5],y=n[6],w=n[7];i&&(r.push(i),i="");var x=null!=m&&null!=g&&g!==m,j="+"===y||"*"===y,k="?"===y||"*"===y,S=n[2]||u,_=b||v;r.push({name:h||a++,prefix:m||"",delimiter:S,optional:k,repeat:j,partial:x,asterisk:!!w,pattern:_?c(_):w?".*":"[^"+l(S)+"]+?"})}}return s<e.length&&(i+=e.substr(s)),i&&r.push(i),r}function s(e){return encodeURI(e).replace(/[\/?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function i(e,t){for(var n=new Array(e.length),o=0;o<e.length;o++)"object"==typeof e[o]&&(n[o]=new RegExp("^(?:"+e[o].pattern+")$",d(t)));return function(t,o){for(var a="",i=t||{},l=(o||{}).pretty?s:encodeURIComponent,c=0;c<e.length;c++){var u=e[c];if("string"!=typeof u){var d,p=i[u.name];if(null==p){if(u.optional){u.partial&&(a+=u.prefix);continue}throw new TypeError('Expected "'+u.name+'" to be defined')}if(r(p)){if(!u.repeat)throw new TypeError('Expected "'+u.name+'" to not repeat, but received `'+JSON.stringify(p)+"`");if(0===p.length){if(u.optional)continue;throw new TypeError('Expected "'+u.name+'" to not be empty')}for(var f=0;f<p.length;f++){if(d=l(p[f]),!n[c].test(d))throw new TypeError('Expected all "'+u.name+'" to match "'+u.pattern+'", but received `'+JSON.stringify(d)+"`");a+=(0===f?u.prefix:u.delimiter)+d}}else{if(d=u.asterisk?encodeURI(p).replace(/[?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):l(p),!n[c].test(d))throw new TypeError('Expected "'+u.name+'" to match "'+u.pattern+'", but received "'+d+'"');a+=u.prefix+d}}else a+=u}return a}}function l(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function c(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function u(e,t){return e.keys=t,e}function d(e){return e&&e.sensitive?"":"i"}function p(e,t,n){r(t)||(n=t||n,t=[]);for(var o=(n=n||{}).strict,a=!1!==n.end,s="",i=0;i<e.length;i++){var c=e[i];if("string"==typeof c)s+=l(c);else{var p=l(c.prefix),f="(?:"+c.pattern+")";t.push(c),c.repeat&&(f+="(?:"+p+f+")*"),s+=f=c.optional?c.partial?p+"("+f+")?":"(?:"+p+"("+f+"))?":p+"("+f+")"}}var g=l(n.delimiter||"/"),m=s.slice(-g.length)===g;return o||(s=(m?s.slice(0,-g.length):s)+"(?:"+g+"(?=$))?"),s+=a?"$":o&&m?"":"(?="+g+"|$)",u(new RegExp("^"+s,d(n)),t)}function f(e,t,n){return r(t)||(n=t||n,t=[]),n=n||{},e instanceof RegExp?function(e,t){var n=e.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)t.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return u(e,t)}(e,t):r(e)?function(e,t,n){for(var r=[],o=0;o<e.length;o++)r.push(f(e[o],t,n).source);return u(new RegExp("(?:"+r.join("|")+")",d(n)),t)}(e,t,n):function(e,t,n){return p(a(e,n),t,n)}(e,t,n)}},1020:(e,t,n)=>{"use strict";var r=n(6540),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,a={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,r)&&!l.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===a[r]&&(a[r]=t[r]);return{$$typeof:o,type:e,key:c,ref:u,props:a,_owner:i.current}}t.Fragment=a,t.jsx=c,t.jsxs=c},5287:(e,t)=>{"use strict";var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.iterator;var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,h={};function b(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||g}function v(){}function y(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||g}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=b.prototype;var w=y.prototype=new v;w.constructor=y,m(w,b.prototype),w.isPureReactComponent=!0;var x=Array.isArray,j=Object.prototype.hasOwnProperty,k={current:null},S={key:!0,ref:!0,__self:!0,__source:!0};function _(e,t,r){var o,a={},s=null,i=null;if(null!=t)for(o in void 0!==t.ref&&(i=t.ref),void 0!==t.key&&(s=""+t.key),t)j.call(t,o)&&!S.hasOwnProperty(o)&&(a[o]=t[o]);var l=arguments.length-2;if(1===l)a.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(o in l=e.defaultProps)void 0===a[o]&&(a[o]=l[o]);return{$$typeof:n,type:e,key:s,ref:i,props:a,_owner:k.current}}function E(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var O=/\/+/g;function C(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function A(e,t,o,a,s){var i=typeof e;"undefined"!==i&&"boolean"!==i||(e=null);var l=!1;if(null===e)l=!0;else switch(i){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case n:case r:l=!0}}if(l)return s=s(l=e),e=""===a?"."+C(l,0):a,x(s)?(o="",null!=e&&(o=e.replace(O,"$&/")+"/"),A(s,t,o,"",(function(e){return e}))):null!=s&&(E(s)&&(s=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,o+(!s.key||l&&l.key===s.key?"":(""+s.key).replace(O,"$&/")+"/")+e)),t.push(s)),1;if(l=0,a=""===a?".":a+":",x(e))for(var c=0;c<e.length;c++){var u=a+C(i=e[c],c);l+=A(i,t,o,u,s)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(i=e.next()).done;)l+=A(i=i.value,t,o,u=a+C(i,c++),s);else if("object"===i)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return l}function P(e,t,n){if(null==e)return e;var r=[],o=0;return A(e,r,"","",(function(e){return t.call(n,e,o++)})),r}function T(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var I={current:null},R={transition:null},N={ReactCurrentDispatcher:I,ReactCurrentBatchConfig:R,ReactCurrentOwner:k};t.Children={map:P,forEach:function(e,t,n){P(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return P(e,(function(){t++})),t},toArray:function(e){return P(e,(function(e){return e}))||[]},only:function(e){if(!E(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=b,t.Fragment=o,t.Profiler=s,t.PureComponent=y,t.StrictMode=a,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=N,t.cloneElement=function(e,t,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=m({},e.props),a=e.key,s=e.ref,i=e._owner;if(null!=t){if(void 0!==t.ref&&(s=t.ref,i=k.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)j.call(t,c)&&!S.hasOwnProperty(c)&&(o[c]=void 0===t[c]&&void 0!==l?l[c]:t[c])}var c=arguments.length-2;if(1===c)o.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];o.children=l}return{$$typeof:n,type:e.type,key:a,ref:s,props:o,_owner:i}},t.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:i,_context:e},e.Consumer=e},t.createElement=_,t.createFactory=function(e){var t=_.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=E,t.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:T}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=R.transition;R.transition={};try{e()}finally{R.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return I.current.useCallback(e,t)},t.useContext=function(e){return I.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return I.current.useDeferredValue(e)},t.useEffect=function(e,t){return I.current.useEffect(e,t)},t.useId=function(){return I.current.useId()},t.useImperativeHandle=function(e,t,n){return I.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return I.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return I.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return I.current.useMemo(e,t)},t.useReducer=function(e,t,n){return I.current.useReducer(e,t,n)},t.useRef=function(e){return I.current.useRef(e)},t.useState=function(e){return I.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return I.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return I.current.useTransition()},t.version="18.2.0"},6540:(e,t,n)=>{"use strict";e.exports=n(5287)},4848:(e,t,n)=>{"use strict";e.exports=n(1020)},7463:(e,t)=>{"use strict";function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<a(o,t)))break e;e[r]=t,e[n]=o,n=r}}function r(e){return 0===e.length?null:e[0]}function o(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,s=o>>>1;r<s;){var i=2*(r+1)-1,l=e[i],c=i+1,u=e[c];if(0>a(l,n))c<o&&0>a(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[i]=n,r=i);else{if(!(c<o&&0>a(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var i=Date,l=i.now();t.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,p=null,f=3,g=!1,m=!1,h=!1,b="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var t=r(u);null!==t;){if(null===t.callback)o(u);else{if(!(t.startTime<=e))break;o(u),t.sortIndex=t.expirationTime,n(c,t)}t=r(u)}}function x(e){if(h=!1,w(e),!m)if(null!==r(c))m=!0,R(j);else{var t=r(u);null!==t&&N(x,t.startTime-e)}}function j(e,n){m=!1,h&&(h=!1,v(E),E=-1),g=!0;var a=f;try{for(w(n),p=r(c);null!==p&&(!(p.expirationTime>n)||e&&!A());){var s=p.callback;if("function"==typeof s){p.callback=null,f=p.priorityLevel;var i=s(p.expirationTime<=n);n=t.unstable_now(),"function"==typeof i?p.callback=i:p===r(c)&&o(c),w(n)}else o(c);p=r(c)}if(null!==p)var l=!0;else{var d=r(u);null!==d&&N(x,d.startTime-n),l=!1}return l}finally{p=null,f=a,g=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var k,S=!1,_=null,E=-1,O=5,C=-1;function A(){return!(t.unstable_now()-C<O)}function P(){if(null!==_){var e=t.unstable_now();C=e;var n=!0;try{n=_(!0,e)}finally{n?k():(S=!1,_=null)}}else S=!1}if("function"==typeof y)k=function(){y(P)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,I=T.port2;T.port1.onmessage=P,k=function(){I.postMessage(null)}}else k=function(){b(P,0)};function R(e){_=e,S||(S=!0,k())}function N(e,n){E=b((function(){e(t.unstable_now())}),n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){m||g||(m=!0,R(j))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},t.unstable_scheduleCallback=function(e,o,a){var s=t.unstable_now();switch("object"==typeof a&&null!==a?a="number"==typeof(a=a.delay)&&0<a?s+a:s:a=s,e){case 1:var i=-1;break;case 2:i=250;break;case 5:i=1073741823;break;case 4:i=1e4;break;default:i=5e3}return e={id:d++,callback:o,priorityLevel:e,startTime:a,expirationTime:i=a+i,sortIndex:-1},a>s?(e.sortIndex=a,n(u,e),null===r(c)&&e===r(u)&&(h?(v(E),E=-1):h=!0,N(x,a-s))):(e.sortIndex=i,n(c,e),m||g||(m=!0,R(j))),e},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}},9982:(e,t,n)=>{"use strict";e.exports=n(7463)},2833:e=>{e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(var i=Object.prototype.hasOwnProperty.bind(t),l=0;l<a.length;l++){var c=a[l];if(!i(c))return!1;var u=e[c],d=t[c];if(!1===(o=n?n.call(r,u,d,c):void 0)||void 0===o&&u!==d)return!1}return!0}},8997:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=!0,o="Invariant failed";function a(e,t){if(!e){if(r)throw new Error(o);var n="function"==typeof t?t():t;throw new Error(n?o+": "+n:o)}}},4784:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={title:"jest-preset-angular",tagline:"Jest preset configuration for Angular projects.",url:"https://thymikee.github.io",baseUrl:"/jest-preset-angular/",baseUrlIssueBanner:!0,onBrokenLinks:"throw",onBrokenMarkdownLinks:"warn",favicon:"img/logo.svg",organizationName:"thymikee",projectName:"jest-preset-angular",plugins:[["@docusaurus/plugin-ideal-image",{quality:70,max:1030,min:640,steps:2}],["@docusaurus/plugin-pwa",{debug:!1,offlineModeActivationStrategies:["appInstalled","queryString"],pwaHead:[{tagName:"link",rel:"icon",href:"img/logo.svg"},{tagName:"link",rel:"manifest",href:"/jest-preset-angular/manifest.json"},{tagName:"meta",name:"theme-color",content:"rgb(37, 194, 160)"},{tagName:"meta",name:"apple-mobile-web-app-capable",content:"yes"},{tagName:"meta",name:"apple-mobile-web-app-status-bar-style",content:"#000"},{tagName:"link",rel:"apple-touch-icon",href:"img/logo.png"},{tagName:"link",rel:"mask-icon",href:"img/logo.svg",color:"rgb(62, 204, 94)"},{tagName:"meta",name:"msapplication-TileImage",content:"img/logo.png"},{tagName:"meta",name:"msapplication-TileColor",content:"#000"}]}]],presets:[["@docusaurus/preset-classic",{docs:{showLastUpdateAuthor:!0,showLastUpdateTime:!0,sidebarPath:"/home/runner/work/jest-preset-angular/jest-preset-angular/website/sidebars.json",editUrl:"https://github.com/thymikee/jest-preset-angular/edit/main/website",remarkPlugins:[[null,{sync:!0}],null]},theme:{customCss:"/home/runner/work/jest-preset-angular/jest-preset-angular/website/src/css/custom.css"}}]],themeConfig:{algolia:{appId:"2L8AIIEZVK",apiKey:"3b46e8c83d66424bede0e97b3de3bc11",indexName:"jest-preset-angular",contextualSearch:!0,searchParameters:{},searchPagePath:"search"},docs:{sidebar:{hideable:!0,autoCollapseCategories:!1},versionPersistence:"localStorage"},colorMode:{defaultMode:"light",disableSwitch:!1,respectPrefersColorScheme:!0},announcementBar:{id:"supportus",content:'\u2b50\ufe0f If you like jest-preset-angular, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/thymikee/jest-preset-angular">GitHub</a>! \u2b50\ufe0f',isCloseable:!0},prism:{theme:{plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},darkTheme:{plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},additionalLanguages:[],magicComments:[{className:"theme-code-block-highlighted-line",line:"highlight-next-line",block:{start:"highlight-start",end:"highlight-end"}}]},navbar:{hideOnScroll:!0,title:"jest-preset-angular",logo:{alt:"jest-preset-angular logo",src:"img/logo.svg"},items:[{to:"docs/",activeBasePath:"docs",label:"Docs",position:"left"},{type:"docsVersionDropdown",position:"right",dropdownActiveClassDisabled:!0,dropdownItemsAfter:[{to:"/versions",label:"All versions"}],dropdownItemsBefore:[]},{href:"https://github.com/thymikee/jest-preset-angular",position:"right",className:"header-github-link","aria-label":"GitHub repository"}]},footer:{style:"dark",links:[{title:"Learn",items:[{label:"Introduction",to:"docs/"},{label:"Installation",to:"docs/getting-started/installation"},{label:"Angular Ivy",to:"docs/guides/angular-ivy"}]},{title:"Community",items:[{label:"Jest",href:"https://stackoverflow.com/questions/tagged/jest"},{label:"Discord",href:"https://discord.gg/j6FKKQQrW9"}]},{title:"More",items:[{label:"GitHub",href:"https://github.com/thymikee/jest-preset-angular/"}]}],copyright:"Copyright \xa9 2025 jest-preset-angular. Built with Docusaurus."},blog:{sidebar:{groupByYear:!0}},metadata:[],tableOfContents:{minHeadingLevel:2,maxHeadingLevel:3}},i18n:{defaultLocale:"en",path:"i18n",locales:["en"],localeConfigs:{}},future:{experimental_faster:{swcJsLoader:!1,swcJsMinimizer:!1,swcHtmlMinimizer:!1,lightningCssMinimizer:!1,mdxCrossCompilerCache:!1,rspackBundler:!1},experimental_storage:{type:"localStorage",namespace:!1},experimental_router:"browser"},onBrokenAnchors:"warn",onDuplicateRoutes:"warn",staticDirectories:["static"],customFields:{},themes:[],scripts:[],headTags:[],stylesheets:[],clientModules:[],titleDelimiter:"|",noIndex:!1,markdown:{format:"mdx",mermaid:!1,mdx1Compat:{comments:!0,admonitions:!0,headingIds:!0},anchors:{maintainCase:!1}}}},8168:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(null,arguments)}n.d(t,{A:()=>r})},2892:(e,t,n)=>{"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}n.d(t,{A:()=>o})},8587:(e,t,n)=>{"use strict";function r(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}n.d(t,{A:()=>r})},4164:(e,t,n)=>{"use strict";function r(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=r(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}n.d(t,{A:()=>o});const o=function(){for(var e,t,n=0,o="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=r(e))&&(o&&(o+=" "),o+=t);return o}},1765:(e,t,n)=>{"use strict";n.d(t,{My:()=>x,f4:()=>K});var r,o,a=n(6540),s=n(4164),i=Object.create,l=Object.defineProperty,c=Object.defineProperties,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,g=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,b=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v=(e,t)=>{for(var n in t||(t={}))m.call(t,n)&&b(e,n,t[n]);if(f)for(var n of f(t))h.call(t,n)&&b(e,n,t[n]);return e},y=(e,t)=>c(e,d(t)),w=(e,t)=>{var n={};for(var r in e)m.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&f)for(var r of f(e))t.indexOf(r)<0&&h.call(e,r)&&(n[r]=e[r]);return n},x=((e,t,n)=>(n=null!=e?i(g(e)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of p(t))m.call(e,o)||o===n||l(e,o,{get:()=>t[o],enumerable:!(r=u(t,o))||r.enumerable});return e})(!t&&e&&e.__esModule?n:l(n,"default",{value:e,enumerable:!0}),e)))((r={"../../node_modules/.pnpm/prismjs@1.29.0_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(e,t){var n=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof o?new o(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(t,n){var o,a;switch(n=n||{},r.util.type(t)){case"Object":if(a=r.util.objId(t),n[a])return n[a];for(var s in o={},n[a]=o,t)t.hasOwnProperty(s)&&(o[s]=e(t[s],n));return o;case"Array":return a=r.util.objId(t),n[a]?n[a]:(o=[],n[a]=o,t.forEach((function(t,r){o[r]=e(t,n)})),o);default:return t}},getLanguage:function(t){for(;t;){var n=e.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement}return"none"},setLanguage:function(t,n){t.className=t.className.replace(RegExp(e,"gi"),""),t.classList.add("language-"+n)},isActive:function(e,t,n){for(var r="no-"+t;e;){var o=e.classList;if(o.contains(t))return!0;if(o.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var o in t)n[o]=t[o];return n},insertBefore:function(e,t,n,o){var a=(o=o||r.languages)[e],s={};for(var i in a)if(a.hasOwnProperty(i)){if(i==t)for(var l in n)n.hasOwnProperty(l)&&(s[l]=n[l]);n.hasOwnProperty(i)||(s[i]=a[i])}var c=o[e];return o[e]=s,r.languages.DFS(r.languages,(function(t,n){n===c&&t!=e&&(this[t]=s)})),s},DFS:function e(t,n,o,a){a=a||{};var s=r.util.objId;for(var i in t)if(t.hasOwnProperty(i)){n.call(t,i,t[i],o||i);var l=t[i],c=r.util.type(l);"Object"!==c||a[s(l)]?"Array"!==c||a[s(l)]||(a[s(l)]=!0,e(l,n,i,a)):(a[s(l)]=!0,e(l,n,null,a))}}},plugins:{},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};if(r.hooks.run("before-tokenize",a),!a.grammar)throw new Error('The language "'+a.language+'" has no grammar.');return a.tokens=r.tokenize(a.code,a.grammar),r.hooks.run("after-tokenize",a),o.stringify(r.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var o=new i;return l(o,o.head,e),s(e,o,t,o.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(o)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var o,a=0;o=n[a++];)o(t)}},Token:o};function o(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function a(e,t,n,r){e.lastIndex=t;var o=e.exec(n);if(o&&r&&o[1]){var a=o[1].length;o.index+=a,o[0]=o[0].slice(a)}return o}function s(e,t,n,i,u,d){for(var p in n)if(n.hasOwnProperty(p)&&n[p]){var f=n[p];f=Array.isArray(f)?f:[f];for(var g=0;g<f.length;++g){if(d&&d.cause==p+","+g)return;var m=f[g],h=m.inside,b=!!m.lookbehind,v=!!m.greedy,y=m.alias;if(v&&!m.pattern.global){var w=m.pattern.toString().match(/[imsuy]*$/)[0];m.pattern=RegExp(m.pattern.source,w+"g")}for(var x=m.pattern||m,j=i.next,k=u;j!==t.tail&&!(d&&k>=d.reach);k+=j.value.length,j=j.next){var S=j.value;if(t.length>e.length)return;if(!(S instanceof o)){var _,E=1;if(v){if(!(_=a(x,k,e,b))||_.index>=e.length)break;var O=_.index,C=_.index+_[0].length,A=k;for(A+=j.value.length;O>=A;)A+=(j=j.next).value.length;if(k=A-=j.value.length,j.value instanceof o)continue;for(var P=j;P!==t.tail&&(A<C||"string"==typeof P.value);P=P.next)E++,A+=P.value.length;E--,S=e.slice(k,A),_.index-=k}else if(!(_=a(x,0,S,b)))continue;O=_.index;var T=_[0],I=S.slice(0,O),R=S.slice(O+T.length),N=k+S.length;d&&N>d.reach&&(d.reach=N);var L=j.prev;if(I&&(L=l(t,L,I),k+=I.length),c(t,L,E),j=l(t,L,new o(p,h?r.tokenize(T,h):T,y,T)),R&&l(t,j,R),E>1){var D={cause:p+","+g,reach:N};s(e,t,n,j.prev,k,D),d&&D.reach>d.reach&&(d.reach=D.reach)}}}}}}function i(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,o={value:n,prev:t,next:r};return t.next=o,r.prev=o,e.length++,o}function c(e,t,n){for(var r=t.next,o=0;o<n&&r!==e.tail;o++)r=r.next;t.next=r,r.prev=t,e.length-=o}return o.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var o="";return t.forEach((function(t){o+=e(t,n)})),o}var a={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(a.classes,s):a.classes.push(s)),r.hooks.run("wrap",a);var i="";for(var l in a.attributes)i+=" "+l+'="'+(a.attributes[l]||"").replace(/"/g,""")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+i+">"+a.content+"</"+a.tag+">"},r}();t.exports=n,n.default=n}},function(){return o||(0,r[p(r)[0]])((o={exports:{}}).exports,o),o.exports})());x.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},x.languages.markup.tag.inside["attr-value"].inside.entity=x.languages.markup.entity,x.languages.markup.doctype.inside["internal-subset"].inside=x.languages.markup,x.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(x.languages.markup.tag,"addInlined",{value:function(e,t){var n;(t=((n=((n={})["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:x.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}}))["language-"+t]={pattern:/[\s\S]+/,inside:x.languages[t]},{}))[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:n},x.languages.insertBefore("markup","cdata",t)}}),Object.defineProperty(x.languages.markup.tag,"addAttribute",{value:function(e,t){x.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:x.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),x.languages.html=x.languages.markup,x.languages.mathml=x.languages.markup,x.languages.svg=x.languages.markup,x.languages.xml=x.languages.extend("markup",{}),x.languages.ssml=x.languages.xml,x.languages.atom=x.languages.xml,x.languages.rss=x.languages.xml,function(e){var t={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},n=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,r="(?:[^\\\\-]|"+n.source+")",o=(r=RegExp(r+"-"+r),{pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"});e.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:r,inside:{escape:n,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":t,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},escape:n}},"special-escape":t,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":o}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:n,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:"punctuation",inside:{"group-name":o}},{pattern:/\)/,alias:"punctuation"}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:"number"},alternation:{pattern:/\|/,alias:"keyword"}}}(x),x.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},x.languages.javascript=x.languages.extend("clike",{"class-name":[x.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),x.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,x.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:x.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:x.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:x.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:x.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:x.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),x.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:x.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),x.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),x.languages.markup&&(x.languages.markup.tag.addInlined("script","javascript"),x.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),x.languages.js=x.languages.javascript,x.languages.actionscript=x.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),x.languages.actionscript["class-name"].alias="function",delete x.languages.actionscript.parameter,delete x.languages.actionscript["literal-property"],x.languages.markup&&x.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:x.languages.markup}}),function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(x),function(e){var t=e.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(t,"addSupport",{value:function(t,n){(t="string"==typeof t?[t]:t).forEach((function(t){var r=function(e){e.inside||(e.inside={}),e.inside.rest=n},o="doc-comment";if(a=e.languages[t]){var a,s=a[o];if((s=s||(a=e.languages.insertBefore(t,"comment",{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:"comment"}}))[o])instanceof RegExp&&(s=a[o]={pattern:s}),Array.isArray(s))for(var i=0,l=s.length;i<l;i++)s[i]instanceof RegExp&&(s[i]={pattern:s[i]}),r(s[i]);else r(s)}}))}}),t.addSupport(["java","javascript","php"],t)}(x),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;(t=(e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup))&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))}(x),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,n=(t=(e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+t.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),{pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0});e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,number:n})}(x),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",o=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function s(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<value>>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<key>>/g,(function(){return"(?:"+o+"|"+a+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:s(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:s(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:s(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:s(a),lookbehind:!0,greedy:!0},number:{pattern:s(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(x),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source,s=(e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+a+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+a+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n<r;n++){var o,a=t[n];"code"!==a.type?e(a.content):(o=a.content[1],a=a.content[3],o&&a&&"code-language"===o.type&&"code-block"===a.type&&"string"==typeof o.content&&(o=o.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),o="language-"+(o=(/[a-z][\w-]*/i.exec(o)||[""])[0].toLowerCase()),a.alias?"string"==typeof a.alias?a.alias=[a.alias,o]:a.alias.push(o):a.alias=[o]))}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,o=t.classes.length;r<o;r++){var a=t.classes[r];if(a=/language-(.+)/.exec(a)){n=a[1];break}}var c,u=e.languages[n];u?t.content=e.highlight(t.content.replace(s,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;return"#"===(t=t.toLowerCase())[0]?(n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),l(n)):i[t]||e})),u,n):n&&"none"!==n&&e.plugins.autoloader&&(c="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random()),t.attributes.id=c,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(c);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))})))}})),RegExp(e.languages.markup.tag.pattern.source,"gi")),i={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(x),x.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:x.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},x.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),n=0;n<t.length;){var r=t[n++];if("keyword"===r.type&&"mutation"===r.content){var o=[];if(d(["definition-mutation","punctuation"])&&"("===u(1).content){n+=2;var a=p(/^\($/,/^\)$/);if(-1===a)continue;for(;n<a;n++){var s=u(0);"variable"===s.type&&(f(s,"variable-input"),o.push(s.content))}n=a+1}if(d(["punctuation","property-query"])&&"{"===u(0).content&&(n++,f(u(0),"property-mutation"),0<o.length)){var i=p(/^\{$/,/^\}$/);if(-1!==i)for(var l=n;l<i;l++){var c=t[l];"variable"===c.type&&0<=o.indexOf(c.content)&&f(c,"variable-input")}}}}function u(e){return t[n+e]}function d(e,t){t=t||0;for(var n=0;n<e.length;n++){var r=u(n+t);if(!r||r.type!==e[n])return}return 1}function p(e,r){for(var o=1,a=n;a<t.length;a++){var s=t[a],i=s.content;if("punctuation"===s.type&&"string"==typeof i)if(e.test(i))o++;else if(r.test(i)&&0==--o)return a}return-1}function f(e,t){var n=e.alias;n?Array.isArray(n)||(e.alias=n=[n]):e.alias=n=[],n.push(t)}})),x.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,o=r.inside["interpolation-punctuation"],a=r.pattern.source;function s(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function i(t,n,r){return t={code:t,grammar:n,language:r},e.hooks.run("before-tokenize",t),t.tokens=e.tokenize(t.code,t.grammar),e.hooks.run("after-tokenize",t),t.tokens}function l(t,n,s){var l=e.tokenize(t,{interpolation:{pattern:RegExp(a),lookbehind:!0}}),c=0,u={},d=(l=i(l.map((function(e){if("string"==typeof e)return e;var n,r;for(e=e.content;-1!==t.indexOf((r=c++,n="___"+s.toUpperCase()+"_"+r+"___")););return u[n]=e,n})).join(""),n,s),Object.keys(u));return c=0,function t(n){for(var a=0;a<n.length;a++){if(c>=d.length)return;var s,l,p,f,g,m,h,b=n[a];"string"==typeof b||"string"==typeof b.content?(s=d[c],-1!==(h=(m="string"==typeof b?b:b.content).indexOf(s))&&(++c,l=m.substring(0,h),g=u[s],p=void 0,(f={})["interpolation-punctuation"]=o,3===(f=e.tokenize(g,f)).length&&((p=[1,1]).push.apply(p,i(f[1],e.languages.javascript,"javascript")),f.splice.apply(f,p)),p=new e.Token("interpolation",f,r.alias,g),f=m.substring(h+s.length),g=[],l&&g.push(l),g.push(p),f&&(t(m=[f]),g.push.apply(g,m)),"string"==typeof b?(n.splice.apply(n,[a,1].concat(g)),a+=g.length-1):b.content=g)):(h=b.content,Array.isArray(h)?t(h):t([h]))}}(l),new e.Token(s,l,"language-"+s,t)}e.languages.javascript["template-string"]=[s("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),s("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),s("svg",/\bsvg/.source),s("markdown",/\b(?:markdown|md)/.source),s("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),s("sql",/\bsql/.source),t].filter(Boolean);var c={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function u(e){return"string"==typeof e?e:Array.isArray(e)?e.map(u).join(""):u(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in c&&function t(n){for(var r=0,o=n.length;r<o;r++){var a,s,i,c=n[r];"string"!=typeof c&&(a=c.content,Array.isArray(a)?"template-string"===c.type?(c=a[1],3===a.length&&"string"!=typeof c&&"embedded-code"===c.type&&(s=u(c),c=c.alias,c=Array.isArray(c)?c[0]:c,i=e.languages[c])&&(a[1]=l(s,i,c))):t(a):"string"!=typeof a&&t([a]))}}(t.tokens)}))}(x),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(x),function(e){var t=e.languages.javascript,n=/\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})+\}/.source,r="(@(?:arg|argument|param|property)\\s+(?:"+n+"\\s+)?)";e.languages.jsdoc=e.languages.extend("javadoclike",{parameter:{pattern:RegExp(r+/(?:(?!\s)[$\w\xA0-\uFFFF.])+(?=\s|$)/.source),lookbehind:!0,inside:{punctuation:/\./}}}),e.languages.insertBefore("jsdoc","keyword",{"optional-parameter":{pattern:RegExp(r+/\[(?:(?!\s)[$\w\xA0-\uFFFF.])+(?:=[^[\]]+)?\](?=\s|$)/.source),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:t,alias:"language-javascript"},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(/(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\s+(?:<TYPE>\s+)?)[A-Z]\w*(?:\.[A-Z]\w*)*/.source.replace(/<TYPE>/g,(function(){return n}))),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp("(@[a-z]+\\s+)"+n),lookbehind:!0,inside:{string:t.string,number:t.number,boolean:t.boolean,keyword:e.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:t,alias:"language-javascript"}}}}),e.languages.javadoclike.addSupport("javascript",e.languages.jsdoc)}(x),function(e){e.languages.flow=e.languages.extend("javascript",{}),e.languages.insertBefore("flow","keyword",{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:"class-name"}]}),e.languages.flow["function-variable"].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete e.languages.flow.parameter,e.languages.insertBefore("flow","operator",{"flow-punctuation":{pattern:/\{\||\|\}/,alias:"punctuation"}}),Array.isArray(e.languages.flow.keyword)||(e.languages.flow.keyword=[e.languages.flow.keyword]),e.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0})}(x),x.languages.n4js=x.languages.extend("javascript",{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),x.languages.insertBefore("n4js","constant",{annotation:{pattern:/@+\w+/,alias:"operator"}}),x.languages.n4jsd=x.languages.n4js,function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r<n.length;r++){var o=n[r],a=e.languages.javascript[o];o=(a="RegExp"===e.util.type(a)?e.languages.javascript[o]={pattern:a}:a).inside||{};(a.inside=o)["maybe-class-name"]=/^[A-Z][\s\S]*/}}(x),function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function a(e,t){return e=e.replace(/<S>/g,(function(){return n})).replace(/<BRACES>/g,(function(){return r})).replace(/<SPREAD>/g,(function(){return o})),RegExp(e,t)}function s(t){for(var n=[],r=0;r<t.length;r++){var o=t[r],a=!1;"string"!=typeof o&&("tag"===o.type&&o.content[0]&&"tag"===o.content[0].type?"</"===o.content[0].content[0].content?0<n.length&&n[n.length-1].tagName===i(o.content[0].content[1])&&n.pop():"/>"!==o.content[o.content.length-1].content&&n.push({tagName:i(o.content[0].content[1]),openedBraces:0}):0<n.length&&"punctuation"===o.type&&"{"===o.content?n[n.length-1].openedBraces++:0<n.length&&0<n[n.length-1].openedBraces&&"punctuation"===o.type&&"}"===o.content?n[n.length-1].openedBraces--:a=!0),(a||"string"==typeof o)&&0<n.length&&0===n[n.length-1].openedBraces&&(a=i(o),r<t.length-1&&("string"==typeof t[r+1]||"plain-text"===t[r+1].type)&&(a+=i(t[r+1]),t.splice(r+1,1)),0<r&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(a=i(t[r-1])+a,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",a,null,a)),o.content&&"string"!=typeof o.content&&s(o.content)}}o=a(o).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:a(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(i).join(""):""};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||s(e.tokens)}))}(x),function(e){var t=e.util.clone(e.languages.typescript);(t=(e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"],e.languages.tsx.tag)).pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+t.pattern.source+")",t.pattern.flags),t.lookbehind=!0}(x),x.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},x.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=x.languages.swift})),function(e){e.languages.kotlin=e.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin["class-name"];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),e.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(x),x.languages.c=x.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),x.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),x.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},x.languages.c.string],char:x.languages.c.char,comment:x.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:x.languages.c}}}}),x.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete x.languages.c.boolean,x.languages.objectivec=x.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete x.languages.objectivec["class-name"],x.languages.objc=x.languages.objectivec,x.languages.reason=x.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),x.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete x.languages.reason.function,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,(function(){return t}));t=t.replace(/<self>/g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(x),x.languages.go=x.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),x.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete x.languages.go["class-name"],function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(x),x.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},x.languages.python["string-interpolation"].inside.interpolation.inside.rest=x.languages.python,x.languages.py=x.languages.python;((e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})})({},{dracula:()=>j,duotoneDark:()=>k,duotoneLight:()=>S,github:()=>_,jettwaveDark:()=>F,jettwaveLight:()=>B,nightOwl:()=>E,nightOwlLight:()=>O,oceanicNext:()=>P,okaidia:()=>T,oneDark:()=>z,oneLight:()=>U,palenight:()=>I,shadesOfPurple:()=>R,synthwave84:()=>N,ultramin:()=>L,vsDark:()=>D,vsLight:()=>M});var j={plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},k={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]},S={plain:{backgroundColor:"#faf8f5",color:"#728fcb"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#b6ad9a"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#063289"}},{types:["property","function"],style:{color:"#b29762"}},{types:["tag-id","selector","atrule-id"],style:{color:"#2d2006"}},{types:["attr-name"],style:{color:"#896724"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule"],style:{color:"#728fcb"}},{types:["placeholder","variable"],style:{color:"#93abdc"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#896724"}}]},_={plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},E={plain:{color:"#d6deeb",backgroundColor:"#011627"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(99, 119, 119)",fontStyle:"italic"}},{types:["string","url"],style:{color:"rgb(173, 219, 103)"}},{types:["variable"],style:{color:"rgb(214, 222, 235)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation"],style:{color:"rgb(199, 146, 234)"}},{types:["selector","doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(255, 203, 139)"}},{types:["tag","operator","keyword"],style:{color:"rgb(127, 219, 202)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["property"],style:{color:"rgb(128, 203, 196)"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}}]},O={plain:{color:"#403f53",backgroundColor:"#FBFBFB"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(72, 118, 214)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(152, 159, 177)",fontStyle:"italic"}},{types:["string","builtin","char","constant","url"],style:{color:"rgb(72, 118, 214)"}},{types:["variable"],style:{color:"rgb(201, 103, 101)"}},{types:["number"],style:{color:"rgb(170, 9, 130)"}},{types:["punctuation"],style:{color:"rgb(153, 76, 195)"}},{types:["function","selector","doctype"],style:{color:"rgb(153, 76, 195)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(17, 17, 17)"}},{types:["tag"],style:{color:"rgb(153, 76, 195)"}},{types:["operator","property","keyword","namespace"],style:{color:"rgb(12, 150, 155)"}},{types:["boolean"],style:{color:"rgb(188, 84, 84)"}}]},C="#c5a5c5",A="#8dc891",P={plain:{backgroundColor:"#282c34",color:"#ffffff"},styles:[{types:["attr-name"],style:{color:C}},{types:["attr-value"],style:{color:A}},{types:["comment","block-comment","prolog","doctype","cdata","shebang"],style:{color:"#999999"}},{types:["property","number","function-name","constant","symbol","deleted"],style:{color:"#5a9bcf"}},{types:["boolean"],style:{color:"#ff8b50"}},{types:["tag"],style:{color:"#fc929e"}},{types:["string"],style:{color:A}},{types:["punctuation"],style:{color:A}},{types:["selector","char","builtin","inserted"],style:{color:"#D8DEE9"}},{types:["function"],style:{color:"#79b6f2"}},{types:["operator","entity","url","variable"],style:{color:"#d7deea"}},{types:["keyword"],style:{color:C}},{types:["atrule","class-name"],style:{color:"#FAC863"}},{types:["important"],style:{fontWeight:"400"}},{types:["bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}}]},T={plain:{color:"#f8f8f2",backgroundColor:"#272822"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"#f92672",fontStyle:"italic"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"#8292a2",fontStyle:"italic"}},{types:["string","url"],style:{color:"#a6e22e"}},{types:["variable"],style:{color:"#f8f8f2"}},{types:["number"],style:{color:"#ae81ff"}},{types:["builtin","char","constant","function","class-name"],style:{color:"#e6db74"}},{types:["punctuation"],style:{color:"#f8f8f2"}},{types:["selector","doctype"],style:{color:"#a6e22e",fontStyle:"italic"}},{types:["tag","operator","keyword"],style:{color:"#66d9ef"}},{types:["boolean"],style:{color:"#ae81ff"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)",opacity:.7}},{types:["tag","property"],style:{color:"#f92672"}},{types:["attr-name"],style:{color:"#a6e22e !important"}},{types:["doctype"],style:{color:"#8292a2"}},{types:["rule"],style:{color:"#e6db74"}}]},I={plain:{color:"#bfc7d5",backgroundColor:"#292d3e"},styles:[{types:["comment"],style:{color:"rgb(105, 112, 152)",fontStyle:"italic"}},{types:["string","inserted"],style:{color:"rgb(195, 232, 141)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation","selector"],style:{color:"rgb(199, 146, 234)"}},{types:["variable"],style:{color:"rgb(191, 199, 213)"}},{types:["class-name","attr-name"],style:{color:"rgb(255, 203, 107)"}},{types:["tag","deleted"],style:{color:"rgb(255, 85, 114)"}},{types:["operator"],style:{color:"rgb(137, 221, 255)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["keyword"],style:{fontStyle:"italic"}},{types:["doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}},{types:["url"],style:{color:"rgb(221, 221, 221)"}}]},R={plain:{color:"#9EFEFF",backgroundColor:"#2D2A55"},styles:[{types:["changed"],style:{color:"rgb(255, 238, 128)"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)"}},{types:["comment"],style:{color:"rgb(179, 98, 255)",fontStyle:"italic"}},{types:["punctuation"],style:{color:"rgb(255, 255, 255)"}},{types:["constant"],style:{color:"rgb(255, 98, 140)"}},{types:["string","url"],style:{color:"rgb(165, 255, 144)"}},{types:["variable"],style:{color:"rgb(255, 238, 128)"}},{types:["number","boolean"],style:{color:"rgb(255, 98, 140)"}},{types:["attr-name"],style:{color:"rgb(255, 180, 84)"}},{types:["keyword","operator","property","namespace","tag","selector","doctype"],style:{color:"rgb(255, 157, 0)"}},{types:["builtin","char","constant","function","class-name"],style:{color:"rgb(250, 208, 0)"}}]},N={plain:{backgroundColor:"linear-gradient(to bottom, #2a2139 75%, #34294f)",backgroundImage:"#34294f",color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"},styles:[{types:["comment","block-comment","prolog","doctype","cdata"],style:{color:"#495495",fontStyle:"italic"}},{types:["punctuation"],style:{color:"#ccc"}},{types:["tag","attr-name","namespace","number","unit","hexcode","deleted"],style:{color:"#e2777a"}},{types:["property","selector"],style:{color:"#72f1b8",textShadow:"0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475"}},{types:["function-name"],style:{color:"#6196cc"}},{types:["boolean","selector-id","function"],style:{color:"#fdfdfd",textShadow:"0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975"}},{types:["class-name","maybe-class-name","builtin"],style:{color:"#fff5f6",textShadow:"0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75"}},{types:["constant","symbol"],style:{color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"}},{types:["important","atrule","keyword","selector-class"],style:{color:"#f4eee4",textShadow:"0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575"}},{types:["string","char","attr-value","regex","variable"],style:{color:"#f87c32"}},{types:["parameter"],style:{fontStyle:"italic"}},{types:["entity","url"],style:{color:"#67cdcc"}},{types:["operator"],style:{color:"ffffffee"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["entity"],style:{cursor:"help"}},{types:["inserted"],style:{color:"green"}}]},L={plain:{color:"#282a2e",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(197, 200, 198)"}},{types:["string","number","builtin","variable"],style:{color:"rgb(150, 152, 150)"}},{types:["class-name","function","tag","attr-name"],style:{color:"rgb(40, 42, 46)"}}]},D={plain:{color:"#9CDCFE",backgroundColor:"#1E1E1E"},styles:[{types:["prolog"],style:{color:"rgb(0, 0, 128)"}},{types:["comment"],style:{color:"rgb(106, 153, 85)"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"rgb(86, 156, 214)"}},{types:["number","inserted"],style:{color:"rgb(181, 206, 168)"}},{types:["constant"],style:{color:"rgb(100, 102, 149)"}},{types:["attr-name","variable"],style:{color:"rgb(156, 220, 254)"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"rgb(206, 145, 120)"}},{types:["selector"],style:{color:"rgb(215, 186, 125)"}},{types:["tag"],style:{color:"rgb(78, 201, 176)"}},{types:["tag"],languages:["markup"],style:{color:"rgb(86, 156, 214)"}},{types:["punctuation","operator"],style:{color:"rgb(212, 212, 212)"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"rgb(220, 220, 170)"}},{types:["class-name"],style:{color:"rgb(78, 201, 176)"}},{types:["char"],style:{color:"rgb(209, 105, 105)"}}]},M={plain:{color:"#000000",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(0, 128, 0)"}},{types:["builtin"],style:{color:"rgb(0, 112, 193)"}},{types:["number","variable","inserted"],style:{color:"rgb(9, 134, 88)"}},{types:["operator"],style:{color:"rgb(0, 0, 0)"}},{types:["constant","char"],style:{color:"rgb(129, 31, 63)"}},{types:["tag"],style:{color:"rgb(128, 0, 0)"}},{types:["attr-name"],style:{color:"rgb(255, 0, 0)"}},{types:["deleted","string"],style:{color:"rgb(163, 21, 21)"}},{types:["changed","punctuation"],style:{color:"rgb(4, 81, 165)"}},{types:["function","keyword"],style:{color:"rgb(0, 0, 255)"}},{types:["class-name"],style:{color:"rgb(38, 127, 153)"}}]},F={plain:{color:"#f8fafc",backgroundColor:"#011627"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#569CD6"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#f8fafc"}},{types:["attr-name","variable"],style:{color:"#9CDCFE"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#cbd5e1"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#D4D4D4"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#7dd3fc"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},B={plain:{color:"#0f172a",backgroundColor:"#f1f5f9"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#0c4a6e"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#0f172a"}},{types:["attr-name","variable"],style:{color:"#0c4a6e"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#64748b"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#475569"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#0e7490"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},z={plain:{backgroundColor:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(220, 10%, 40%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(220, 14%, 71%)"}},{types:["attr-name","class-name","maybe-class-name","boolean","constant","number","atrule"],style:{color:"hsl(29, 54%, 61%)"}},{types:["keyword"],style:{color:"hsl(286, 60%, 67%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(355, 65%, 65%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value"],style:{color:"hsl(95, 38%, 62%)"}},{types:["variable","operator","function"],style:{color:"hsl(207, 82%, 66%)"}},{types:["url"],style:{color:"hsl(187, 47%, 55%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(220, 14%, 71%)"}}]},U={plain:{backgroundColor:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(230, 4%, 64%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(230, 8%, 24%)"}},{types:["attr-name","class-name","boolean","constant","number","atrule"],style:{color:"hsl(35, 99%, 36%)"}},{types:["keyword"],style:{color:"hsl(301, 63%, 40%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(5, 74%, 59%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value","punctuation"],style:{color:"hsl(119, 34%, 47%)"}},{types:["variable","operator","function"],style:{color:"hsl(221, 87%, 60%)"}},{types:["url"],style:{color:"hsl(198, 99%, 37%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(230, 8%, 24%)"}}]},q=(e,t)=>{const{plain:n}=e,r=e.styles.reduce(((e,n)=>{const{languages:r,style:o}=n;return r&&!r.includes(t)||n.types.forEach((t=>{const n=v(v({},e[t]),o);e[t]=n})),e}),{});return r.root=n,r.plain=y(v({},n),{backgroundColor:void 0}),r},$=/\r\n|\r|\n/,H=e=>{0===e.length?e.push({types:["plain"],content:"\n",empty:!0}):1===e.length&&""===e[0].content&&(e[0].content="\n",e[0].empty=!0)},V=(e,t)=>{const n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},G=e=>{const t=[[]],n=[e],r=[0],o=[e.length];let a=0,s=0,i=[];const l=[i];for(;s>-1;){for(;(a=r[s]++)<o[s];){let e,c=t[s];const u=n[s][a];if("string"==typeof u?(c=s>0?c:["plain"],e=u):(c=V(c,u.type),u.alias&&(c=V(c,u.alias)),e=u.content),"string"!=typeof e){s++,t.push(c),n.push(e),r.push(0),o.push(e.length);continue}const d=e.split($),p=d.length;i.push({types:c,content:d[0]});for(let t=1;t<p;t++)H(i),l.push(i=[]),i.push({types:c,content:d[t]})}s--,t.pop(),n.pop(),r.pop(),o.pop()}return H(i),l},W=({children:e,language:t,code:n,theme:r,prism:o})=>{const i=t.toLowerCase(),l=((e,t)=>{const[n,r]=(0,a.useState)(q(t,e)),o=(0,a.useRef)(),s=(0,a.useRef)();return(0,a.useEffect)((()=>{t===o.current&&e===s.current||(o.current=t,s.current=e,r(q(t,e)))}),[e,t]),n})(i,r),c=(e=>(0,a.useCallback)((t=>{var n=t,{className:r,style:o,line:a}=n,i=w(n,["className","style","line"]);const l=y(v({},i),{className:(0,s.A)("token-line",r)});return"object"==typeof e&&"plain"in e&&(l.style=e.plain),"object"==typeof o&&(l.style=v(v({},l.style||{}),o)),l}),[e]))(l),u=(e=>{const t=(0,a.useCallback)((({types:t,empty:n})=>{if(null!=e)return 1===t.length&&"plain"===t[0]?null!=n?{display:"inline-block"}:void 0:1===t.length&&null!=n?e[t[0]]:Object.assign(null!=n?{display:"inline-block"}:{},...t.map((t=>e[t])))}),[e]);return(0,a.useCallback)((e=>{var n=e,{token:r,className:o,style:a}=n,i=w(n,["token","className","style"]);const l=y(v({},i),{className:(0,s.A)("token",...r.types,o),children:r.content,style:t(r)});return null!=a&&(l.style=v(v({},l.style||{}),a)),l}),[t])})(l),d=(({prism:e,code:t,grammar:n,language:r})=>{const o=(0,a.useRef)(e);return(0,a.useMemo)((()=>{if(null==n)return G([t]);const e={code:t,grammar:n,language:r,tokens:[]};return o.current.hooks.run("before-tokenize",e),e.tokens=o.current.tokenize(t,n),o.current.hooks.run("after-tokenize",e),G(e.tokens)}),[t,n,r])})({prism:o,language:i,code:n,grammar:o.languages[i]});return e({tokens:d,className:`prism-code language-${i}`,style:null!=l?l.root:{},getLineProps:c,getTokenProps:u})},K=e=>(0,a.createElement)(W,y(v({},e),{prism:e.prism||x,theme:e.theme||D,code:e.code,language:e.language}))},1635:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__addDisposableResource:()=>N,__assign:()=>a,__asyncDelegator:()=>_,__asyncGenerator:()=>S,__asyncValues:()=>E,__await:()=>k,__awaiter:()=>g,__classPrivateFieldGet:()=>T,__classPrivateFieldIn:()=>R,__classPrivateFieldSet:()=>I,__createBinding:()=>h,__decorate:()=>i,__disposeResources:()=>D,__esDecorate:()=>c,__exportStar:()=>b,__extends:()=>o,__generator:()=>m,__importDefault:()=>P,__importStar:()=>A,__makeTemplateObject:()=>O,__metadata:()=>f,__param:()=>l,__propKey:()=>d,__read:()=>y,__rest:()=>s,__runInitializers:()=>u,__setFunctionName:()=>p,__spread:()=>w,__spreadArray:()=>j,__spreadArrays:()=>x,__values:()=>v,default:()=>M});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function i(e,t,n,r){var o,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,n,s):o(t,n))||s);return a>3&&s&&Object.defineProperty(t,n,s),s}function l(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r,o,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?r.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),p=!1,f=n.length-1;f>=0;f--){var g={};for(var m in r)g[m]="access"===m?{}:r[m];for(var m in r.access)g.access[m]=r.access[m];g.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var h=(0,n[f])("accessor"===l?{get:d.get,set:d.set}:d[c],g);if("accessor"===l){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(i=s(h.get))&&(d.get=i),(i=s(h.set))&&(d.set=i),(i=s(h.init))&&o.unshift(i)}else(i=s(h))&&("field"===l?o.unshift(i):d[c]=i)}u&&Object.defineProperty(u,r.name,d),p=!0}function u(e,t,n){for(var r=arguments.length>2,o=0;o<t.length;o++)n=r?t[o].call(e,n):t[o].call(e);return r?n:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function p(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function f(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function g(e,t,n,r){return new(n||(n=Promise))((function(o,a){function s(e){try{l(r.next(e))}catch(t){a(t)}}function i(e){try{l(r.throw(e))}catch(t){a(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,i)}l((r=r.apply(e,t||[])).next())}))}function m(e,t){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(l){i=[6,l],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var h=Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function b(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||h(t,e,n)}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)s.push(r.value)}catch(i){o={error:i}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return s}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(y(arguments[t]));return e}function x(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var a=arguments[t],s=0,i=a.length;s<i;s++,o++)r[o]=a[s];return r}function j(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function k(e){return this instanceof k?(this.v=e,this):new k(e)}function S(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),a=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||i(e,t)}))})}function i(e,t){try{(n=o[e](t)).value instanceof k?Promise.resolve(n.value.v).then(l,c):u(a[0][2],n)}catch(r){u(a[0][3],r)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function u(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}}function _(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:k(e[r](t)),done:!1}:o?o(t):t}:o}}function E(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=v(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var C=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function A(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&h(t,e,n);return C(t,e),t}function P(e){return e&&e.__esModule?e:{default:e}}function T(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function I(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}function R(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function N(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose]}if("function"!=typeof r)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var L="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function D(e){function t(t){e.error=e.hasError?new L(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var r=e.stack.pop();try{var o=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(o).then(n,(function(e){return t(e),n()}))}catch(a){t(a)}}if(e.hasError)throw e.error}()}const M={__extends:o,__assign:a,__rest:s,__decorate:i,__param:l,__metadata:f,__awaiter:g,__generator:m,__createBinding:h,__exportStar:b,__values:v,__read:y,__spread:w,__spreadArrays:x,__spreadArray:j,__await:k,__asyncGenerator:S,__asyncDelegator:_,__asyncValues:E,__makeTemplateObject:O,__importStar:A,__importDefault:P,__classPrivateFieldGet:T,__classPrivateFieldSet:I,__classPrivateFieldIn:R,__addDisposableResource:N,__disposeResources:D}},2654:e=>{"use strict";e.exports={}},4054:e=>{"use strict";e.exports=JSON.parse('{"/jest-preset-angular/search-948":{"__comp":"1a4e3797","__context":{"plugin":"c141421f"}},"/jest-preset-angular/versions-4c3":{"__comp":"fa17a3e5","__context":{"plugin":"a7456010"},"config":"5e9f5e1a"},"/jest-preset-angular/docs-074":{"__comp":"5e95c892","__context":{"plugin":"aba21aa0"}},"/jest-preset-angular/docs/10.x-6e5":{"__comp":"a7bd4aaa","__props":"c9f7f11b"},"/jest-preset-angular/docs/10.x-88d":{"__comp":"a94703ab"},"/jest-preset-angular/docs/10.x/-5e1":{"__comp":"17896441","content":"6608151e"},"/jest-preset-angular/docs/10.x/getting-started/installation-1ae":{"__comp":"17896441","content":"54071611"},"/jest-preset-angular/docs/10.x/getting-started/options-c06":{"__comp":"17896441","content":"252e2b80"},"/jest-preset-angular/docs/10.x/getting-started/presets-44d":{"__comp":"17896441","content":"04b3fc6c"},"/jest-preset-angular/docs/10.x/getting-started/test-environment-132":{"__comp":"17896441","content":"c00c612c"},"/jest-preset-angular/docs/10.x/guides/absolute-imports-075":{"__comp":"17896441","content":"cd9c57cb"},"/jest-preset-angular/docs/10.x/guides/angular-ivy-1c3":{"__comp":"17896441","content":"494f4f5e"},"/jest-preset-angular/docs/10.x/guides/esm-support-152":{"__comp":"17896441","content":"c49413db"},"/jest-preset-angular/docs/10.x/guides/jsdom-version-522":{"__comp":"17896441","content":"f3212b1e"},"/jest-preset-angular/docs/10.x/guides/troubleshooting-9c6":{"__comp":"17896441","content":"22e4d634"},"/jest-preset-angular/docs/10.x/guides/using-with-babel-d13":{"__comp":"17896441","content":"df70a34a"},"/jest-preset-angular/docs/10.x/processing-c81":{"__comp":"17896441","content":"8afa1348"},"/jest-preset-angular/docs/11.0-4d0":{"__comp":"a7bd4aaa","__props":"dc033a20"},"/jest-preset-angular/docs/11.0-6c8":{"__comp":"a94703ab"},"/jest-preset-angular/docs/11.0/-34e":{"__comp":"17896441","content":"151633a5"},"/jest-preset-angular/docs/11.0/getting-started/installation-8e7":{"__comp":"17896441","content":"6916680a"},"/jest-preset-angular/docs/11.0/getting-started/options-fb3":{"__comp":"17896441","content":"c7279284"},"/jest-preset-angular/docs/11.0/getting-started/presets-60e":{"__comp":"17896441","content":"fa9f2ace"},"/jest-preset-angular/docs/11.0/getting-started/test-environment-0ce":{"__comp":"17896441","content":"afba4106"},"/jest-preset-angular/docs/11.0/guides/absolute-imports-5bd":{"__comp":"17896441","content":"d2df711a"},"/jest-preset-angular/docs/11.0/guides/angular-13+-d6e":{"__comp":"17896441","content":"d069ae84"},"/jest-preset-angular/docs/11.0/guides/angular-ivy-9cf":{"__comp":"17896441","content":"8b263414"},"/jest-preset-angular/docs/11.0/guides/esm-support-9ad":{"__comp":"17896441","content":"9251a350"},"/jest-preset-angular/docs/11.0/guides/jsdom-version-227":{"__comp":"17896441","content":"710ad8a9"},"/jest-preset-angular/docs/11.0/guides/troubleshooting-a5d":{"__comp":"17896441","content":"ec1d9510"},"/jest-preset-angular/docs/11.0/guides/using-with-babel-5f7":{"__comp":"17896441","content":"51d67042"},"/jest-preset-angular/docs/11.0/processing-4ad":{"__comp":"17896441","content":"ecfacc56"},"/jest-preset-angular/docs/11.1-12c":{"__comp":"a7bd4aaa","__props":"f67ebb5d"},"/jest-preset-angular/docs/11.1-0bb":{"__comp":"a94703ab"},"/jest-preset-angular/docs/11.1/-fc4":{"__comp":"17896441","content":"5ae6b2db"},"/jest-preset-angular/docs/11.1/getting-started/installation-1c6":{"__comp":"17896441","content":"8665e647"},"/jest-preset-angular/docs/11.1/getting-started/options-875":{"__comp":"17896441","content":"eae657ee"},"/jest-preset-angular/docs/11.1/getting-started/presets-62f":{"__comp":"17896441","content":"29d26392"},"/jest-preset-angular/docs/11.1/getting-started/test-environment-d96":{"__comp":"17896441","content":"5ee9d842"},"/jest-preset-angular/docs/11.1/guides/absolute-imports-f80":{"__comp":"17896441","content":"ea131d77"},"/jest-preset-angular/docs/11.1/guides/angular-13+-58d":{"__comp":"17896441","content":"aad144a3"},"/jest-preset-angular/docs/11.1/guides/angular-ivy-3ee":{"__comp":"17896441","content":"f43def45"},"/jest-preset-angular/docs/11.1/guides/esm-support-fbf":{"__comp":"17896441","content":"e0a3f9c8"},"/jest-preset-angular/docs/11.1/guides/jsdom-version-f12":{"__comp":"17896441","content":"dd8b0175"},"/jest-preset-angular/docs/11.1/guides/troubleshooting-feb":{"__comp":"17896441","content":"9fc1d339"},"/jest-preset-angular/docs/11.1/guides/using-with-babel-b0c":{"__comp":"17896441","content":"029bedf1"},"/jest-preset-angular/docs/11.1/processing-aba":{"__comp":"17896441","content":"daab97c5"},"/jest-preset-angular/docs/12.0-0a3":{"__comp":"a7bd4aaa","__props":"5d23d50c"},"/jest-preset-angular/docs/12.0-a63":{"__comp":"a94703ab"},"/jest-preset-angular/docs/12.0/-70d":{"__comp":"17896441","content":"f14ecac0"},"/jest-preset-angular/docs/12.0/getting-started/installation-18d":{"__comp":"17896441","content":"5f85402d"},"/jest-preset-angular/docs/12.0/getting-started/options-514":{"__comp":"17896441","content":"48dd39e2"},"/jest-preset-angular/docs/12.0/getting-started/presets-eb3":{"__comp":"17896441","content":"04ae74d1"},"/jest-preset-angular/docs/12.0/getting-started/test-environment-0eb":{"__comp":"17896441","content":"80b4c599"},"/jest-preset-angular/docs/12.0/guides/absolute-imports-5e9":{"__comp":"17896441","content":"47cccd8d"},"/jest-preset-angular/docs/12.0/guides/angular-13+-124":{"__comp":"17896441","content":"68e3f1d5"},"/jest-preset-angular/docs/12.0/guides/angular-ivy-392":{"__comp":"17896441","content":"433cefd8"},"/jest-preset-angular/docs/12.0/guides/esm-support-65d":{"__comp":"17896441","content":"a389e28e"},"/jest-preset-angular/docs/12.0/guides/jsdom-version-3fe":{"__comp":"17896441","content":"a7d61b99"},"/jest-preset-angular/docs/12.0/guides/troubleshooting-061":{"__comp":"17896441","content":"fea96f18"},"/jest-preset-angular/docs/12.0/guides/using-with-babel-995":{"__comp":"17896441","content":"0e35f71d"},"/jest-preset-angular/docs/12.0/processing-5bf":{"__comp":"17896441","content":"13973f06"},"/jest-preset-angular/docs/13.0-0e5":{"__comp":"a7bd4aaa","__props":"d30d9744"},"/jest-preset-angular/docs/13.0-88e":{"__comp":"a94703ab"},"/jest-preset-angular/docs/13.0/-1a4":{"__comp":"17896441","content":"9bc9e25c"},"/jest-preset-angular/docs/13.0/getting-started/installation-b75":{"__comp":"17896441","content":"6059e070"},"/jest-preset-angular/docs/13.0/getting-started/options-d92":{"__comp":"17896441","content":"aa079c8b"},"/jest-preset-angular/docs/13.0/getting-started/presets-364":{"__comp":"17896441","content":"5b1cb890"},"/jest-preset-angular/docs/13.0/getting-started/test-environment-dc3":{"__comp":"17896441","content":"732c3ce9"},"/jest-preset-angular/docs/13.0/guides/absolute-imports-108":{"__comp":"17896441","content":"6d1ddfa7"},"/jest-preset-angular/docs/13.0/guides/angular-13+-f9c":{"__comp":"17896441","content":"44b4d73b"},"/jest-preset-angular/docs/13.0/guides/angular-ivy-182":{"__comp":"17896441","content":"2e81e74f"},"/jest-preset-angular/docs/13.0/guides/esm-support-905":{"__comp":"17896441","content":"d9330f66"},"/jest-preset-angular/docs/13.0/guides/jsdom-version-b9a":{"__comp":"17896441","content":"56acf0ae"},"/jest-preset-angular/docs/13.0/guides/troubleshooting-0f4":{"__comp":"17896441","content":"d1b207fe"},"/jest-preset-angular/docs/13.0/guides/using-with-babel-b1b":{"__comp":"17896441","content":"9a2fa73a"},"/jest-preset-angular/docs/13.0/processing-22f":{"__comp":"17896441","content":"30388853"},"/jest-preset-angular/docs/14.0-4ea":{"__comp":"a7bd4aaa","__props":"c1865e7c"},"/jest-preset-angular/docs/14.0-2c3":{"__comp":"a94703ab"},"/jest-preset-angular/docs/14.0/-bd1":{"__comp":"17896441","content":"c1bdbc58"},"/jest-preset-angular/docs/14.0/getting-started/installation-811":{"__comp":"17896441","content":"85e14910"},"/jest-preset-angular/docs/14.0/getting-started/options-568":{"__comp":"17896441","content":"ebf39289"},"/jest-preset-angular/docs/14.0/getting-started/presets-60f":{"__comp":"17896441","content":"9798ce17"},"/jest-preset-angular/docs/14.0/getting-started/test-environment-1d8":{"__comp":"17896441","content":"9d48492b"},"/jest-preset-angular/docs/14.0/guides/absolute-imports-8e9":{"__comp":"17896441","content":"05916282"},"/jest-preset-angular/docs/14.0/guides/angular-13+-6e3":{"__comp":"17896441","content":"388d3430"},"/jest-preset-angular/docs/14.0/guides/angular-ivy-218":{"__comp":"17896441","content":"1a5572f6"},"/jest-preset-angular/docs/14.0/guides/esm-support-bf8":{"__comp":"17896441","content":"26cb42b7"},"/jest-preset-angular/docs/14.0/guides/jsdom-version-af8":{"__comp":"17896441","content":"0dc350cc"},"/jest-preset-angular/docs/14.0/guides/troubleshooting-49d":{"__comp":"17896441","content":"c62dfc48"},"/jest-preset-angular/docs/14.0/guides/using-with-babel-1e1":{"__comp":"17896441","content":"6f809103"},"/jest-preset-angular/docs/14.0/processing-33e":{"__comp":"17896441","content":"b2161dc5"},"/jest-preset-angular/docs/14.2-af3":{"__comp":"a7bd4aaa","__props":"f2ed1a27"},"/jest-preset-angular/docs/14.2-f2b":{"__comp":"a94703ab"},"/jest-preset-angular/docs/14.2/-6e2":{"__comp":"17896441","content":"2ab18ce5"},"/jest-preset-angular/docs/14.2/getting-started/installation-f85":{"__comp":"17896441","content":"3c7caf67"},"/jest-preset-angular/docs/14.2/getting-started/options-8cb":{"__comp":"17896441","content":"ef2f3ccd"},"/jest-preset-angular/docs/14.2/getting-started/presets-16e":{"__comp":"17896441","content":"1e388ac9"},"/jest-preset-angular/docs/14.2/getting-started/test-environment-76a":{"__comp":"17896441","content":"6a6dcee7"},"/jest-preset-angular/docs/14.2/guides/absolute-imports-3f1":{"__comp":"17896441","content":"b83f237d"},"/jest-preset-angular/docs/14.2/guides/angular-13+-0dc":{"__comp":"17896441","content":"a89007e0"},"/jest-preset-angular/docs/14.2/guides/angular-ivy-689":{"__comp":"17896441","content":"203fc93e"},"/jest-preset-angular/docs/14.2/guides/esm-support-c77":{"__comp":"17896441","content":"4b3f866b"},"/jest-preset-angular/docs/14.2/guides/jsdom-version-8b6":{"__comp":"17896441","content":"1438ea8f"},"/jest-preset-angular/docs/14.2/guides/snapshot-testing-8b6":{"__comp":"17896441","content":"33a5adb4"},"/jest-preset-angular/docs/14.2/guides/troubleshooting-834":{"__comp":"17896441","content":"dff5aaca"},"/jest-preset-angular/docs/14.2/guides/using-with-babel-b46":{"__comp":"17896441","content":"c4ba122c"},"/jest-preset-angular/docs/14.2/processing-48f":{"__comp":"17896441","content":"b4c5bdfe"},"/jest-preset-angular/docs/14.3-8b6":{"__comp":"a7bd4aaa","__props":"8e1736e0"},"/jest-preset-angular/docs/14.3-1f4":{"__comp":"a94703ab"},"/jest-preset-angular/docs/14.3/-f1b":{"__comp":"17896441","content":"327b6d8e"},"/jest-preset-angular/docs/14.3/getting-started/installation-501":{"__comp":"17896441","content":"af572879"},"/jest-preset-angular/docs/14.3/getting-started/options-fa8":{"__comp":"17896441","content":"8f3baa16"},"/jest-preset-angular/docs/14.3/getting-started/presets-581":{"__comp":"17896441","content":"ec7d5e88"},"/jest-preset-angular/docs/14.3/getting-started/test-environment-424":{"__comp":"17896441","content":"2a474b18"},"/jest-preset-angular/docs/14.3/guides/absolute-imports-a3f":{"__comp":"17896441","content":"5465ebbc"},"/jest-preset-angular/docs/14.3/guides/angular-13+-614":{"__comp":"17896441","content":"4941928a"},"/jest-preset-angular/docs/14.3/guides/angular-ivy-cc3":{"__comp":"17896441","content":"5253afba"},"/jest-preset-angular/docs/14.3/guides/esm-support-30a":{"__comp":"17896441","content":"27af8d7b"},"/jest-preset-angular/docs/14.3/guides/jsdom-version-2bb":{"__comp":"17896441","content":"164a8de7"},"/jest-preset-angular/docs/14.3/guides/snapshot-testing-10b":{"__comp":"17896441","content":"44821296"},"/jest-preset-angular/docs/14.3/guides/troubleshooting-967":{"__comp":"17896441","content":"08804573"},"/jest-preset-angular/docs/14.3/guides/using-with-babel-b97":{"__comp":"17896441","content":"15a051c9"},"/jest-preset-angular/docs/14.3/processing-2ad":{"__comp":"17896441","content":"097bb47a"},"/jest-preset-angular/docs/8.x-7ae":{"__comp":"a7bd4aaa","__props":"58f4fbf7"},"/jest-preset-angular/docs/8.x-ca3":{"__comp":"a94703ab"},"/jest-preset-angular/docs/8.x/-c36":{"__comp":"17896441","content":"651850eb"},"/jest-preset-angular/docs/8.x/getting-started/installation-606":{"__comp":"17896441","content":"02a1e558"},"/jest-preset-angular/docs/8.x/getting-started/options-36a":{"__comp":"17896441","content":"6266f1ba"},"/jest-preset-angular/docs/8.x/getting-started/presets-71d":{"__comp":"17896441","content":"c44fa306"},"/jest-preset-angular/docs/8.x/getting-started/test-environment-110":{"__comp":"17896441","content":"7aeeadd4"},"/jest-preset-angular/docs/8.x/guides/absolute-imports-3a8":{"__comp":"17896441","content":"f97daad0"},"/jest-preset-angular/docs/8.x/guides/angular-ivy-566":{"__comp":"17896441","content":"9903dc99"},"/jest-preset-angular/docs/8.x/guides/esm-support-461":{"__comp":"17896441","content":"2ae17008"},"/jest-preset-angular/docs/8.x/guides/jsdom-version-218":{"__comp":"17896441","content":"f0447160"},"/jest-preset-angular/docs/8.x/guides/troubleshooting-4e8":{"__comp":"17896441","content":"72f058d3"},"/jest-preset-angular/docs/8.x/guides/using-with-babel-3d1":{"__comp":"17896441","content":"b647df5a"},"/jest-preset-angular/docs/8.x/processing-202":{"__comp":"17896441","content":"adb64ee2"},"/jest-preset-angular/docs/9.x-091":{"__comp":"a7bd4aaa","__props":"7d7dbec2"},"/jest-preset-angular/docs/9.x-f89":{"__comp":"a94703ab"},"/jest-preset-angular/docs/9.x/-89c":{"__comp":"17896441","content":"e1715838"},"/jest-preset-angular/docs/9.x/getting-started/installation-a49":{"__comp":"17896441","content":"27299a3b"},"/jest-preset-angular/docs/9.x/getting-started/options-11d":{"__comp":"17896441","content":"63150b11"},"/jest-preset-angular/docs/9.x/getting-started/presets-342":{"__comp":"17896441","content":"79ea3e73"},"/jest-preset-angular/docs/9.x/getting-started/test-environment-728":{"__comp":"17896441","content":"0d71a3f1"},"/jest-preset-angular/docs/9.x/guides/absolute-imports-ad1":{"__comp":"17896441","content":"a74b641e"},"/jest-preset-angular/docs/9.x/guides/angular-ivy-3e0":{"__comp":"17896441","content":"d720bb60"},"/jest-preset-angular/docs/9.x/guides/esm-support-d87":{"__comp":"17896441","content":"5635425a"},"/jest-preset-angular/docs/9.x/guides/jsdom-version-664":{"__comp":"17896441","content":"407f8801"},"/jest-preset-angular/docs/9.x/guides/troubleshooting-d1c":{"__comp":"17896441","content":"a9789633"},"/jest-preset-angular/docs/9.x/guides/using-with-babel-a60":{"__comp":"17896441","content":"93f0793d"},"/jest-preset-angular/docs/9.x/processing-120":{"__comp":"17896441","content":"f546eb96"},"/jest-preset-angular/docs/next-9e7":{"__comp":"a7bd4aaa","__props":"25e9e857"},"/jest-preset-angular/docs/next-8fc":{"__comp":"a94703ab"},"/jest-preset-angular/docs/next/-301":{"__comp":"17896441","content":"a09c2993"},"/jest-preset-angular/docs/next/getting-started/installation-444":{"__comp":"17896441","content":"54f44165"},"/jest-preset-angular/docs/next/getting-started/options-683":{"__comp":"17896441","content":"4e0c07c5"},"/jest-preset-angular/docs/next/getting-started/presets-841":{"__comp":"17896441","content":"fc80686b"},"/jest-preset-angular/docs/next/getting-started/test-environment-e77":{"__comp":"17896441","content":"1a421168"},"/jest-preset-angular/docs/next/guides/absolute-imports-7b5":{"__comp":"17896441","content":"d19b9e8a"},"/jest-preset-angular/docs/next/guides/angular-13+-af5":{"__comp":"17896441","content":"5b125e0e"},"/jest-preset-angular/docs/next/guides/angular-ivy-476":{"__comp":"17896441","content":"14b133ce"},"/jest-preset-angular/docs/next/guides/esm-support-3c5":{"__comp":"17896441","content":"d4836a8e"},"/jest-preset-angular/docs/next/guides/jsdom-version-ad1":{"__comp":"17896441","content":"4351d34b"},"/jest-preset-angular/docs/next/guides/snapshot-testing-8ac":{"__comp":"17896441","content":"68240572"},"/jest-preset-angular/docs/next/guides/troubleshooting-b2e":{"__comp":"17896441","content":"03be7dae"},"/jest-preset-angular/docs/next/guides/using-with-babel-5a5":{"__comp":"17896441","content":"47c825a2"},"/jest-preset-angular/docs/next/processing-6b2":{"__comp":"17896441","content":"eabdbf07"},"/jest-preset-angular/docs-a75":{"__comp":"a7bd4aaa","__props":"bb70b9c8"},"/jest-preset-angular/docs-d90":{"__comp":"a94703ab"},"/jest-preset-angular/docs/-3e2":{"__comp":"17896441","content":"915eea02"},"/jest-preset-angular/docs/getting-started/installation-8ea":{"__comp":"17896441","content":"09df063d"},"/jest-preset-angular/docs/getting-started/options-a7b":{"__comp":"17896441","content":"e5a27df7"},"/jest-preset-angular/docs/getting-started/presets-c5a":{"__comp":"17896441","content":"e59053ae"},"/jest-preset-angular/docs/getting-started/test-environment-d76":{"__comp":"17896441","content":"dd1da75d"},"/jest-preset-angular/docs/guides/absolute-imports-52e":{"__comp":"17896441","content":"e36b815f"},"/jest-preset-angular/docs/guides/angular-13+-7b9":{"__comp":"17896441","content":"d957c22b"},"/jest-preset-angular/docs/guides/angular-ivy-452":{"__comp":"17896441","content":"3b270bcb"},"/jest-preset-angular/docs/guides/esm-support-b9c":{"__comp":"17896441","content":"357d33d4"},"/jest-preset-angular/docs/guides/jsdom-version-a84":{"__comp":"17896441","content":"1d8e39f8"},"/jest-preset-angular/docs/guides/snapshot-testing-bcb":{"__comp":"17896441","content":"a05464cd"},"/jest-preset-angular/docs/guides/troubleshooting-4a9":{"__comp":"17896441","content":"a7d04da7"},"/jest-preset-angular/docs/guides/using-with-babel-149":{"__comp":"17896441","content":"fbd32610"},"/jest-preset-angular/docs/processing-32b":{"__comp":"17896441","content":"95451dd5"},"/jest-preset-angular/-c4f":{"__comp":"1df93b7f","__context":{"plugin":"a7456010"},"config":"5e9f5e1a"}}')}},e=>{e.O(0,[1869],(()=>{return t=8536,e(e.s=t);var t}));e.O()}]); \ No newline at end of file diff --git a/assets/js/main.7bd9ef8c.js.LICENSE.txt b/assets/js/main.bef18837.js.LICENSE.txt similarity index 100% rename from assets/js/main.7bd9ef8c.js.LICENSE.txt rename to assets/js/main.bef18837.js.LICENSE.txt diff --git a/assets/js/runtime~main.e6ce19fb.js b/assets/js/runtime~main.99379c03.js similarity index 62% rename from assets/js/runtime~main.e6ce19fb.js rename to assets/js/runtime~main.99379c03.js index 80cdc70126..f810e5a092 100644 --- a/assets/js/runtime~main.e6ce19fb.js +++ b/assets/js/runtime~main.99379c03.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,d,f,c,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var d=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(d.exports,d,d.exports,r),d.loaded=!0,d.exports}r.m=b,r.c=t,e=[],r.O=(a,d,f,c)=>{if(!d){var b=1/0;for(i=0;i<e.length;i++){d=e[i][0],f=e[i][1],c=e[i][2];for(var t=!0,o=0;o<d.length;o++)(!1&c||b>=c)&&Object.keys(r.O).every((e=>r.O[e](d[o])))?d.splice(o--,1):(t=!1,c<b&&(b=c));if(t){e.splice(i--,1);var n=f();void 0!==n&&(a=n)}}return a}c=c||0;for(var i=e.length;i>0&&e[i-1][2]>c;i--)e[i]=e[i-1];e[i]=[d,f,c]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},d=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var c=Object.create(null);r.r(c);var b={};a=a||[null,d({}),d([]),d(d)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=d(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(c,b),c},r.d=(e,a)=>{for(var d in a)r.o(a,d)&&!r.o(e,d)&&Object.defineProperty(e,d,{enumerable:!0,get:a[d]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,d)=>(r.f[d](e,a),a)),[])),r.u=e=>"assets/js/"+({46:"e0a3f9c8",51:"c62dfc48",106:"d4836a8e",108:"08804573",131:"80b4c599",179:"26cb42b7",217:"8f3baa16",223:"9bc9e25c",347:"8b263414",403:"433cefd8",499:"f0447160",509:"44821296",646:"6f809103",647:"2e81e74f",667:"f2ed1a27",689:"68240572",709:"b2161dc5",742:"fa9f2ace",744:"dff5aaca",795:"79ea3e73",853:"1438ea8f",949:"dc033a20",957:"c141421f",1019:"ecfacc56",1049:"c1865e7c",1090:"d1b207fe",1116:"15a051c9",1180:"029bedf1",1235:"a7456010",1263:"915eea02",1315:"7d7dbec2",1352:"93f0793d",1446:"13973f06",1454:"d069ae84",1555:"daab97c5",1605:"c7279284",1635:"2ae17008",1653:"14b133ce",1672:"0e35f71d",1694:"56acf0ae",1767:"c49413db",1795:"164a8de7",1832:"a05464cd",1841:"a74b641e",1942:"afba4106",2008:"e59053ae",2052:"c9f7f11b",2138:"1a4e3797",2274:"c44fa306",2341:"8afa1348",2363:"a7d04da7",2416:"e5a27df7",2440:"fc80686b",2442:"48dd39e2",2502:"05916282",2601:"d2df711a",2624:"b647df5a",2656:"f43def45",2659:"e36b815f",2703:"4941928a",2758:"33a5adb4",2766:"a7d61b99",2772:"aa079c8b",2822:"2a474b18",2891:"6608151e",2972:"dd8b0175",3095:"4351d34b",3170:"85e14910",3309:"fea96f18",3316:"0d71a3f1",3344:"d30d9744",3421:"ec1d9510",3489:"5f85402d",3543:"a9789633",3596:"63150b11",3676:"1a5572f6",3737:"9d48492b",3767:"a89007e0",3803:"097bb47a",3818:"6916680a",4026:"02a1e558",4134:"eae657ee",4240:"6d1ddfa7",4340:"732c3ce9",4344:"b4c5bdfe",4393:"25e9e857",4394:"8e1736e0",4528:"151633a5",4583:"1df93b7f",4611:"1d8e39f8",4768:"03be7dae",4769:"c4ba122c",4787:"58f4fbf7",4827:"5b1cb890",4868:"27af8d7b",5027:"09df063d",5075:"9251a350",5100:"eabdbf07",5240:"d19b9e8a",5243:"f97daad0",5250:"4e0c07c5",5297:"cd9c57cb",5416:"f67ebb5d",5487:"9903dc99",5492:"357d33d4",5559:"22e4d634",5596:"d720bb60",5603:"c00c612c",5700:"8665e647",5742:"aba21aa0",5883:"6266f1ba",5899:"a09c2993",6038:"203fc93e",6060:"51d67042",6201:"95451dd5",6224:"9798ce17",6261:"407f8801",6308:"af572879",6323:"47cccd8d",6358:"5ae6b2db",6370:"f546eb96",6448:"54071611",6530:"2ab18ce5",6543:"fbd32610",6603:"e1715838",6741:"ef2f3ccd",6883:"5465ebbc",6917:"5ee9d842",6968:"327b6d8e",6969:"1e388ac9",7036:"27299a3b",7098:"a7bd4aaa",7168:"5d23d50c",7330:"72f058d3",7367:"68e3f1d5",7375:"3c7caf67",7400:"4b3f866b",7466:"6a6dcee7",7511:"f3212b1e",7554:"a389e28e",7832:"5253afba",7924:"54f44165",7951:"dd1da75d",8054:"fa17a3e5",8108:"494f4f5e",8201:"9fc1d339",8388:"3b270bcb",8401:"17896441",8480:"adb64ee2",8582:"04b3fc6c",8624:"ea131d77",8626:"29d26392",8649:"6059e070",8654:"7aeeadd4",8678:"d9330f66",8704:"f14ecac0",8715:"ebf39289",8828:"710ad8a9",8879:"47c825a2",8889:"04ae74d1",8904:"5b125e0e",8930:"b83f237d",8937:"9a2fa73a",8955:"252e2b80",9048:"a94703ab",9075:"30388853",9104:"aad144a3",9197:"df70a34a",9353:"d957c22b",9461:"651850eb",9467:"c1bdbc58",9631:"1a421168",9647:"5e95c892",9760:"bb70b9c8",9762:"388d3430",9800:"0dc350cc",9806:"5635425a",9829:"44b4d73b",9896:"ec7d5e88"}[e]||e)+"."+{46:"842f8c29",51:"365183b8",106:"7c5ead09",108:"b158604d",131:"261e4d2d",135:"634828fd",179:"ca0b9bce",217:"eedf606f",223:"c9f71c3d",347:"5e9b72ee",403:"811b4e4b",499:"3ca4f473",509:"31f97174",646:"be235bda",647:"72bf63cc",667:"fb1768e4",689:"4abb7551",709:"e0f04e03",742:"5b075c64",744:"23b97e4b",795:"75325dd6",853:"864d0288",949:"9d70ff8c",957:"94fe8bc5",1019:"c1366c1f",1049:"279e0d2b",1090:"5f201ca7",1116:"2048c710",1180:"b7009fd1",1235:"7b4b0a20",1263:"bb6bc5ce",1315:"c7cd48e8",1352:"11aaa541",1446:"622ff653",1454:"9a63b295",1555:"9a3b2179",1605:"f7c6a82e",1635:"b6fb38a0",1653:"ca79723e",1672:"922de4b0",1694:"afcb0a82",1767:"ce0f734b",1795:"9a3d6637",1832:"b42f96f6",1841:"c778c318",1942:"0969fa6f",2008:"3b71f4c4",2052:"c8d58cc9",2138:"ad537829",2274:"ef143eab",2341:"be179ee9",2363:"92ad4b1c",2416:"b9c2bdee",2440:"26ca8247",2442:"23402173",2502:"32c64332",2560:"7545f406",2601:"695c325b",2624:"3c8c159b",2656:"0f79f52e",2659:"28711f06",2703:"987af661",2758:"da7594a1",2766:"d79ff599",2772:"6e9216b4",2822:"cfe459b8",2891:"d6012343",2972:"869182ee",3095:"d303a2d1",3170:"87c74441",3309:"715bd36c",3316:"c30ddbf7",3344:"477fbc7c",3421:"dc9d9713",3489:"53f0bb2a",3543:"ba5010f0",3596:"f5130b32",3676:"22ecf73b",3737:"b8c10d9a",3767:"e6910c63",3803:"391c0328",3818:"bd1707c0",4026:"7d8be562",4134:"c98b4b06",4240:"eec75fa6",4340:"9d6521cf",4344:"29fd6207",4393:"b319aa84",4394:"20c92fa9",4528:"dd917c1e",4583:"0ac154cb",4611:"28a9d5a6",4768:"946b6548",4769:"e20af9ef",4787:"4de8f557",4827:"dd9ccb6e",4868:"9de1f2c2",5027:"f8f4a530",5075:"db2cbcb1",5100:"41728050",5240:"629e3e46",5243:"563a1806",5250:"eac8a70f",5297:"dccd457f",5416:"b58d033a",5487:"85f43b2f",5492:"016ccac9",5559:"5953e3db",5596:"685933de",5603:"d919a0b2",5691:"f523bf42",5700:"d63ea67b",5742:"9ac6642b",5883:"fd3bdaf0",5899:"1d3055e0",6038:"7717a5e9",6060:"940d81a8",6201:"9ac91751",6224:"9f5df379",6261:"47c8babd",6308:"4cc2ec36",6323:"034e13f6",6358:"2ada3389",6368:"21689f03",6370:"51277a34",6448:"0c97ca50",6530:"1e2fe14a",6543:"10da846f",6603:"0954cdaf",6741:"1b4146ed",6883:"0cf559d5",6917:"78f8f27b",6968:"a792b02a",6969:"a696ff9b",7036:"0baa2ff1",7098:"f0be55e8",7168:"f2043806",7330:"64fb9f56",7367:"e94951ee",7375:"de9cda30",7400:"0d5003f7",7466:"f491b0e8",7511:"2634897e",7554:"d95c09f9",7832:"caa0464d",7924:"93cf3ebf",7951:"e12469a5",8054:"80c989de",8108:"5f51525d",8201:"231cb785",8388:"d3a960d4",8401:"703c7d4f",8480:"a262d5b4",8582:"268ff951",8624:"93990663",8626:"5eb3a2bf",8649:"024aac93",8654:"b225a810",8678:"04da02d0",8704:"20b5ab59",8715:"3821314c",8828:"3d148adf",8879:"cec4acbf",8889:"50384eca",8904:"b9d894f0",8913:"83bce4ad",8930:"e714b26f",8937:"ef8612ec",8955:"6bca9d9a",9048:"5a426d96",9075:"4a389d8b",9104:"581d5e11",9197:"201b89c1",9353:"8cc61010",9461:"3203f10b",9462:"284a2c7b",9467:"9d4617ce",9631:"08e719a3",9647:"5227adc5",9730:"144f0feb",9760:"eed402bb",9762:"e737585e",9800:"e5f566a7",9806:"bba12edf",9828:"03c26e5d",9829:"fce6c49e",9896:"21848047"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},c="website:",r.l=(e,a,d,b)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==d)for(var n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var u=n[i];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==c+d){t=u;break}}t||(o=!0,(t=document.createElement("script")).charset="utf-8",t.timeout=120,r.nc&&t.setAttribute("nonce",r.nc),t.setAttribute("data-webpack",c+d),t.src=e),f[e]=[a];var l=(a,d)=>{t.onerror=t.onload=null,clearTimeout(s);var c=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),c&&c.forEach((e=>e(d))),a)return a(d)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/jest-preset-angular/",r.gca=function(e){return e={17896441:"8401",30388853:"9075",44821296:"509",54071611:"6448",68240572:"689",e0a3f9c8:"46",c62dfc48:"51",d4836a8e:"106","08804573":"108","80b4c599":"131","26cb42b7":"179","8f3baa16":"217","9bc9e25c":"223","8b263414":"347","433cefd8":"403",f0447160:"499","6f809103":"646","2e81e74f":"647",f2ed1a27:"667",b2161dc5:"709",fa9f2ace:"742",dff5aaca:"744","79ea3e73":"795","1438ea8f":"853",dc033a20:"949",c141421f:"957",ecfacc56:"1019",c1865e7c:"1049",d1b207fe:"1090","15a051c9":"1116","029bedf1":"1180",a7456010:"1235","915eea02":"1263","7d7dbec2":"1315","93f0793d":"1352","13973f06":"1446",d069ae84:"1454",daab97c5:"1555",c7279284:"1605","2ae17008":"1635","14b133ce":"1653","0e35f71d":"1672","56acf0ae":"1694",c49413db:"1767","164a8de7":"1795",a05464cd:"1832",a74b641e:"1841",afba4106:"1942",e59053ae:"2008",c9f7f11b:"2052","1a4e3797":"2138",c44fa306:"2274","8afa1348":"2341",a7d04da7:"2363",e5a27df7:"2416",fc80686b:"2440","48dd39e2":"2442","05916282":"2502",d2df711a:"2601",b647df5a:"2624",f43def45:"2656",e36b815f:"2659","4941928a":"2703","33a5adb4":"2758",a7d61b99:"2766",aa079c8b:"2772","2a474b18":"2822","6608151e":"2891",dd8b0175:"2972","4351d34b":"3095","85e14910":"3170",fea96f18:"3309","0d71a3f1":"3316",d30d9744:"3344",ec1d9510:"3421","5f85402d":"3489",a9789633:"3543","63150b11":"3596","1a5572f6":"3676","9d48492b":"3737",a89007e0:"3767","097bb47a":"3803","6916680a":"3818","02a1e558":"4026",eae657ee:"4134","6d1ddfa7":"4240","732c3ce9":"4340",b4c5bdfe:"4344","25e9e857":"4393","8e1736e0":"4394","151633a5":"4528","1df93b7f":"4583","1d8e39f8":"4611","03be7dae":"4768",c4ba122c:"4769","58f4fbf7":"4787","5b1cb890":"4827","27af8d7b":"4868","09df063d":"5027","9251a350":"5075",eabdbf07:"5100",d19b9e8a:"5240",f97daad0:"5243","4e0c07c5":"5250",cd9c57cb:"5297",f67ebb5d:"5416","9903dc99":"5487","357d33d4":"5492","22e4d634":"5559",d720bb60:"5596",c00c612c:"5603","8665e647":"5700",aba21aa0:"5742","6266f1ba":"5883",a09c2993:"5899","203fc93e":"6038","51d67042":"6060","95451dd5":"6201","9798ce17":"6224","407f8801":"6261",af572879:"6308","47cccd8d":"6323","5ae6b2db":"6358",f546eb96:"6370","2ab18ce5":"6530",fbd32610:"6543",e1715838:"6603",ef2f3ccd:"6741","5465ebbc":"6883","5ee9d842":"6917","327b6d8e":"6968","1e388ac9":"6969","27299a3b":"7036",a7bd4aaa:"7098","5d23d50c":"7168","72f058d3":"7330","68e3f1d5":"7367","3c7caf67":"7375","4b3f866b":"7400","6a6dcee7":"7466",f3212b1e:"7511",a389e28e:"7554","5253afba":"7832","54f44165":"7924",dd1da75d:"7951",fa17a3e5:"8054","494f4f5e":"8108","9fc1d339":"8201","3b270bcb":"8388",adb64ee2:"8480","04b3fc6c":"8582",ea131d77:"8624","29d26392":"8626","6059e070":"8649","7aeeadd4":"8654",d9330f66:"8678",f14ecac0:"8704",ebf39289:"8715","710ad8a9":"8828","47c825a2":"8879","04ae74d1":"8889","5b125e0e":"8904",b83f237d:"8930","9a2fa73a":"8937","252e2b80":"8955",a94703ab:"9048",aad144a3:"9104",df70a34a:"9197",d957c22b:"9353","651850eb":"9461",c1bdbc58:"9467","1a421168":"9631","5e95c892":"9647",bb70b9c8:"9760","388d3430":"9762","0dc350cc":"9800","5635425a":"9806","44b4d73b":"9829",ec7d5e88:"9896"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,d)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)d.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var c=new Promise(((d,c)=>f=e[a]=[d,c]));d.push(f[2]=c);var b=r.p+r.u(a),t=new Error;r.l(b,(d=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var c=d&&("load"===d.type?"missing":d.type),b=d&&d.target&&d.target.src;t.message="Loading chunk "+a+" failed.\n("+c+": "+b+")",t.name="ChunkLoadError",t.type=c,t.request=b,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,d)=>{var f,c,b=d[0],t=d[1],o=d[2],n=0;if(b.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(d);n<b.length;n++)c=b[n],r.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return r.O(i)},d=self.webpackChunkwebsite=self.webpackChunkwebsite||[];d.forEach(a.bind(null,0)),d.push=a.bind(null,d.push.bind(d))})()})(); \ No newline at end of file +(()=>{"use strict";var e,a,d,f,b,c={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var d=t[e]={id:e,loaded:!1,exports:{}};return c[e].call(d.exports,d,d.exports,r),d.loaded=!0,d.exports}r.m=c,r.c=t,e=[],r.O=(a,d,f,b)=>{if(!d){var c=1/0;for(i=0;i<e.length;i++){d=e[i][0],f=e[i][1],b=e[i][2];for(var t=!0,o=0;o<d.length;o++)(!1&b||c>=b)&&Object.keys(r.O).every((e=>r.O[e](d[o])))?d.splice(o--,1):(t=!1,b<c&&(c=b));if(t){e.splice(i--,1);var n=f();void 0!==n&&(a=n)}}return a}b=b||0;for(var i=e.length;i>0&&e[i-1][2]>b;i--)e[i]=e[i-1];e[i]=[d,f,b]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},d=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var b=Object.create(null);r.r(b);var c={};a=a||[null,d({}),d([]),d(d)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=d(t))Object.getOwnPropertyNames(t).forEach((a=>c[a]=()=>e[a]));return c.default=()=>e,r.d(b,c),b},r.d=(e,a)=>{for(var d in a)r.o(a,d)&&!r.o(e,d)&&Object.defineProperty(e,d,{enumerable:!0,get:a[d]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,d)=>(r.f[d](e,a),a)),[])),r.u=e=>"assets/js/"+({46:"e0a3f9c8",51:"c62dfc48",106:"d4836a8e",108:"08804573",131:"80b4c599",179:"26cb42b7",217:"8f3baa16",223:"9bc9e25c",347:"8b263414",403:"433cefd8",499:"f0447160",509:"44821296",646:"6f809103",647:"2e81e74f",667:"f2ed1a27",689:"68240572",709:"b2161dc5",742:"fa9f2ace",744:"dff5aaca",795:"79ea3e73",853:"1438ea8f",949:"dc033a20",957:"c141421f",1019:"ecfacc56",1049:"c1865e7c",1090:"d1b207fe",1116:"15a051c9",1180:"029bedf1",1235:"a7456010",1263:"915eea02",1315:"7d7dbec2",1352:"93f0793d",1446:"13973f06",1454:"d069ae84",1555:"daab97c5",1605:"c7279284",1635:"2ae17008",1653:"14b133ce",1672:"0e35f71d",1694:"56acf0ae",1767:"c49413db",1795:"164a8de7",1832:"a05464cd",1841:"a74b641e",1942:"afba4106",2008:"e59053ae",2052:"c9f7f11b",2138:"1a4e3797",2274:"c44fa306",2341:"8afa1348",2363:"a7d04da7",2416:"e5a27df7",2440:"fc80686b",2442:"48dd39e2",2502:"05916282",2601:"d2df711a",2624:"b647df5a",2656:"f43def45",2659:"e36b815f",2703:"4941928a",2758:"33a5adb4",2766:"a7d61b99",2772:"aa079c8b",2822:"2a474b18",2891:"6608151e",2972:"dd8b0175",3095:"4351d34b",3170:"85e14910",3309:"fea96f18",3316:"0d71a3f1",3344:"d30d9744",3421:"ec1d9510",3489:"5f85402d",3543:"a9789633",3596:"63150b11",3676:"1a5572f6",3737:"9d48492b",3767:"a89007e0",3803:"097bb47a",3818:"6916680a",4026:"02a1e558",4134:"eae657ee",4240:"6d1ddfa7",4340:"732c3ce9",4344:"b4c5bdfe",4393:"25e9e857",4394:"8e1736e0",4528:"151633a5",4583:"1df93b7f",4611:"1d8e39f8",4768:"03be7dae",4769:"c4ba122c",4787:"58f4fbf7",4827:"5b1cb890",4868:"27af8d7b",5027:"09df063d",5075:"9251a350",5100:"eabdbf07",5240:"d19b9e8a",5243:"f97daad0",5250:"4e0c07c5",5297:"cd9c57cb",5416:"f67ebb5d",5487:"9903dc99",5492:"357d33d4",5559:"22e4d634",5596:"d720bb60",5603:"c00c612c",5700:"8665e647",5742:"aba21aa0",5883:"6266f1ba",5899:"a09c2993",6038:"203fc93e",6060:"51d67042",6201:"95451dd5",6224:"9798ce17",6261:"407f8801",6308:"af572879",6323:"47cccd8d",6358:"5ae6b2db",6370:"f546eb96",6448:"54071611",6530:"2ab18ce5",6543:"fbd32610",6603:"e1715838",6741:"ef2f3ccd",6883:"5465ebbc",6917:"5ee9d842",6968:"327b6d8e",6969:"1e388ac9",7036:"27299a3b",7098:"a7bd4aaa",7168:"5d23d50c",7330:"72f058d3",7367:"68e3f1d5",7375:"3c7caf67",7400:"4b3f866b",7466:"6a6dcee7",7511:"f3212b1e",7554:"a389e28e",7832:"5253afba",7924:"54f44165",7951:"dd1da75d",8054:"fa17a3e5",8108:"494f4f5e",8201:"9fc1d339",8388:"3b270bcb",8401:"17896441",8480:"adb64ee2",8582:"04b3fc6c",8624:"ea131d77",8626:"29d26392",8649:"6059e070",8654:"7aeeadd4",8678:"d9330f66",8704:"f14ecac0",8715:"ebf39289",8828:"710ad8a9",8879:"47c825a2",8889:"04ae74d1",8904:"5b125e0e",8930:"b83f237d",8937:"9a2fa73a",8955:"252e2b80",9048:"a94703ab",9075:"30388853",9104:"aad144a3",9197:"df70a34a",9353:"d957c22b",9461:"651850eb",9467:"c1bdbc58",9631:"1a421168",9647:"5e95c892",9760:"bb70b9c8",9762:"388d3430",9800:"0dc350cc",9806:"5635425a",9829:"44b4d73b",9896:"ec7d5e88"}[e]||e)+"."+{46:"908793f9",51:"f814772c",106:"f08aad97",108:"542b86a7",131:"9b906aa6",179:"9b793bb7",217:"1830da85",223:"8097de8a",347:"fd8c1ed5",403:"18f9a6b3",416:"36a683d5",499:"334fdac1",509:"1e9cc76b",646:"c4f140f6",647:"1eaa47fd",667:"fb1768e4",689:"0e0b55b5",709:"e00abd30",742:"edfa5c22",744:"ce3ca414",795:"bbf47963",853:"38a1d8c7",949:"9d70ff8c",957:"94fe8bc5",1019:"ac9aa5e6",1049:"279e0d2b",1090:"fcc3dae8",1116:"63f493b4",1180:"5c086163",1235:"7b4b0a20",1263:"36cf32b2",1315:"c7cd48e8",1352:"e7cdef71",1446:"e6f985d5",1454:"1510012e",1555:"b99fdee7",1605:"2f96c938",1635:"ef1cd84b",1653:"68259f60",1672:"4f1b452c",1694:"5b78e041",1767:"72672b32",1795:"cd7de8b4",1832:"859016ea",1841:"088cd730",1942:"7e5bad69",2008:"ff0eafd7",2052:"c8d58cc9",2138:"0f622ad9",2237:"c581d9e3",2274:"cd9e8bfb",2341:"21501e6a",2362:"a90cc913",2363:"18bdb0d0",2416:"5fe7eaf0",2440:"49156ad8",2442:"2d081c36",2502:"a686b861",2601:"592d21bd",2624:"d394a46f",2656:"6a04eee8",2659:"c818c8fc",2703:"6d853ed2",2758:"15cf890c",2766:"269f525c",2772:"94ee3eac",2822:"80846051",2891:"663dee4c",2972:"809badf8",3095:"e150e3f4",3170:"b3004c42",3309:"e8c94212",3316:"bb603643",3344:"477fbc7c",3421:"91d9ecd6",3489:"42415850",3543:"e91e430c",3596:"42797a50",3676:"6ebec477",3737:"d956ac2e",3767:"5198d775",3803:"e3aa4bf2",3818:"d798bef1",4026:"3695ef1c",4134:"fc74d885",4240:"d95a92fa",4334:"0bfa0a25",4340:"fc9a795c",4344:"92ec3263",4393:"b319aa84",4394:"20c92fa9",4528:"435147e0",4583:"9d5da231",4611:"de7224df",4768:"e6cf5ed1",4769:"fcb4165c",4787:"4de8f557",4827:"1130ccab",4868:"85d2d0c3",5027:"e4ecd33e",5075:"0b393dc5",5100:"959addb9",5240:"e88ee538",5243:"bdabcf59",5250:"4c5cce2f",5297:"e70ee565",5416:"b58d033a",5487:"4700933f",5492:"136d1448",5559:"6f42655d",5596:"590e55e8",5603:"b8bba764",5700:"4422a4a5",5742:"9ac6642b",5883:"08903fa7",5899:"812a7242",6038:"bdb97e17",6060:"09e30cff",6201:"59f15bad",6224:"33b4a4af",6261:"0db5cbe9",6308:"2b536d52",6323:"aef5dc41",6358:"a5d48355",6370:"0b4fe835",6448:"05faf7f7",6530:"89cd24ce",6543:"d9f43b70",6603:"1d92ad5f",6741:"6a46eb02",6883:"e27bdab3",6917:"b7446e8f",6968:"f4a93af4",6969:"ea3c7fd8",7036:"22bdc7e3",7098:"95046d7a",7168:"f2043806",7330:"18f8fac5",7367:"55912d98",7375:"88462c2e",7400:"a99cf192",7466:"ab46b1af",7511:"60888de7",7554:"c7e40c39",7832:"6e93956b",7924:"5995fb4f",7951:"2f2e0f37",8054:"f3f22079",8108:"bb0900b0",8158:"900dc11d",8201:"037448cd",8388:"8655ff4b",8401:"bc529dae",8480:"7b680c76",8582:"0ae6bbb7",8624:"d9c6661d",8626:"11552c90",8649:"a1ff5026",8654:"bb4e52e9",8678:"00861d4f",8704:"d868567d",8715:"8bb0879e",8737:"2a18c482",8828:"6a8f363e",8879:"b7d8bd79",8889:"415e8c45",8904:"697a5467",8913:"83bce4ad",8930:"212ef8af",8937:"ee87693b",8955:"534b45e9",9048:"95f72f34",9075:"16698a7a",9104:"5ad8a7db",9197:"23f587dc",9353:"3c2b6e64",9461:"42c01b62",9467:"fa73e3a0",9631:"f7ed44e7",9647:"3981f719",9730:"144f0feb",9760:"eed402bb",9762:"b1604206",9800:"701cfe13",9806:"7e3fe4b7",9829:"ae997243",9896:"be57bf5b"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},b="website:",r.l=(e,a,d,c)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==d)for(var n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var u=n[i];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==b+d){t=u;break}}t||(o=!0,(t=document.createElement("script")).charset="utf-8",t.timeout=120,r.nc&&t.setAttribute("nonce",r.nc),t.setAttribute("data-webpack",b+d),t.src=e),f[e]=[a];var l=(a,d)=>{t.onerror=t.onload=null,clearTimeout(s);var b=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),b&&b.forEach((e=>e(d))),a)return a(d)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/jest-preset-angular/",r.gca=function(e){return e={17896441:"8401",30388853:"9075",44821296:"509",54071611:"6448",68240572:"689",e0a3f9c8:"46",c62dfc48:"51",d4836a8e:"106","08804573":"108","80b4c599":"131","26cb42b7":"179","8f3baa16":"217","9bc9e25c":"223","8b263414":"347","433cefd8":"403",f0447160:"499","6f809103":"646","2e81e74f":"647",f2ed1a27:"667",b2161dc5:"709",fa9f2ace:"742",dff5aaca:"744","79ea3e73":"795","1438ea8f":"853",dc033a20:"949",c141421f:"957",ecfacc56:"1019",c1865e7c:"1049",d1b207fe:"1090","15a051c9":"1116","029bedf1":"1180",a7456010:"1235","915eea02":"1263","7d7dbec2":"1315","93f0793d":"1352","13973f06":"1446",d069ae84:"1454",daab97c5:"1555",c7279284:"1605","2ae17008":"1635","14b133ce":"1653","0e35f71d":"1672","56acf0ae":"1694",c49413db:"1767","164a8de7":"1795",a05464cd:"1832",a74b641e:"1841",afba4106:"1942",e59053ae:"2008",c9f7f11b:"2052","1a4e3797":"2138",c44fa306:"2274","8afa1348":"2341",a7d04da7:"2363",e5a27df7:"2416",fc80686b:"2440","48dd39e2":"2442","05916282":"2502",d2df711a:"2601",b647df5a:"2624",f43def45:"2656",e36b815f:"2659","4941928a":"2703","33a5adb4":"2758",a7d61b99:"2766",aa079c8b:"2772","2a474b18":"2822","6608151e":"2891",dd8b0175:"2972","4351d34b":"3095","85e14910":"3170",fea96f18:"3309","0d71a3f1":"3316",d30d9744:"3344",ec1d9510:"3421","5f85402d":"3489",a9789633:"3543","63150b11":"3596","1a5572f6":"3676","9d48492b":"3737",a89007e0:"3767","097bb47a":"3803","6916680a":"3818","02a1e558":"4026",eae657ee:"4134","6d1ddfa7":"4240","732c3ce9":"4340",b4c5bdfe:"4344","25e9e857":"4393","8e1736e0":"4394","151633a5":"4528","1df93b7f":"4583","1d8e39f8":"4611","03be7dae":"4768",c4ba122c:"4769","58f4fbf7":"4787","5b1cb890":"4827","27af8d7b":"4868","09df063d":"5027","9251a350":"5075",eabdbf07:"5100",d19b9e8a:"5240",f97daad0:"5243","4e0c07c5":"5250",cd9c57cb:"5297",f67ebb5d:"5416","9903dc99":"5487","357d33d4":"5492","22e4d634":"5559",d720bb60:"5596",c00c612c:"5603","8665e647":"5700",aba21aa0:"5742","6266f1ba":"5883",a09c2993:"5899","203fc93e":"6038","51d67042":"6060","95451dd5":"6201","9798ce17":"6224","407f8801":"6261",af572879:"6308","47cccd8d":"6323","5ae6b2db":"6358",f546eb96:"6370","2ab18ce5":"6530",fbd32610:"6543",e1715838:"6603",ef2f3ccd:"6741","5465ebbc":"6883","5ee9d842":"6917","327b6d8e":"6968","1e388ac9":"6969","27299a3b":"7036",a7bd4aaa:"7098","5d23d50c":"7168","72f058d3":"7330","68e3f1d5":"7367","3c7caf67":"7375","4b3f866b":"7400","6a6dcee7":"7466",f3212b1e:"7511",a389e28e:"7554","5253afba":"7832","54f44165":"7924",dd1da75d:"7951",fa17a3e5:"8054","494f4f5e":"8108","9fc1d339":"8201","3b270bcb":"8388",adb64ee2:"8480","04b3fc6c":"8582",ea131d77:"8624","29d26392":"8626","6059e070":"8649","7aeeadd4":"8654",d9330f66:"8678",f14ecac0:"8704",ebf39289:"8715","710ad8a9":"8828","47c825a2":"8879","04ae74d1":"8889","5b125e0e":"8904",b83f237d:"8930","9a2fa73a":"8937","252e2b80":"8955",a94703ab:"9048",aad144a3:"9104",df70a34a:"9197",d957c22b:"9353","651850eb":"9461",c1bdbc58:"9467","1a421168":"9631","5e95c892":"9647",bb70b9c8:"9760","388d3430":"9762","0dc350cc":"9800","5635425a":"9806","44b4d73b":"9829",ec7d5e88:"9896"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,d)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)d.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var b=new Promise(((d,b)=>f=e[a]=[d,b]));d.push(f[2]=b);var c=r.p+r.u(a),t=new Error;r.l(c,(d=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var b=d&&("load"===d.type?"missing":d.type),c=d&&d.target&&d.target.src;t.message="Loading chunk "+a+" failed.\n("+b+": "+c+")",t.name="ChunkLoadError",t.type=b,t.request=c,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,d)=>{var f,b,c=d[0],t=d[1],o=d[2],n=0;if(c.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(d);n<c.length;n++)b=c[n],r.o(e,b)&&e[b]&&e[b][0](),e[b]=0;return r.O(i)},d=self.webpackChunkwebsite=self.webpackChunkwebsite||[];d.forEach(a.bind(null,0)),d.push=a.bind(null,d.push.bind(d))})()})(); \ No newline at end of file diff --git a/docs/10.x/getting-started/installation/index.html b/docs/10.x/getting-started/installation/index.html index 152db77f32..5775672e45 100644 --- a/docs/10.x/getting-started/installation/index.html +++ b/docs/10.x/getting-started/installation/index.html @@ -2,7 +2,7 @@ <html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-10.x docs-doc-page docs-doc-id-getting-started/installation" data-has-hydrated="false"> <head> <meta charset="UTF-8"> -<meta name="generator" content="Docusaurus v3.6.3"> +<meta name="generator" content="Docusaurus v3.7.0"> <title data-rh="true">Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 10.x

Installation

Dependencies

+
Version: 10.x

Installation

Dependencies

You can install jest-preset-angular and dependencies all at once with one of the following commands.

npm install -D jest jest-preset-angular @types/jest

Configuration

@@ -45,6 +45,6 @@

Global mo
// Assuming that your global setup file is setup-jest.ts
import 'jest-preset-angular/setup-jest';
import './jest-global-mocks';
tip

An example for jest-global-mocks.ts

Object.defineProperty(document, 'doctype', {
value: '<!DOCTYPE html>',
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => {
return {
display: 'none',
appearance: ['-webkit-appearance'],
};
},
});
/**
* ISSUE: https://github.com/angular/material2/issues/7101
* Workaround for JSDOM missing transform property
*/
Object.defineProperty(document.body.style, 'transform', {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});

Avoid karma conflicts

-

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

+

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

\ No newline at end of file diff --git a/docs/10.x/getting-started/options/index.html b/docs/10.x/getting-started/options/index.html index 07894de552..b9049feff6 100644 --- a/docs/10.x/getting-started/options/index.html +++ b/docs/10.x/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 10.x

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object +

Version: 10.x

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

More information about ts-jest options, see doc

important

Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -38,6 +38,6 @@

+
\ No newline at end of file diff --git a/docs/10.x/getting-started/presets/index.html b/docs/10.x/getting-started/presets/index.html index 59ab0dd6f8..b4f3dafa90 100644 --- a/docs/10.x/getting-started/presets/index.html +++ b/docs/10.x/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 10.x

Presets

The presets

+
Version: 10.x

Presets

The presets

jest-preset-angular comes with 2 presets, covering most of the project's base configuration:

Preset nameDescription
jest-preset-angular/presets/default
or jest-preset-angular
TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to CommonJS syntax.
jest-preset-angular/presets/defaults-esm
TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to ESM syntax.

Basic usage

@@ -34,6 +34,6 @@

Advanced

// jest.config.js
const { defaults: jestNgPreset } = require('jest-preset-angular/presets');
// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')

module.exports = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};

Or through TypeScript (if ts-node is installed):

-
// jest.config.ts
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
import { defaults as jestNgPreset } from 'jest-preset-angular/presets';
// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'

const config: InitialOptionsTsJest = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};

export default config;
+
// jest.config.ts
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
import { defaults as jestNgPreset } from 'jest-preset-angular/presets';
// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'

const config: InitialOptionsTsJest = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};

export default config;
\ No newline at end of file diff --git a/docs/10.x/getting-started/test-environment/index.html b/docs/10.x/getting-started/test-environment/index.html index 330e473207..259a4c9042 100644 --- a/docs/10.x/getting-started/test-environment/index.html +++ b/docs/10.x/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 10.x

Test environment

If you look at setup-jest.ts, +

Version: 10.x

Test environment

If you look at setup-jest.ts, what we're doing here is we're adding globals required by Angular. With the included jest-zone-patch -we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

+we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

\ No newline at end of file diff --git a/docs/10.x/guides/absolute-imports/index.html b/docs/10.x/guides/absolute-imports/index.html index 773cb06da8..abcc93debf 100644 --- a/docs/10.x/guides/absolute-imports/index.html +++ b/docs/10.x/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 10.x

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

Version: 10.x

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

-

More information see ts-jest paths mapping configuration documentation

+

More information see ts-jest paths mapping configuration documentation

\ No newline at end of file diff --git a/docs/10.x/guides/angular-ivy/index.html b/docs/10.x/guides/angular-ivy/index.html index 201c3c3451..5d21a6d4fc 100644 --- a/docs/10.x/guides/angular-ivy/index.html +++ b/docs/10.x/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
Version: 10.x

Angular Ivy

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the +

Version: 10.x

Angular Ivy

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

jest-preset-angular also provides util script to help you to run ngcc with Jest but this script only works via the JavaScript version of Jest config

-
// jest.config.js
require('jest-preset-angular/ngcc-jest-processor');

module.exports = {
// [...]
};
+
// jest.config.js
require('jest-preset-angular/ngcc-jest-processor');

module.exports = {
// [...]
};
\ No newline at end of file diff --git a/docs/10.x/guides/esm-support/index.html b/docs/10.x/guides/esm-support/index.html index a4a0660bc2..798464b5eb 100644 --- a/docs/10.x/guides/esm-support/index.html +++ b/docs/10.x/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 10.x

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

+
Version: 10.x

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

There is also a preset to work with ESM.

Examples

@@ -29,6 +29,6 @@

Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

-
// jest.config.js
module.exports = {
// [...]
preset: 'jest-preset-angular/presets/defaults-esm',
};
+
// jest.config.js
module.exports = {
// [...]
preset: 'jest-preset-angular/presets/defaults-esm',
};
\ No newline at end of file diff --git a/docs/10.x/guides/jsdom-version/index.html b/docs/10.x/guides/jsdom-version/index.html index 3415a71d78..fc5aaee331 100644 --- a/docs/10.x/guides/jsdom-version/index.html +++ b/docs/10.x/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
Version: 10.x

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

+
Version: 10.x

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

// jest.config.js
module.exports = {
testEnvironment: 'jest-environment-jsdom-sixteen',
};

If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

-

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

+

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

\ No newline at end of file diff --git a/docs/10.x/guides/troubleshooting/index.html b/docs/10.x/guides/troubleshooting/index.html index ae78f9b4ab..d651c16410 100644 --- a/docs/10.x/guides/troubleshooting/index.html +++ b/docs/10.x/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 10.x

Troubleshooting

You can check Jest troubleshooting guide

+
Version: 10.x

Troubleshooting

You can check Jest troubleshooting guide

Common issues

Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

Can't resolve all parameters for SomeClass(?)

@@ -79,6 +79,6 @@

Resolution<

In these cases, a transformIgnorePatterns whitelisting could not fix the issue. The solution here is to use a custom resolver. You may or may not need to remove entries from transformIgnorePatterns whitelisting.

Here is an example of a resolver which would fix firebase related packages.

// jest.resolver.js
module.exports = (path, options) => {
// Call the defaultResolver, so we leverage its cache, error handling, etc.
return options.defaultResolver(path, {
...options,
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
packageFilter: (pkg) => {
const pkgNamesToTarget = new Set([
'rxjs',
'@firebase/auth',
'@firebase/storage',
'@firebase/functions',
'@firebase/database',
'@firebase/auth-compat',
'@firebase/database-compat',
'@firebase/app-compat',
'@firebase/firestore',
'@firebase/firestore-compat',
'@firebase/messaging',
'@firebase/util',
'firebase',
]);

if (pkgNamesToTarget.has(pkg.name)) {
// console.log('>>>', pkg.name)
delete pkg['exports'];
delete pkg['module'];
}

return pkg;
},
});
};
-
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...

+
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...
\ No newline at end of file diff --git a/docs/10.x/guides/using-with-babel/index.html b/docs/10.x/guides/using-with-babel/index.html index ffc14e180b..6dcfbfb6ce 100644 --- a/docs/10.x/guides/using-with-babel/index.html +++ b/docs/10.x/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 10.x

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

+
Version: 10.x

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

  1. Install dependencies required by the official Jest documentation for Babel integration.

    @@ -32,6 +32,6 @@
    1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
    -
    module.exports = {
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };
+
module.exports = {
transform: {
'^.+\\.(ts|html)$': 'jest-preset-angular',
'^.+\\.js$': 'babel-jest',
},
};
\ No newline at end of file diff --git a/docs/10.x/index.html b/docs/10.x/index.html index 84927ef0e2..6b1569ef46 100644 --- a/docs/10.x/index.html +++ b/docs/10.x/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
Version: 10.x

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

+
Version: 10.x

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

This is a part of the article: Testing Angular faster with Jest.

important

Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

+@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

\ No newline at end of file diff --git a/docs/10.x/processing/index.html b/docs/10.x/processing/index.html index 22c2d46b0a..a22ae6eef1 100644 --- a/docs/10.x/processing/index.html +++ b/docs/10.x/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
+
\ No newline at end of file diff --git a/docs/11.0/getting-started/installation/index.html b/docs/11.0/getting-started/installation/index.html index a3e3df1d9c..5d50ab724b 100644 --- a/docs/11.0/getting-started/installation/index.html +++ b/docs/11.0/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.0

Installation

Dependencies

+
Version: 11.0

Installation

Dependencies

You can install jest-preset-angular and dependencies all at once with one of the following commands.

npm install -D jest jest-preset-angular @types/jest

Configuration

@@ -45,6 +45,6 @@

Global mo
// Assuming that your global setup file is setup-jest.ts
import 'jest-preset-angular/setup-jest';
import './jest-global-mocks';
tip

An example for jest-global-mocks.ts

Object.defineProperty(document, 'doctype', {
value: '<!DOCTYPE html>',
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => {
return {
display: 'none',
appearance: ['-webkit-appearance'],
};
},
});
/**
* ISSUE: https://github.com/angular/material2/issues/7101
* Workaround for JSDOM missing transform property
*/
Object.defineProperty(document.body.style, 'transform', {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});

Avoid karma conflicts

-

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

+

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

\ No newline at end of file diff --git a/docs/11.0/getting-started/options/index.html b/docs/11.0/getting-started/options/index.html index 2583a637b1..488a633019 100644 --- a/docs/11.0/getting-started/options/index.html +++ b/docs/11.0/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.0

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object +

Version: 11.0

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

More information about ts-jest options, see doc

important

Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -40,6 +40,6 @@

+
\ No newline at end of file diff --git a/docs/11.0/getting-started/presets/index.html b/docs/11.0/getting-started/presets/index.html index 269a58e3eb..2de959e3b0 100644 --- a/docs/11.0/getting-started/presets/index.html +++ b/docs/11.0/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.0

Presets

The presets

+
Version: 11.0

Presets

The presets

jest-preset-angular comes with 2 presets, covering most of the project's base configuration:

Preset nameDescription
jest-preset-angular/presets/default
or jest-preset-angular
TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to CommonJS syntax.
jest-preset-angular/presets/defaults-esm
TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to ESM syntax.

Basic usage

@@ -34,6 +34,6 @@

Advanced

// jest.config.js
const { defaults: jestNgPreset } = require('jest-preset-angular/presets');
// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')

module.exports = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};

Or through TypeScript (if ts-node is installed):

-
// jest.config.ts
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
import { defaults as jestNgPreset } from 'jest-preset-angular/presets';
// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'

const config: InitialOptionsTsJest = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};

export default config;
+
// jest.config.ts
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
import { defaults as jestNgPreset } from 'jest-preset-angular/presets';
// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'

const config: InitialOptionsTsJest = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};

export default config;
\ No newline at end of file diff --git a/docs/11.0/getting-started/test-environment/index.html b/docs/11.0/getting-started/test-environment/index.html index 7ed00f5c03..11084fd24a 100644 --- a/docs/11.0/getting-started/test-environment/index.html +++ b/docs/11.0/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 11.0

Test environment

If you look at setup-jest.ts, +

Version: 11.0

Test environment

If you look at setup-jest.ts, what we're doing here is we're adding globals required by Angular. With the included jest-zone-patch -we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

+we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

\ No newline at end of file diff --git a/docs/11.0/guides/absolute-imports/index.html b/docs/11.0/guides/absolute-imports/index.html index 78015b09e8..91972b1463 100644 --- a/docs/11.0/guides/absolute-imports/index.html +++ b/docs/11.0/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 11.0

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

Version: 11.0

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

-

More information see ts-jest paths mapping configuration documentation

+

More information see ts-jest paths mapping configuration documentation

\ No newline at end of file diff --git a/docs/11.0/guides/angular-13+/index.html b/docs/11.0/guides/angular-13+/index.html index dde1a554d4..7e79f98dcd 100644 --- a/docs/11.0/guides/angular-13+/index.html +++ b/docs/11.0/guides/angular-13+/index.html @@ -2,7 +2,7 @@ - + Angular >=13 | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.0

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular +

Version: 11.0

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset. Jest ESM support with Angular 13 is new and may have issues.

Starting from v11.0.0, jest-preset-angular introduces a few extra changes to be able to run Jest with Angular 13:

@@ -76,6 +76,6 @@

// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};

+
// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};
\ No newline at end of file diff --git a/docs/11.0/guides/angular-ivy/index.html b/docs/11.0/guides/angular-ivy/index.html index c41180ceac..c72c830593 100644 --- a/docs/11.0/guides/angular-ivy/index.html +++ b/docs/11.0/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
Version: 11.0

Angular Ivy

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the +

Version: 11.0

Angular Ivy

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

jest-preset-angular also provides util script to help you to run ngcc with Jest but this script only works via the JavaScript version of Jest config

-
// jest.config.js
require('jest-preset-angular/ngcc-jest-processor');

module.exports = {
// [...]
};
+
// jest.config.js
require('jest-preset-angular/ngcc-jest-processor');

module.exports = {
// [...]
};
\ No newline at end of file diff --git a/docs/11.0/guides/esm-support/index.html b/docs/11.0/guides/esm-support/index.html index 88b07b98c0..45c759c06b 100644 --- a/docs/11.0/guides/esm-support/index.html +++ b/docs/11.0/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.0

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

+
Version: 11.0

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

There is also a preset to work with ESM.

tip

We have example apps which contains base ESM setup to work with Jest and Angular.

@@ -30,6 +30,6 @@

Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

-
// jest.config.js
module.exports = {
// [...]
preset: 'jest-preset-angular/presets/defaults-esm',
};
+
// jest.config.js
module.exports = {
// [...]
preset: 'jest-preset-angular/presets/defaults-esm',
};
\ No newline at end of file diff --git a/docs/11.0/guides/jsdom-version/index.html b/docs/11.0/guides/jsdom-version/index.html index b44851037f..d590e98d63 100644 --- a/docs/11.0/guides/jsdom-version/index.html +++ b/docs/11.0/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
Version: 11.0

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

+
Version: 11.0

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

// jest.config.js
module.exports = {
testEnvironment: 'jest-environment-jsdom-sixteen',
};

If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

-

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

+

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

\ No newline at end of file diff --git a/docs/11.0/guides/troubleshooting/index.html b/docs/11.0/guides/troubleshooting/index.html index 17282f09fb..aa24e69db7 100644 --- a/docs/11.0/guides/troubleshooting/index.html +++ b/docs/11.0/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.0

Troubleshooting

You can check Jest troubleshooting guide

+
Version: 11.0

Troubleshooting

You can check Jest troubleshooting guide

Common issues

Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

Can't resolve all parameters for SomeClass(?)

@@ -79,6 +79,6 @@

Resolution<

In these cases, a transformIgnorePatterns whitelisting could not fix the issue. The solution here is to use a custom resolver. You may or may not need to remove entries from transformIgnorePatterns whitelisting.

Here is an example of a resolver which would fix firebase related packages.

// jest.resolver.js
module.exports = (path, options) => {
// Call the defaultResolver, so we leverage its cache, error handling, etc.
return options.defaultResolver(path, {
...options,
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
packageFilter: (pkg) => {
const pkgNamesToTarget = new Set([
'rxjs',
'@firebase/auth',
'@firebase/storage',
'@firebase/functions',
'@firebase/database',
'@firebase/auth-compat',
'@firebase/database-compat',
'@firebase/app-compat',
'@firebase/firestore',
'@firebase/firestore-compat',
'@firebase/messaging',
'@firebase/util',
'firebase',
]);

if (pkgNamesToTarget.has(pkg.name)) {
// console.log('>>>', pkg.name)
delete pkg['exports'];
delete pkg['module'];
}

return pkg;
},
});
};
-
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...

+
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...
\ No newline at end of file diff --git a/docs/11.0/guides/using-with-babel/index.html b/docs/11.0/guides/using-with-babel/index.html index 14eeb6eb38..0d5260a7ab 100644 --- a/docs/11.0/guides/using-with-babel/index.html +++ b/docs/11.0/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.0

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

+
Version: 11.0

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

  1. Install dependencies required by the official Jest documentation for Babel integration.

    @@ -32,6 +32,6 @@
    1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
    -
    module.exports = {
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };
+
module.exports = {
transform: {
'^.+\\.(ts|html)$': 'jest-preset-angular',
'^.+\\.js$': 'babel-jest',
},
};
\ No newline at end of file diff --git a/docs/11.0/index.html b/docs/11.0/index.html index a13e3fbcd4..a822f19c30 100644 --- a/docs/11.0/index.html +++ b/docs/11.0/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
Version: 11.0

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

+
Version: 11.0

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

This is a part of the article: Testing Angular faster with Jest.

important

Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

+@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

\ No newline at end of file diff --git a/docs/11.0/processing/index.html b/docs/11.0/processing/index.html index 97cc0e5f82..e21e3f6ab5 100644 --- a/docs/11.0/processing/index.html +++ b/docs/11.0/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
+
\ No newline at end of file diff --git a/docs/11.1/getting-started/installation/index.html b/docs/11.1/getting-started/installation/index.html index 559cdf652a..9967beb292 100644 --- a/docs/11.1/getting-started/installation/index.html +++ b/docs/11.1/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.1

Installation

Dependencies

+
Version: 11.1

Installation

Dependencies

You can install jest-preset-angular and dependencies all at once with one of the following commands.

npm install -D jest jest-preset-angular @types/jest

Configuration

@@ -45,6 +45,6 @@

Global mo
// Assuming that your global setup file is setup-jest.ts
import 'jest-preset-angular/setup-jest';
import './jest-global-mocks';
tip

An example for jest-global-mocks.ts

Object.defineProperty(document, 'doctype', {
value: '<!DOCTYPE html>',
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => {
return {
display: 'none',
appearance: ['-webkit-appearance'],
};
},
});
/**
* ISSUE: https://github.com/angular/material2/issues/7101
* Workaround for JSDOM missing transform property
*/
Object.defineProperty(document.body.style, 'transform', {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});

Avoid karma conflicts

-

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

+

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

\ No newline at end of file diff --git a/docs/11.1/getting-started/options/index.html b/docs/11.1/getting-started/options/index.html index 844df9d152..3efbc03b89 100644 --- a/docs/11.1/getting-started/options/index.html +++ b/docs/11.1/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.1

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object +

Version: 11.1

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

More information about ts-jest options, see doc

important

Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -40,6 +40,6 @@

+
\ No newline at end of file diff --git a/docs/11.1/getting-started/presets/index.html b/docs/11.1/getting-started/presets/index.html index fc9089c3ae..21c1858959 100644 --- a/docs/11.1/getting-started/presets/index.html +++ b/docs/11.1/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.1

Presets

The presets

+
Version: 11.1

Presets

The presets

jest-preset-angular comes with 2 presets, covering most of the project's base configuration:

Preset nameDescription
jest-preset-angular/presets/default
or jest-preset-angular
TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to CommonJS syntax.
jest-preset-angular/presets/defaults-esm
TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to ESM syntax.

Basic usage

@@ -34,6 +34,6 @@

Advanced

// jest.config.js
const { defaults: jestNgPreset } = require('jest-preset-angular/presets');
// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')

module.exports = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};

Or through TypeScript (if ts-node is installed):

-
// jest.config.ts
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
import { defaults as jestNgPreset } from 'jest-preset-angular/presets';
// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'

const config: InitialOptionsTsJest = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};

export default config;
+
// jest.config.ts
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
import { defaults as jestNgPreset } from 'jest-preset-angular/presets';
// import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'

const config: InitialOptionsTsJest = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};

export default config;
\ No newline at end of file diff --git a/docs/11.1/getting-started/test-environment/index.html b/docs/11.1/getting-started/test-environment/index.html index 418281c5ba..6ac2a53142 100644 --- a/docs/11.1/getting-started/test-environment/index.html +++ b/docs/11.1/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 11.1

Test environment

If you look at setup-jest.ts, +

Version: 11.1

Test environment

If you look at setup-jest.ts, what we're doing here is we're adding globals required by Angular. With the included jest-zone-patch -we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

+we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

\ No newline at end of file diff --git a/docs/11.1/guides/absolute-imports/index.html b/docs/11.1/guides/absolute-imports/index.html index 28e238300d..c5fa349116 100644 --- a/docs/11.1/guides/absolute-imports/index.html +++ b/docs/11.1/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 11.1

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

Version: 11.1

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

-

More information see ts-jest paths mapping configuration documentation

+

More information see ts-jest paths mapping configuration documentation

\ No newline at end of file diff --git a/docs/11.1/guides/angular-13+/index.html b/docs/11.1/guides/angular-13+/index.html index 45975fb643..f0a5f106aa 100644 --- a/docs/11.1/guides/angular-13+/index.html +++ b/docs/11.1/guides/angular-13+/index.html @@ -2,7 +2,7 @@ - + Angular >=13 | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.1

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular +

Version: 11.1

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset. Jest ESM support with Angular 13 is new and may have issues.

Starting from v11.0.0, jest-preset-angular introduces a few extra changes to be able to run Jest with Angular 13:

@@ -76,6 +76,6 @@

// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};

+
// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};
\ No newline at end of file diff --git a/docs/11.1/guides/angular-ivy/index.html b/docs/11.1/guides/angular-ivy/index.html index e7f9a5f0d7..e00fc88c48 100644 --- a/docs/11.1/guides/angular-ivy/index.html +++ b/docs/11.1/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,18 +13,18 @@ - - - + + + -
Version: 11.1

Angular Ivy

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the +

Version: 11.1

Angular Ivy

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

jest-preset-angular also provides a Jest global-setup.js file to help you to run ngcc with Jest. Add to the following section:

  • to your root Jest config
-
// jest.config.js
module.exports = {
// [...]
globalSetup: 'jest-preset-angular/global-setup',
};
+
// jest.config.js
module.exports = {
// [...]
globalSetup: 'jest-preset-angular/global-setup',
};
\ No newline at end of file diff --git a/docs/11.1/guides/esm-support/index.html b/docs/11.1/guides/esm-support/index.html index 35e447f3df..11b8fa5e5d 100644 --- a/docs/11.1/guides/esm-support/index.html +++ b/docs/11.1/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.1

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

+
Version: 11.1

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

There is also a preset to work with ESM.

tip

We have example apps which contains base ESM setup to work with Jest and Angular.

@@ -30,6 +30,6 @@

Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

-
// jest.config.js
module.exports = {
// [...]
preset: 'jest-preset-angular/presets/defaults-esm',
};
+
// jest.config.js
module.exports = {
// [...]
preset: 'jest-preset-angular/presets/defaults-esm',
};
\ No newline at end of file diff --git a/docs/11.1/guides/jsdom-version/index.html b/docs/11.1/guides/jsdom-version/index.html index 3020c5e3af..9d4ecdccce 100644 --- a/docs/11.1/guides/jsdom-version/index.html +++ b/docs/11.1/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
Version: 11.1

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

+
Version: 11.1

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

// jest.config.js
module.exports = {
testEnvironment: 'jest-environment-jsdom-sixteen',
};

If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

-

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

+

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

\ No newline at end of file diff --git a/docs/11.1/guides/troubleshooting/index.html b/docs/11.1/guides/troubleshooting/index.html index ee59f706e6..a8faaf5317 100644 --- a/docs/11.1/guides/troubleshooting/index.html +++ b/docs/11.1/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.1

Troubleshooting

You can check Jest troubleshooting guide

+
Version: 11.1

Troubleshooting

You can check Jest troubleshooting guide

Common issues

Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

Can't resolve all parameters for SomeClass(?)

@@ -79,6 +79,6 @@

Resolution<

In these cases, a transformIgnorePatterns whitelisting could not fix the issue. The solution here is to use a custom resolver. You may or may not need to remove entries from transformIgnorePatterns whitelisting.

Here is an example of a resolver which would fix firebase related packages.

// jest.resolver.js
module.exports = (path, options) => {
// Call the defaultResolver, so we leverage its cache, error handling, etc.
return options.defaultResolver(path, {
...options,
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
packageFilter: (pkg) => {
const pkgNamesToTarget = new Set([
'rxjs',
'@firebase/auth',
'@firebase/storage',
'@firebase/functions',
'@firebase/database',
'@firebase/auth-compat',
'@firebase/database-compat',
'@firebase/app-compat',
'@firebase/firestore',
'@firebase/firestore-compat',
'@firebase/messaging',
'@firebase/util',
'firebase',
]);

if (pkgNamesToTarget.has(pkg.name)) {
// console.log('>>>', pkg.name)
delete pkg['exports'];
delete pkg['module'];
}

return pkg;
},
});
};
-
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...

+
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...
\ No newline at end of file diff --git a/docs/11.1/guides/using-with-babel/index.html b/docs/11.1/guides/using-with-babel/index.html index 846ed6eb47..c9846e8cc2 100644 --- a/docs/11.1/guides/using-with-babel/index.html +++ b/docs/11.1/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 11.1

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

+
Version: 11.1

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

  1. Install dependencies required by the official Jest documentation for Babel integration.

    @@ -32,6 +32,6 @@
    1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
    -
    module.exports = {
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };
+
module.exports = {
transform: {
'^.+\\.(ts|html)$': 'jest-preset-angular',
'^.+\\.js$': 'babel-jest',
},
};
\ No newline at end of file diff --git a/docs/11.1/index.html b/docs/11.1/index.html index 893300685a..884a27e77f 100644 --- a/docs/11.1/index.html +++ b/docs/11.1/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
Version: 11.1

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

+
Version: 11.1

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

This is a part of the article: Testing Angular faster with Jest.

important

Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

+@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

\ No newline at end of file diff --git a/docs/11.1/processing/index.html b/docs/11.1/processing/index.html index 810e5def00..5e92d71837 100644 --- a/docs/11.1/processing/index.html +++ b/docs/11.1/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
+
\ No newline at end of file diff --git a/docs/12.0/getting-started/installation/index.html b/docs/12.0/getting-started/installation/index.html index 3d4b85f86d..1df2c24bba 100644 --- a/docs/12.0/getting-started/installation/index.html +++ b/docs/12.0/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 12.0

Installation

Dependencies

+
Version: 12.0

Installation

Dependencies

You can install jest-preset-angular and dependencies all at once with one of the following commands.

npm install -D jest jest-preset-angular @types/jest

Configuration

@@ -45,6 +45,6 @@

Global mo
// Assuming that your global setup file is setup-jest.ts
import 'jest-preset-angular/setup-jest';
import './jest-global-mocks';
tip

An example for jest-global-mocks.ts

Object.defineProperty(document, 'doctype', {
value: '<!DOCTYPE html>',
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => {
return {
display: 'none',
appearance: ['-webkit-appearance'],
};
},
});
/**
* ISSUE: https://github.com/angular/material2/issues/7101
* Workaround for JSDOM missing transform property
*/
Object.defineProperty(document.body.style, 'transform', {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});

Avoid karma conflicts

-

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

+

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

\ No newline at end of file diff --git a/docs/12.0/getting-started/options/index.html b/docs/12.0/getting-started/options/index.html index be479f036c..05edc7cc21 100644 --- a/docs/12.0/getting-started/options/index.html +++ b/docs/12.0/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 12.0

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object +

Version: 12.0

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

More information about ts-jest options, see doc

important

Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -41,6 +41,6 @@

+
\ No newline at end of file diff --git a/docs/12.0/getting-started/presets/index.html b/docs/12.0/getting-started/presets/index.html index 565b309900..939e880327 100644 --- a/docs/12.0/getting-started/presets/index.html +++ b/docs/12.0/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 12.0

Presets

The presets

+
+
// jest.config.js
const { defaults: jestNgPreset } = require('jest-preset-angular/presets');
// const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')

module.exports = {
// [...]
globals: {
'ts-jest': {
...jestNgPreset.globals['ts-jest'],
// [...your overriden options]
},
},
};
\ No newline at end of file diff --git a/docs/12.0/getting-started/test-environment/index.html b/docs/12.0/getting-started/test-environment/index.html index a195e669d6..a9ecbac85d 100644 --- a/docs/12.0/getting-started/test-environment/index.html +++ b/docs/12.0/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 12.0

Test environment

If you look at setup-jest.js, +

Version: 12.0

Test environment

If you look at setup-jest.js, what we're doing here is we're adding globals required by Angular. With the included Angular zone patch we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

While setup-jest.js above is for running Jest with CommonJS mode, we also provide setup-jest.mjs @@ -27,6 +27,6 @@

// setup-test.ts
globalThis.ngJest = {
testEnvironmentOptions: {
teardown: {
destroyAfterEach: false,
rethrowErrors: true,
},
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};

import 'jest-preset-angular/setup-jest';

-

jest-preset-angular will look at globalThis.ngJest and pass the correct TestEnvironmentOptions object to TestBed.

+

jest-preset-angular will look at globalThis.ngJest and pass the correct TestEnvironmentOptions object to TestBed.

\ No newline at end of file diff --git a/docs/12.0/guides/absolute-imports/index.html b/docs/12.0/guides/absolute-imports/index.html index 6d9797cd64..1bba307727 100644 --- a/docs/12.0/guides/absolute-imports/index.html +++ b/docs/12.0/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 12.0

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

Version: 12.0

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

-

More information see ts-jest paths mapping configuration documentation

+

More information see ts-jest paths mapping configuration documentation

\ No newline at end of file diff --git a/docs/12.0/guides/angular-13+/index.html b/docs/12.0/guides/angular-13+/index.html index f58bb9fcee..d417ba4429 100644 --- a/docs/12.0/guides/angular-13+/index.html +++ b/docs/12.0/guides/angular-13+/index.html @@ -2,7 +2,7 @@ - + Angular >=13 | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 12.0

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular +

Version: 12.0

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset.

important

With Jest 28 and jest-preset-angular v12.0.0, ng-jest-resolver is no longer required to have in Jest config. This resolver is also excluded from our default and default ESM presets.

@@ -63,6 +63,6 @@

// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};

+
// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};
\ No newline at end of file diff --git a/docs/12.0/guides/angular-ivy/index.html b/docs/12.0/guides/angular-ivy/index.html index 96a5a622ea..ebe3674439 100644 --- a/docs/12.0/guides/angular-ivy/index.html +++ b/docs/12.0/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 12.0

Angular Ivy

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the +

Version: 12.0

Angular Ivy

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

jest-preset-angular also provides a Jest global setup file to help you to run ngcc with Jest. Add to the following section:

@@ -28,6 +28,6 @@
// jest.config.js
module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};

Control ngcc processing

Since v12.0.0, jest-preset-angular provide a possibility to skip ngcc via globalThis by doing the following

-
// jest.config.js
globalThis.ngJest = {
skipNgcc: true,
tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
};

module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};
+
// jest.config.js
globalThis.ngJest = {
skipNgcc: true,
tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
};

module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};
\ No newline at end of file diff --git a/docs/12.0/guides/esm-support/index.html b/docs/12.0/guides/esm-support/index.html index b4543da0ff..189a9f9ede 100644 --- a/docs/12.0/guides/esm-support/index.html +++ b/docs/12.0/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 12.0

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

+
Version: 12.0

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

There is also a preset to work with ESM.

tip

We have example apps which contains base ESM setup to work with Jest and Angular.

@@ -32,6 +32,6 @@

Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

-
// jest.config.js
module.exports = {
//...
preset: 'jest-preset-angular/presets/defaults-esm',
};
+
// jest.config.js
module.exports = {
//...
preset: 'jest-preset-angular/presets/defaults-esm',
};
\ No newline at end of file diff --git a/docs/12.0/guides/jsdom-version/index.html b/docs/12.0/guides/jsdom-version/index.html index 2a0d28c3f1..34956a81cb 100644 --- a/docs/12.0/guides/jsdom-version/index.html +++ b/docs/12.0/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
Version: 12.0

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

+
Version: 12.0

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

// jest.config.js
module.exports = {
testEnvironment: 'jest-environment-jsdom-sixteen',
};

If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

-

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

+

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

\ No newline at end of file diff --git a/docs/12.0/guides/troubleshooting/index.html b/docs/12.0/guides/troubleshooting/index.html index 168dcc09bd..195b8ac34c 100644 --- a/docs/12.0/guides/troubleshooting/index.html +++ b/docs/12.0/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 12.0

Troubleshooting

You can check Jest troubleshooting guide

+
Version: 12.0

Troubleshooting

You can check Jest troubleshooting guide

Common issues

Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

Can't resolve all parameters for SomeClass(?)

@@ -79,6 +79,6 @@

Resolution<

In these cases, a transformIgnorePatterns whitelisting could not fix the issue. The solution here is to use a custom resolver. You may or may not need to remove entries from transformIgnorePatterns whitelisting.

Here is an example of a resolver which would fix firebase related packages.

// jest.resolver.js
module.exports = (path, options) => {
// Call the defaultResolver, so we leverage its cache, error handling, etc.
return options.defaultResolver(path, {
...options,
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
packageFilter: (pkg) => {
const pkgNamesToTarget = new Set([
'rxjs',
'@firebase/auth',
'@firebase/storage',
'@firebase/functions',
'@firebase/database',
'@firebase/auth-compat',
'@firebase/database-compat',
'@firebase/app-compat',
'@firebase/firestore',
'@firebase/firestore-compat',
'@firebase/messaging',
'@firebase/util',
'firebase',
]);

if (pkgNamesToTarget.has(pkg.name)) {
// console.log('>>>', pkg.name)
delete pkg['exports'];
delete pkg['module'];
}

return pkg;
},
});
};
-
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...

+
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...
\ No newline at end of file diff --git a/docs/12.0/guides/using-with-babel/index.html b/docs/12.0/guides/using-with-babel/index.html index 6dd1bb72b3..5b2133a185 100644 --- a/docs/12.0/guides/using-with-babel/index.html +++ b/docs/12.0/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 12.0

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

+
Version: 12.0

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

  1. Install dependencies required by the official Jest documentation for Babel integration.

    @@ -32,6 +32,6 @@
    1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
    -
    // jest.config.js
    module.exports = {
    //...
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };
+
// jest.config.js
module.exports = {
//...
transform: {
'^.+\\.(ts|html)$': 'jest-preset-angular',
'^.+\\.js$': 'babel-jest',
},
};
\ No newline at end of file diff --git a/docs/12.0/index.html b/docs/12.0/index.html index 9afa09d00e..c6678833cc 100644 --- a/docs/12.0/index.html +++ b/docs/12.0/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
Version: 12.0

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

+
Version: 12.0

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

This is a part of the article: Testing Angular faster with Jest.

important

Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

+@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

\ No newline at end of file diff --git a/docs/12.0/processing/index.html b/docs/12.0/processing/index.html index 9019343c8a..983e915e36 100644 --- a/docs/12.0/processing/index.html +++ b/docs/12.0/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
+
\ No newline at end of file diff --git a/docs/13.0/getting-started/installation/index.html b/docs/13.0/getting-started/installation/index.html index 5fe161b291..806d4915ed 100644 --- a/docs/13.0/getting-started/installation/index.html +++ b/docs/13.0/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 13.0

Installation

Dependencies

+
Version: 13.0

Installation

Dependencies

You can install jest-preset-angular and dependencies all at once with one of the following commands.

npm install -D jest jest-preset-angular @types/jest

Configuration

@@ -45,6 +45,6 @@

Global mo
// Assuming that your global setup file is setup-jest.ts
import 'jest-preset-angular/setup-jest';
import './jest-global-mocks';
tip

An example for jest-global-mocks.ts

Object.defineProperty(document, 'doctype', {
value: '<!DOCTYPE html>',
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => {
return {
display: 'none',
appearance: ['-webkit-appearance'],
};
},
});
/**
* ISSUE: https://github.com/angular/material2/issues/7101
* Workaround for JSDOM missing transform property
*/
Object.defineProperty(document.body.style, 'transform', {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});

Avoid karma conflicts

-

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

+

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

\ No newline at end of file diff --git a/docs/13.0/getting-started/options/index.html b/docs/13.0/getting-started/options/index.html index 8e4cfccbb1..fc5044bf18 100644 --- a/docs/13.0/getting-started/options/index.html +++ b/docs/13.0/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 13.0

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object +

Version: 13.0

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

More information about ts-jest options, see doc

important

Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -41,6 +41,6 @@

+
\ No newline at end of file diff --git a/docs/13.0/getting-started/presets/index.html b/docs/13.0/getting-started/presets/index.html index b8b0ad5862..ef07428360 100644 --- a/docs/13.0/getting-started/presets/index.html +++ b/docs/13.0/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 13.0

Presets

The presets

+
+
// jest.config.js
const { defaultTransformerOptions } = require('jest-preset-angular/presets');
// const { defaultTransformerOptions } = require('jest-preset-angular/presets')

module.exports = {
// [...]
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
'jest-preset-angular',
{
...defaultTransformerOptions,
// [...your overriden options]
},
],
},
};
\ No newline at end of file diff --git a/docs/13.0/getting-started/test-environment/index.html b/docs/13.0/getting-started/test-environment/index.html index b9b51112ce..4e7b7d3356 100644 --- a/docs/13.0/getting-started/test-environment/index.html +++ b/docs/13.0/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 13.0

Test environment

If you look at setup-jest.js, +

Version: 13.0

Test environment

If you look at setup-jest.js, what we're doing here is we're adding globals required by Angular. With the included Angular zone patch we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

While setup-jest.js above is for running Jest with CommonJS mode, we also provide setup-jest.mjs @@ -27,6 +27,6 @@

// setup-test.ts
globalThis.ngJest = {
testEnvironmentOptions: {
teardown: {
destroyAfterEach: false,
rethrowErrors: true,
},
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};

import 'jest-preset-angular/setup-jest';

-

jest-preset-angular will look at globalThis.ngJest and pass the correct TestEnvironmentOptions object to TestBed.

+

jest-preset-angular will look at globalThis.ngJest and pass the correct TestEnvironmentOptions object to TestBed.

\ No newline at end of file diff --git a/docs/13.0/guides/absolute-imports/index.html b/docs/13.0/guides/absolute-imports/index.html index e4e286fe70..0cf773a495 100644 --- a/docs/13.0/guides/absolute-imports/index.html +++ b/docs/13.0/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 13.0

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

Version: 13.0

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

-

More information see ts-jest paths mapping configuration documentation

+

More information see ts-jest paths mapping configuration documentation

\ No newline at end of file diff --git a/docs/13.0/guides/angular-13+/index.html b/docs/13.0/guides/angular-13+/index.html index fb7e77ec75..1b0511be5d 100644 --- a/docs/13.0/guides/angular-13+/index.html +++ b/docs/13.0/guides/angular-13+/index.html @@ -2,7 +2,7 @@ - + Angular >=13 | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 13.0

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular +

Version: 13.0

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset.

important

With Jest 28 and jest-preset-angular v12.0.0, ng-jest-resolver is no longer required to have in Jest config. This resolver is also excluded from our default and default ESM presets.

@@ -66,6 +66,6 @@

// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};

Usage with Ionic 6 or 7

To support Ionic 6 or 7 you will need to modify transformIgnorePatterns to be as following:

-
// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
};
+
// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
};
\ No newline at end of file diff --git a/docs/13.0/guides/angular-ivy/index.html b/docs/13.0/guides/angular-ivy/index.html index cedd724279..3f3d9fafe9 100644 --- a/docs/13.0/guides/angular-ivy/index.html +++ b/docs/13.0/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 13.0

Angular Ivy

important

This step is OPTIONAL

+
Version: 13.0

Angular Ivy

important

This step is OPTIONAL

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

@@ -29,6 +29,6 @@
// jest.config.js
module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};

Control ngcc processing

Since v12.0.0, jest-preset-angular provide a possibility to skip ngcc via globalThis by doing the following

-
// jest.config.js
globalThis.ngJest = {
skipNgcc: true,
tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
};

module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};
+
// jest.config.js
globalThis.ngJest = {
skipNgcc: true,
tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
};

module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};
\ No newline at end of file diff --git a/docs/13.0/guides/esm-support/index.html b/docs/13.0/guides/esm-support/index.html index c6efaa1fb2..e90ea9e855 100644 --- a/docs/13.0/guides/esm-support/index.html +++ b/docs/13.0/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 13.0

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

+
Version: 13.0

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

There is also a preset to work with ESM.

tip

We have example apps which contains base ESM setup to work with Jest and Angular.

@@ -32,6 +32,6 @@

Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

-
// jest.config.js
module.exports = {
//...
preset: 'jest-preset-angular/presets/defaults-esm',
};
+
// jest.config.js
module.exports = {
//...
preset: 'jest-preset-angular/presets/defaults-esm',
};
\ No newline at end of file diff --git a/docs/13.0/guides/jsdom-version/index.html b/docs/13.0/guides/jsdom-version/index.html index 49be8deb74..2ef2cfc748 100644 --- a/docs/13.0/guides/jsdom-version/index.html +++ b/docs/13.0/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
Version: 13.0

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

+
Version: 13.0

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

// jest.config.js
module.exports = {
testEnvironment: 'jest-environment-jsdom-sixteen',
};

If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

-

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

+

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

\ No newline at end of file diff --git a/docs/13.0/guides/troubleshooting/index.html b/docs/13.0/guides/troubleshooting/index.html index 623f35c364..931403890a 100644 --- a/docs/13.0/guides/troubleshooting/index.html +++ b/docs/13.0/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 13.0

Troubleshooting

You can check Jest troubleshooting guide

+
Version: 13.0

Troubleshooting

You can check Jest troubleshooting guide

Common issues

Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

Can't resolve all parameters for SomeClass(?)

@@ -82,6 +82,6 @@

Resolution<
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...

Inject dependencies with TypeScript interface or exported namespace

Please use Angular inject instead of @Inject. -This is because jest-preset-angular has caveat when working with class constructor and decorator.

+This is because jest-preset-angular has caveat when working with class constructor and decorator.

\ No newline at end of file diff --git a/docs/13.0/guides/using-with-babel/index.html b/docs/13.0/guides/using-with-babel/index.html index 1c0c2ef05a..0b32c97224 100644 --- a/docs/13.0/guides/using-with-babel/index.html +++ b/docs/13.0/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 13.0

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

+
Version: 13.0

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

  1. Install dependencies required by the official Jest documentation for Babel integration.

    @@ -32,6 +32,6 @@
    1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
    -
    // jest.config.js
    module.exports = {
    //...
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };
+
// jest.config.js
module.exports = {
//...
transform: {
'^.+\\.(ts|html)$': 'jest-preset-angular',
'^.+\\.js$': 'babel-jest',
},
};
\ No newline at end of file diff --git a/docs/13.0/index.html b/docs/13.0/index.html index 5641c42347..eadf3284f3 100644 --- a/docs/13.0/index.html +++ b/docs/13.0/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
Version: 13.0

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

+
Version: 13.0

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

This is a part of the article: Testing Angular faster with Jest.

important

Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

+@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

\ No newline at end of file diff --git a/docs/13.0/processing/index.html b/docs/13.0/processing/index.html index 9c80cc6a7c..7b2ae94b51 100644 --- a/docs/13.0/processing/index.html +++ b/docs/13.0/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
+
\ No newline at end of file diff --git a/docs/14.0/getting-started/installation/index.html b/docs/14.0/getting-started/installation/index.html index 85dc418160..9e3c0ef400 100644 --- a/docs/14.0/getting-started/installation/index.html +++ b/docs/14.0/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.0

Installation

Dependencies

+
Version: 14.0

Installation

Dependencies

You can install jest-preset-angular and dependencies all at once with one of the following commands.

npm install -D jest jest-preset-angular @types/jest

Configuration

@@ -45,6 +45,6 @@

Global mo
// Assuming that your global setup file is setup-jest.ts
import 'jest-preset-angular/setup-jest';
import './jest-global-mocks';
tip

An example for jest-global-mocks.ts

Object.defineProperty(document, 'doctype', {
value: '<!DOCTYPE html>',
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => {
return {
display: 'none',
appearance: ['-webkit-appearance'],
};
},
});
/**
* ISSUE: https://github.com/angular/material2/issues/7101
* Workaround for JSDOM missing transform property
*/
Object.defineProperty(document.body.style, 'transform', {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});

Avoid karma conflicts

-

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

+

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

\ No newline at end of file diff --git a/docs/14.0/getting-started/options/index.html b/docs/14.0/getting-started/options/index.html index c593cc8b5c..385b98d3f7 100644 --- a/docs/14.0/getting-started/options/index.html +++ b/docs/14.0/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.0

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object +

Version: 14.0

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

More information about ts-jest options, see doc

important

Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -41,6 +41,6 @@

+
\ No newline at end of file diff --git a/docs/14.0/getting-started/presets/index.html b/docs/14.0/getting-started/presets/index.html index efdaec0f77..f79ff01493 100644 --- a/docs/14.0/getting-started/presets/index.html +++ b/docs/14.0/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.0

Presets

The presets

+
+
// jest.config.js
const { defaultTransformerOptions } = require('jest-preset-angular/presets');
// const { defaultTransformerOptions } = require('jest-preset-angular/presets')

module.exports = {
// [...]
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
'jest-preset-angular',
{
...defaultTransformerOptions,
// [...your overriden options]
},
],
},
};
\ No newline at end of file diff --git a/docs/14.0/getting-started/test-environment/index.html b/docs/14.0/getting-started/test-environment/index.html index ee7825d961..4b8b6b2b8a 100644 --- a/docs/14.0/getting-started/test-environment/index.html +++ b/docs/14.0/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.0

Test environment

If you look at setup-jest.js, +

Version: 14.0

Test environment

If you look at setup-jest.js, what we're doing here is we're adding globals required by Angular. With the included Angular zone patch we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

While setup-jest.js above is for running Jest with CommonJS mode, we also provide setup-jest.mjs @@ -27,6 +27,6 @@

// setup-test.ts
globalThis.ngJest = {
testEnvironmentOptions: {
teardown: {
destroyAfterEach: false,
rethrowErrors: true,
},
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};

import 'jest-preset-angular/setup-jest';

-

jest-preset-angular will look at globalThis.ngJest and pass the correct TestEnvironmentOptions object to TestBed.

+

jest-preset-angular will look at globalThis.ngJest and pass the correct TestEnvironmentOptions object to TestBed.

\ No newline at end of file diff --git a/docs/14.0/guides/absolute-imports/index.html b/docs/14.0/guides/absolute-imports/index.html index af88bf6883..88b783689f 100644 --- a/docs/14.0/guides/absolute-imports/index.html +++ b/docs/14.0/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 14.0

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

Version: 14.0

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

-

More information see ts-jest paths mapping configuration documentation

+

More information see ts-jest paths mapping configuration documentation

\ No newline at end of file diff --git a/docs/14.0/guides/angular-13+/index.html b/docs/14.0/guides/angular-13+/index.html index ea76004cd1..2807b39bc6 100644 --- a/docs/14.0/guides/angular-13+/index.html +++ b/docs/14.0/guides/angular-13+/index.html @@ -2,7 +2,7 @@ - + Angular >=13 | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.0

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular +

Version: 14.0

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset.

important

With Jest 28 and jest-preset-angular v12.0.0, ng-jest-resolver is no longer required to have in Jest config. This resolver is also excluded from our default and default ESM presets.

@@ -66,6 +66,6 @@

// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};

Usage with Ionic 6 or 7

To support Ionic 6 or 7 you will need to modify transformIgnorePatterns to be as following:

-
// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
};
+
// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
};
\ No newline at end of file diff --git a/docs/14.0/guides/angular-ivy/index.html b/docs/14.0/guides/angular-ivy/index.html index 803962d8d6..c97e5e6985 100644 --- a/docs/14.0/guides/angular-ivy/index.html +++ b/docs/14.0/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.0

Angular Ivy

important

This step is OPTIONAL

+
Version: 14.0

Angular Ivy

important

This step is OPTIONAL

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

@@ -29,6 +29,6 @@
// jest.config.js
module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};

Control ngcc processing

Since v12.0.0, jest-preset-angular provide a possibility to skip ngcc via globalThis by doing the following

-
// jest.config.js
globalThis.ngJest = {
skipNgcc: true,
tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
};

module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};
+
// jest.config.js
globalThis.ngJest = {
skipNgcc: true,
tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
};

module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};
\ No newline at end of file diff --git a/docs/14.0/guides/esm-support/index.html b/docs/14.0/guides/esm-support/index.html index 210ee86938..d2c4ac5f71 100644 --- a/docs/14.0/guides/esm-support/index.html +++ b/docs/14.0/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.0

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

+
Version: 14.0

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

There is also a preset to work with ESM.

tip

We have example apps which contains base ESM setup to work with Jest and Angular.

@@ -32,6 +32,6 @@

Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

-
// jest.config.js
module.exports = {
//...
preset: 'jest-preset-angular/presets/defaults-esm',
};
+
// jest.config.js
module.exports = {
//...
preset: 'jest-preset-angular/presets/defaults-esm',
};
\ No newline at end of file diff --git a/docs/14.0/guides/jsdom-version/index.html b/docs/14.0/guides/jsdom-version/index.html index 64ea5c5d6d..b98810f1a5 100644 --- a/docs/14.0/guides/jsdom-version/index.html +++ b/docs/14.0/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
Version: 14.0

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

+
Version: 14.0

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

// jest.config.js
module.exports = {
testEnvironment: 'jest-environment-jsdom-sixteen',
};

If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

-

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

+

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

\ No newline at end of file diff --git a/docs/14.0/guides/troubleshooting/index.html b/docs/14.0/guides/troubleshooting/index.html index 99479ee350..7434b02a95 100644 --- a/docs/14.0/guides/troubleshooting/index.html +++ b/docs/14.0/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.0

Troubleshooting

You can check Jest troubleshooting guide

+
Version: 14.0

Troubleshooting

You can check Jest troubleshooting guide

Common issues

Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

Can't resolve all parameters for SomeClass(?)

@@ -82,6 +82,6 @@

Resolution<
// jest.config.js
...
resolver: '<rootDir>/src/jest.resolver.js',
...

Inject dependencies with TypeScript interface or exported namespace

Please use Angular inject instead of @Inject. -This is because jest-preset-angular has caveat when working with class constructor and decorator.

+This is because jest-preset-angular has caveat when working with class constructor and decorator.

\ No newline at end of file diff --git a/docs/14.0/guides/using-with-babel/index.html b/docs/14.0/guides/using-with-babel/index.html index ad43e53341..10c56b4f48 100644 --- a/docs/14.0/guides/using-with-babel/index.html +++ b/docs/14.0/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.0

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

+
Version: 14.0

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

  1. Install dependencies required by the official Jest documentation for Babel integration.

    @@ -32,6 +32,6 @@
    1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
    -
    // jest.config.js
    module.exports = {
    //...
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };
+
// jest.config.js
module.exports = {
//...
transform: {
'^.+\\.(ts|html)$': 'jest-preset-angular',
'^.+\\.js$': 'babel-jest',
},
};
\ No newline at end of file diff --git a/docs/14.0/index.html b/docs/14.0/index.html index e5a6a3d133..05fc46b16a 100644 --- a/docs/14.0/index.html +++ b/docs/14.0/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
Version: 14.0

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

+
Version: 14.0

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

This is a part of the article: Testing Angular faster with Jest.

important

Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

+@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

\ No newline at end of file diff --git a/docs/14.0/processing/index.html b/docs/14.0/processing/index.html index bcaca90570..ffabe2db3a 100644 --- a/docs/14.0/processing/index.html +++ b/docs/14.0/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
+
\ No newline at end of file diff --git a/docs/14.2/getting-started/installation/index.html b/docs/14.2/getting-started/installation/index.html index b03eaeba53..2b0283d079 100644 --- a/docs/14.2/getting-started/installation/index.html +++ b/docs/14.2/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

Installation

Dependencies

+
Version: 14.2

Installation

Dependencies

You can install jest-preset-angular and dependencies all at once with one of the following commands.

npm install -D jest jest-preset-angular @types/jest

Configuration

@@ -45,6 +45,6 @@

Global mo
// Assuming that your global setup file is setup-jest.ts
import 'jest-preset-angular/setup-jest';
import './jest-global-mocks';
tip

An example for jest-global-mocks.ts

Object.defineProperty(document, 'doctype', {
value: '<!DOCTYPE html>',
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => {
return {
display: 'none',
appearance: ['-webkit-appearance'],
};
},
});
/**
* ISSUE: https://github.com/angular/material2/issues/7101
* Workaround for JSDOM missing transform property
*/
Object.defineProperty(document.body.style, 'transform', {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});

Avoid karma conflicts

-

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

+

By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

\ No newline at end of file diff --git a/docs/14.2/getting-started/options/index.html b/docs/14.2/getting-started/options/index.html index 20f6be418e..9c6e042d01 100644 --- a/docs/14.2/getting-started/options/index.html +++ b/docs/14.2/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object +

Version: 14.2

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

More information about ts-jest options, see doc

important

Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -38,6 +38,6 @@

+
\ No newline at end of file diff --git a/docs/14.2/getting-started/presets/index.html b/docs/14.2/getting-started/presets/index.html index 993b8c2b56..e48a80c1ae 100644 --- a/docs/14.2/getting-started/presets/index.html +++ b/docs/14.2/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

Presets

The presets

+
+
// jest.config.js
const { defaultTransformerOptions } = require('jest-preset-angular/presets');
// const { defaultTransformerOptions } = require('jest-preset-angular/presets')

module.exports = {
// [...]
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
'jest-preset-angular',
{
...defaultTransformerOptions,
// [...your overriden options]
},
],
},
};
\ No newline at end of file diff --git a/docs/14.2/getting-started/test-environment/index.html b/docs/14.2/getting-started/test-environment/index.html index fa4cf4fcfb..5cdbe29f65 100644 --- a/docs/14.2/getting-started/test-environment/index.html +++ b/docs/14.2/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

Test environment

If you look at setup-jest.js, +

Version: 14.2

Test environment

If you look at setup-jest.js, what we're doing here is we're adding globals required by Angular. With the included Angular zone patch we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

While setup-jest.js above is for running Jest with CommonJS mode, we also provide setup-jest.mjs @@ -27,6 +27,6 @@

// setup-test.ts
globalThis.ngJest = {
testEnvironmentOptions: {
teardown: {
destroyAfterEach: false,
rethrowErrors: true,
},
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};

import 'jest-preset-angular/setup-jest';

-

jest-preset-angular will look at globalThis.ngJest and pass the correct TestEnvironmentOptions object to TestBed.

+

jest-preset-angular will look at globalThis.ngJest and pass the correct TestEnvironmentOptions object to TestBed.

\ No newline at end of file diff --git a/docs/14.2/guides/absolute-imports/index.html b/docs/14.2/guides/absolute-imports/index.html index cd85f4357a..35c092f0c2 100644 --- a/docs/14.2/guides/absolute-imports/index.html +++ b/docs/14.2/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
Version: 14.2

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

Version: 14.2

Absolute Imports

If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

-

More information see ts-jest paths mapping configuration documentation

+

More information see ts-jest paths mapping configuration documentation

\ No newline at end of file diff --git a/docs/14.2/guides/angular-13+/index.html b/docs/14.2/guides/angular-13+/index.html index e3df26f213..6409e2c04a 100644 --- a/docs/14.2/guides/angular-13+/index.html +++ b/docs/14.2/guides/angular-13+/index.html @@ -2,7 +2,7 @@ - + Angular >=13 | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular +

Version: 14.2

Angular >=13

Angular 13 introduces ESM package format for Angular packages. jest-preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset.

important

With Jest 28 and jest-preset-angular v12.0.0, ng-jest-resolver is no longer required to have in Jest config. This resolver is also excluded from our default and default ESM presets.

@@ -66,6 +66,6 @@

// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};

Usage with Ionic 6 or 7

To support Ionic 6 or 7 you will need to modify transformIgnorePatterns to be as following:

-
// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
};
+
// jest.config.js
module.exports = {
// ...other options
transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
};
\ No newline at end of file diff --git a/docs/14.2/guides/angular-ivy/index.html b/docs/14.2/guides/angular-ivy/index.html index d36fac3d3c..efeb5826b9 100644 --- a/docs/14.2/guides/angular-ivy/index.html +++ b/docs/14.2/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

Angular Ivy

important

This step is OPTIONAL

+
Version: 14.2

Angular Ivy

important

This step is OPTIONAL

Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

@@ -29,6 +29,6 @@
// jest.config.js
module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};

Control ngcc processing

Since v12.0.0, jest-preset-angular provide a possibility to skip ngcc via globalThis by doing the following

-
// jest.config.js
globalThis.ngJest = {
skipNgcc: true,
tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
};

module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};
+
// jest.config.js
globalThis.ngJest = {
skipNgcc: true,
tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
};

module.exports = {
//...
globalSetup: 'jest-preset-angular/global-setup',
};
\ No newline at end of file diff --git a/docs/14.2/guides/esm-support/index.html b/docs/14.2/guides/esm-support/index.html index 57defbc729..30170554a0 100644 --- a/docs/14.2/guides/esm-support/index.html +++ b/docs/14.2/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

+
Version: 14.2

ESM Support

To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

There is also a preset to work with ESM.

tip

We have example apps which contains base ESM setup to work with Jest and Angular.

@@ -32,6 +32,6 @@

Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

-
// jest.config.js
module.exports = {
//...
preset: 'jest-preset-angular/presets/defaults-esm',
};
+
// jest.config.js
module.exports = {
//...
preset: 'jest-preset-angular/presets/defaults-esm',
};
\ No newline at end of file diff --git a/docs/14.2/guides/jsdom-version/index.html b/docs/14.2/guides/jsdom-version/index.html index adf9c93e7e..9323f88930 100644 --- a/docs/14.2/guides/jsdom-version/index.html +++ b/docs/14.2/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
Version: 14.2

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

+
Version: 14.2

Configure other JSDOM versions

Jest v26+ by default uses JSDOM 16 to support Node 10+.

If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

// jest.config.js
module.exports = {
testEnvironment: 'jest-environment-jsdom-sixteen',
};

If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

-

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

+

Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

\ No newline at end of file diff --git a/docs/14.2/guides/snapshot-testing/index.html b/docs/14.2/guides/snapshot-testing/index.html index fa2e6e267c..ad3ab839cb 100644 --- a/docs/14.2/guides/snapshot-testing/index.html +++ b/docs/14.2/guides/snapshot-testing/index.html @@ -2,7 +2,7 @@ - + Snapshot testing | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

Snapshot testing

jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.

+
Version: 14.2

Snapshot testing

jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.

info

BY DEFAULT, the preset provides all of the snapshot serializers below.

Snapshot serializers

@@ -65,6 +65,6 @@

In Je

Or in setup test environment file

jest.config.js
/** @type {import('jest').Config} */
module.exports = {
//[...]
setupFilesAfterEnv: ['./setup-jest.js'],
//[...]
};
setup-jest.js
const removeNgAttributes = require('jest-preset-angular/build/serializers/no-ng-attributes');

expect.addSnapshotSerializer(removeNgAttributes);

Or in individual test files

-
foo.component.spec.js
const removeNgAttributes = require('jest-preset-angular/build/serializers/no-ng-attributes');

expect.addSnapshotSerializer(removeNgAttributes);

it('should work', () => {
//[...]
});
+
foo.component.spec.js
const removeNgAttributes = require('jest-preset-angular/build/serializers/no-ng-attributes');

expect.addSnapshotSerializer(removeNgAttributes);

it('should work', () => {
//[...]
});
\ No newline at end of file diff --git a/docs/14.2/guides/troubleshooting/index.html b/docs/14.2/guides/troubleshooting/index.html index ba75c04444..74aa7fbf61 100644 --- a/docs/14.2/guides/troubleshooting/index.html +++ b/docs/14.2/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

Troubleshooting

You can check Jest troubleshooting guide

+
Version: 14.2

Troubleshooting

You can check Jest troubleshooting guide

Common issues

Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

Can't resolve all parameters for SomeClass(?)

@@ -82,6 +82,6 @@

Resolution<
// jest.config.js
module.exports = {
resolver: '<rootDir>/src/jest.resolver.js',
};

Inject dependencies with TypeScript interface or exported namespace

Please use Angular inject instead of @Inject. -This is because jest-preset-angular has caveat when working with class constructor and decorator.

+This is because jest-preset-angular has caveat when working with class constructor and decorator.

\ No newline at end of file diff --git a/docs/14.2/guides/using-with-babel/index.html b/docs/14.2/guides/using-with-babel/index.html index 574263c3ac..c4383e1fc1 100644 --- a/docs/14.2/guides/using-with-babel/index.html +++ b/docs/14.2/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.2

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

+
Version: 14.2

Using with Babel

If you wish to use Babel, you need to say jest to transpile such files manually.

  1. Install dependencies required by the official Jest documentation for Babel integration.

    @@ -32,6 +32,6 @@
    1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
    -
    // jest.config.js
    module.exports = {
    //...
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };
+
// jest.config.js
module.exports = {
//...
transform: {
'^.+\\.(ts|html)$': 'jest-preset-angular',
'^.+\\.js$': 'babel-jest',
},
};
\ No newline at end of file diff --git a/docs/14.2/index.html b/docs/14.2/index.html index 7a8fc32c46..a57412509c 100644 --- a/docs/14.2/index.html +++ b/docs/14.2/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
Version: 14.2

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

+
Version: 14.2

Introduction

jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

This is a part of the article: Testing Angular faster with Jest.

important

Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

+@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

\ No newline at end of file diff --git a/docs/14.2/processing/index.html b/docs/14.2/processing/index.html index 967e6bedae..c0b54d785f 100644 --- a/docs/14.2/processing/index.html +++ b/docs/14.2/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
+
\ No newline at end of file diff --git a/docs/14.3/getting-started/installation/index.html b/docs/14.3/getting-started/installation/index.html index beaccd3968..3cfb5fdf27 100644 --- a/docs/14.3/getting-started/installation/index.html +++ b/docs/14.3/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.3

Installation

Dependencies

+
Version: 14.3

Installation

Dependencies

You can install jest-preset-angular and dependencies all at once with one of the following commands.

npm install -D jest jest-preset-angular @types/jest

Configuration

diff --git a/docs/14.3/getting-started/options/index.html b/docs/14.3/getting-started/options/index.html index 8599079e9b..fcc641e4ca 100644 --- a/docs/14.3/getting-started/options/index.html +++ b/docs/14.3/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.3

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object +

Version: 14.3

Options

jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

More information about ts-jest options, see doc

important

Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -41,6 +41,6 @@

+
\ No newline at end of file diff --git a/docs/14.3/getting-started/presets/index.html b/docs/14.3/getting-started/presets/index.html index c470c04c83..d0b212c18a 100644 --- a/docs/14.3/getting-started/presets/index.html +++ b/docs/14.3/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.3

Presets

The presets

+
+
jest.config.ts
import type { Config } from 'jest';
import presets from 'jest-preset-angular/presets';

const jestConfig: Config = {
// [...]
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
'jest-preset-angular',
{
...presets.defaultTransformerOptions,
// [...your overriden options]
},
],
},
};

export default jestConfig;
\ No newline at end of file diff --git a/docs/14.3/getting-started/test-environment/index.html b/docs/14.3/getting-started/test-environment/index.html index 04db8afa0b..056a6b5170 100644 --- a/docs/14.3/getting-started/test-environment/index.html +++ b/docs/14.3/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
Version: 14.3

Test environment

In Jest, a test environment defines the sandbox context in which your tests run. +

Version: 14.3

Test environment

In Jest, a test environment defines the sandbox context in which your tests run. For Angular projects, setting up the correct test environment is essential to ensure compatibility with the framework-specific features, such as dependency injection and change detection.

jest-preset-angular provides utility functions to simplify setting up a Jest test environment tailored for Angular projects. @@ -60,6 +60,6 @@

Example:
  • Update your Jest configuration:
  • -
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
    };

    export default jestConfig;

    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/14.3/guides/absolute-imports/index.html b/docs/14.3/guides/absolute-imports/index.html index b4c1e0e7fa..244735cd5d 100644 --- a/docs/14.3/guides/absolute-imports/index.html +++ b/docs/14.3/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
    Version: 14.3

    Absolute Imports

    If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

    Version: 14.3

    Absolute Imports

    If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

    -

    More information see ts-jest paths mapping configuration documentation

    +

    More information see ts-jest paths mapping configuration documentation

    \ No newline at end of file diff --git a/docs/14.3/guides/angular-13+/index.html b/docs/14.3/guides/angular-13+/index.html index 9fc191a564..d45fa8cd8d 100644 --- a/docs/14.3/guides/angular-13+/index.html +++ b/docs/14.3/guides/angular-13+/index.html @@ -2,7 +2,7 @@ - + Angular >=13 | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.3

    Angular >=13

    Angular 13 introduces ESM package format for Angular packages. jest-preset-angular +

    Version: 14.3

    Angular >=13

    Angular 13 introduces ESM package format for Angular packages. jest-preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset.

    important

    With Jest 28 and jest-preset-angular v12.0.0, ng-jest-resolver is no longer required to have in Jest config. This resolver is also excluded from our default and default ESM presets.

    @@ -63,6 +63,6 @@

    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    // ...other options
    transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
    };

    export default jestConfig;

    Usage with Ionic 6 or 7

    To support Ionic 6 or 7 you will need to modify transformIgnorePatterns to be as following:

    -
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    // ...other options
    transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
    };

    export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    // ...other options
    transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/14.3/guides/angular-ivy/index.html b/docs/14.3/guides/angular-ivy/index.html index 64a3056ebc..171c692291 100644 --- a/docs/14.3/guides/angular-ivy/index.html +++ b/docs/14.3/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.3

    Angular Ivy

    important

    This step is OPTIONAL

    +
    Version: 14.3

    Angular Ivy

    important

    This step is OPTIONAL

    Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

    @@ -29,6 +29,6 @@
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    //...
    globalSetup: 'jest-preset-angular/global-setup',
    };

    export default jestConfig;

    Control ngcc processing

    Since v12.0.0, jest-preset-angular provide a possibility to skip ngcc via globalThis by doing the following

    -
    jest.config.ts
    import type { Config } from 'jest';

    globalThis.ngJest = {
    skipNgcc: true,
    tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
    };

    const jestConfig: Config = {
    //...
    globalSetup: 'jest-preset-angular/global-setup',
    };

    export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    globalThis.ngJest = {
    skipNgcc: true,
    tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
    };

    const jestConfig: Config = {
    //...
    globalSetup: 'jest-preset-angular/global-setup',
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/14.3/guides/esm-support/index.html b/docs/14.3/guides/esm-support/index.html index ef82d071c2..b7ea3b8741 100644 --- a/docs/14.3/guides/esm-support/index.html +++ b/docs/14.3/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.3

    ESM Support

    To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

    +
    Version: 14.3

    ESM Support

    To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

    jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

    There is also a preset to work with ESM.

    tip

    We have example apps which contains base ESM setup to work with Jest and Angular.

    @@ -32,6 +32,6 @@

    Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

    To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

    -
    jest.config.mts
    import type { Config } from 'jest';

    const jestConfig = {
    //...
    preset: 'jest-preset-angular/presets/defaults-esm',
    };

    export default jestConfig;
    +
    jest.config.mts
    import type { Config } from 'jest';

    const jestConfig = {
    //...
    preset: 'jest-preset-angular/presets/defaults-esm',
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/14.3/guides/jsdom-version/index.html b/docs/14.3/guides/jsdom-version/index.html index c4cc520807..bccc1a477b 100644 --- a/docs/14.3/guides/jsdom-version/index.html +++ b/docs/14.3/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
    Version: 14.3

    Configure other JSDOM versions

    Jest v26+ by default uses JSDOM 16 to support Node 10+.

    +
    Version: 14.3

    Configure other JSDOM versions

    Jest v26+ by default uses JSDOM 16 to support Node 10+.

    If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    testEnvironment: 'jest-environment-jsdom-sixteen',
    };

    export default jestConfig;

    If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

    -

    Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

    +

    Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

    \ No newline at end of file diff --git a/docs/14.3/guides/snapshot-testing/index.html b/docs/14.3/guides/snapshot-testing/index.html index bee36368d6..90e3c8ecdb 100644 --- a/docs/14.3/guides/snapshot-testing/index.html +++ b/docs/14.3/guides/snapshot-testing/index.html @@ -2,7 +2,7 @@ - + Snapshot testing | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.3

    Snapshot testing

    jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.

    +
    Version: 14.3

    Snapshot testing

    jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.

    info

    BY DEFAULT, the preset provides all of the snapshot serializers below.

    Snapshot serializers

    @@ -92,6 +92,6 @@

    Examples:
  • Or in individual test files
  • -
    foo.component.spec.ts
    import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';

    expect.addSnapshotSerializer(removeNgAttributes);

    it('should work', () => {
    //[...]
    });

    +
    foo.component.spec.ts
    import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';

    expect.addSnapshotSerializer(removeNgAttributes);

    it('should work', () => {
    //[...]
    });
    \ No newline at end of file diff --git a/docs/14.3/guides/troubleshooting/index.html b/docs/14.3/guides/troubleshooting/index.html index 99566b4691..840ca90b41 100644 --- a/docs/14.3/guides/troubleshooting/index.html +++ b/docs/14.3/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.3

    Troubleshooting

    You can check Jest troubleshooting guide

    +
    Version: 14.3

    Troubleshooting

    You can check Jest troubleshooting guide

    Common issues

    Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

    Can't resolve all parameters for SomeClass(?)

    @@ -82,6 +82,6 @@

    Resolution<
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    //...
    resolver: '<rootDir>/src/jest.resolver.ts',
    //...
    };

    export default jestConfig;

    Inject dependencies with TypeScript interface or exported namespace

    Please use Angular inject instead of @Inject. -This is because jest-preset-angular has caveat when working with class constructor and decorator.

    +This is because jest-preset-angular has caveat when working with class constructor and decorator.

    \ No newline at end of file diff --git a/docs/14.3/guides/using-with-babel/index.html b/docs/14.3/guides/using-with-babel/index.html index be3c3e9b61..f3201f93e6 100644 --- a/docs/14.3/guides/using-with-babel/index.html +++ b/docs/14.3/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.3

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    +
    Version: 14.3

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    1. Install dependencies required by the official Jest documentation for Babel integration.

      @@ -32,6 +32,6 @@
      1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
      -
      jest.config.ts
      import type { Config } from 'jest';

      const jestConfig: Config = {
      //...
      transform: {
      '^.+\\.(ts|html)$': 'jest-preset-angular',
      '^.+\\.js$': 'babel-jest',
      },
      };

      export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    //...
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/14.3/index.html b/docs/14.3/index.html index 0f0f54086b..47ddeda5aa 100644 --- a/docs/14.3/index.html +++ b/docs/14.3/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
    Version: 14.3

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    +
    Version: 14.3

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    This is a part of the article: Testing Angular faster with Jest.

    important

    Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

    +@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

    \ No newline at end of file diff --git a/docs/14.3/processing/index.html b/docs/14.3/processing/index.html index ad31a046fa..cb46bdfc25 100644 --- a/docs/14.3/processing/index.html +++ b/docs/14.3/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
    +
    \ No newline at end of file diff --git a/docs/8.x/getting-started/installation/index.html b/docs/8.x/getting-started/installation/index.html index 16a04892b4..e15ebd4368 100644 --- a/docs/8.x/getting-started/installation/index.html +++ b/docs/8.x/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 8.x

    Installation

    Dependencies

    +
    Version: 8.x

    Installation

    Dependencies

    You can install jest-preset-angular and dependencies all at once with one of the following commands.

    npm install -D jest jest-preset-angular @types/jest

    Configuration

    @@ -45,6 +45,6 @@

    Global mo
    // Assuming that your global setup file is setup-jest.ts
    import 'jest-preset-angular/setup-jest';
    import './jest-global-mocks';
    tip

    An example for jest-global-mocks.ts

    Object.defineProperty(document, 'doctype', {
    value: '<!DOCTYPE html>',
    });
    Object.defineProperty(window, 'getComputedStyle', {
    value: () => {
    return {
    display: 'none',
    appearance: ['-webkit-appearance'],
    };
    },
    });
    /**
    * ISSUE: https://github.com/angular/material2/issues/7101
    * Workaround for JSDOM missing transform property
    */
    Object.defineProperty(document.body.style, 'transform', {
    value: () => {
    return {
    enumerable: true,
    configurable: true,
    };
    },
    });

    Avoid karma conflicts

    -

    By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

    +

    By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

    \ No newline at end of file diff --git a/docs/8.x/getting-started/options/index.html b/docs/8.x/getting-started/options/index.html index 7dc011da9b..cbb823f9f2 100644 --- a/docs/8.x/getting-started/options/index.html +++ b/docs/8.x/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 8.x

    Options

    jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object +

    Version: 8.x

    Options

    jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

    More information about ts-jest options, see doc

    Exposed configuration

    @@ -39,6 +39,6 @@

    +
    \ No newline at end of file diff --git a/docs/8.x/getting-started/presets/index.html b/docs/8.x/getting-started/presets/index.html index a9ec72987b..6da6dec87b 100644 --- a/docs/8.x/getting-started/presets/index.html +++ b/docs/8.x/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 8.x

    Presets

    The presets

    +
    Version: 8.x

    Presets

    The presets

    jest-preset-angular comes with a preset, covering most of the project's base configuration:

    Preset nameDescription
    jest-preset-angularTypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by ts-jest to CommonJS syntax.

    Basic usage

    @@ -32,6 +32,6 @@

    Advanced
    important

    If you choose to override globals in order to point at a specific tsconfig, you will need to make sure that original ts-jest options provided through the default preset are defined to the globals.ts-jest section too, otherwise you will get errors.

    -
    // jest.config.js
    const { defaults: jestNgPreset } = require('jest-preset-angular');

    module.exports = {
    // [...]
    globals: {
    'ts-jest': {
    ...jestNgPreset.globals['ts-jest'],
    // [...your overriden options]
    },
    },
    };
    +
    // jest.config.js
    const { defaults: jestNgPreset } = require('jest-preset-angular');

    module.exports = {
    // [...]
    globals: {
    'ts-jest': {
    ...jestNgPreset.globals['ts-jest'],
    // [...your overriden options]
    },
    },
    };
    \ No newline at end of file diff --git a/docs/8.x/getting-started/test-environment/index.html b/docs/8.x/getting-started/test-environment/index.html index 304c0f2881..1d52fc38cf 100644 --- a/docs/8.x/getting-started/test-environment/index.html +++ b/docs/8.x/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
    Version: 8.x

    Test environment

    If you look at setup-jest.ts, +

    Version: 8.x

    Test environment

    If you look at setup-jest.ts, what we're doing here is we're adding globals required by Angular. With the included jest-zone-patch -we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

    +we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

    \ No newline at end of file diff --git a/docs/8.x/guides/absolute-imports/index.html b/docs/8.x/guides/absolute-imports/index.html index 8a608a22d8..987d0c5ef2 100644 --- a/docs/8.x/guides/absolute-imports/index.html +++ b/docs/8.x/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,18 +13,18 @@ - - - + + + -
    Version: 8.x

    Absolute Imports

    TypeScript supports absolute imports. The preset (starting from v3.0.0) by default understands absolute imports referring to src, app, assets and environments directory, so instead:

    +
    Version: 8.x

    Absolute Imports

    TypeScript supports absolute imports. The preset (starting from v3.0.0) by default understands absolute imports referring to src, app, assets and environments directory, so instead:

    import MyComponent from '../../src/app/my.component';
    import MyStuff from '../../src/testing/my.stuff';

    you can use:

    import MyComponent from 'app/my.component';
    import MyStuff from 'src/testing/my.stuff';

    However, if your directory structure differ from that provided by angular-cli you can adjust moduleNameMapper in Jest config:

    {
    jest: {
    moduleNameMapper: {
    'app/(.*)': '<rootDir>/src/to/app/$1', // override default, why not
    'testing/(.*)': '<rootDir>/app/testing/$1', // add new mapping
    },
    },
    }
    important

    If you wish to use any absolute import paths which are defined in paths of your tsconfig, make sure that you create the -similar mapping for moduleNameMapper in Jest config

    +similar mapping for moduleNameMapper in Jest config

    \ No newline at end of file diff --git a/docs/8.x/guides/angular-ivy/index.html b/docs/8.x/guides/angular-ivy/index.html index a9c8c182bb..954b99d319 100644 --- a/docs/8.x/guides/angular-ivy/index.html +++ b/docs/8.x/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
    Version: 8.x

    Angular Ivy

    Currently, jest-preset-angular is partially compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, +

    Version: 8.x

    Angular Ivy

    Currently, jest-preset-angular is partially compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

    jest-preset-angular also provides util script to help you to run ngcc with Jest but this script only works via the JavaScript version of Jest config

    -
    // jest.config.js
    require('jest-preset-angular/ngcc-jest-processor');

    module.exports = {
    // [...]
    };
    +
    // jest.config.js
    require('jest-preset-angular/ngcc-jest-processor');

    module.exports = {
    // [...]
    };
    \ No newline at end of file diff --git a/docs/8.x/guides/esm-support/index.html b/docs/8.x/guides/esm-support/index.html index 8720ffc947..b2c15e3eda 100644 --- a/docs/8.x/guides/esm-support/index.html +++ b/docs/8.x/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
    Version: 8.x

    ESM Support

    important

    ESM support is only available in v9.0.0++

    +
    Version: 8.x

    ESM Support

    important

    ESM support is only available in v9.0.0++

    \ No newline at end of file diff --git a/docs/8.x/guides/jsdom-version/index.html b/docs/8.x/guides/jsdom-version/index.html index 4ef52c65f0..409f9eb9d1 100644 --- a/docs/8.x/guides/jsdom-version/index.html +++ b/docs/8.x/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
    Version: 8.x

    Configure other JSDOM versions

    Jest v26+ by default uses JSDOM 16 to support Node 10+.

    +
    Version: 8.x

    Configure other JSDOM versions

    Jest v26+ by default uses JSDOM 16 to support Node 10+.

    If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

    // jest.config.js
    module.exports = {
    testEnvironment: 'jest-environment-jsdom-sixteen',
    };

    If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

    -

    Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

    +

    Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

    \ No newline at end of file diff --git a/docs/8.x/guides/troubleshooting/index.html b/docs/8.x/guides/troubleshooting/index.html index 613bf4174e..d7e8d57fc8 100644 --- a/docs/8.x/guides/troubleshooting/index.html +++ b/docs/8.x/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 8.x

    Troubleshooting

    You can check Jest troubleshooting guide

    +
    Version: 8.x

    Troubleshooting

    You can check Jest troubleshooting guide

    Common issues

    Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

    Can't resolve all parameters for SomeClass(?)

    @@ -79,6 +79,6 @@

    Resolution<

    In these cases, a transformIgnorePatterns whitelisting could not fix the issue. The solution here is to use a custom resolver. You may or may not need to remove entries from transformIgnorePatterns whitelisting.

    Here is an example of a resolver which would fix firebase related packages.

    // jest.resolver.js
    module.exports = (path, options) => {
    // Call the defaultResolver, so we leverage its cache, error handling, etc.
    return options.defaultResolver(path, {
    ...options,
    // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
    packageFilter: (pkg) => {
    const pkgNamesToTarget = new Set([
    'rxjs',
    '@firebase/auth',
    '@firebase/storage',
    '@firebase/functions',
    '@firebase/database',
    '@firebase/auth-compat',
    '@firebase/database-compat',
    '@firebase/app-compat',
    '@firebase/firestore',
    '@firebase/firestore-compat',
    '@firebase/messaging',
    '@firebase/util',
    'firebase',
    ]);

    if (pkgNamesToTarget.has(pkg.name)) {
    // console.log('>>>', pkg.name)
    delete pkg['exports'];
    delete pkg['module'];
    }

    return pkg;
    },
    });
    };
    -
    // jest.config.js
    ...
    resolver: '<rootDir>/src/jest.resolver.js',
    ...

    +
    // jest.config.js
    ...
    resolver: '<rootDir>/src/jest.resolver.js',
    ...
    \ No newline at end of file diff --git a/docs/8.x/guides/using-with-babel/index.html b/docs/8.x/guides/using-with-babel/index.html index 8bac777604..21215b4d43 100644 --- a/docs/8.x/guides/using-with-babel/index.html +++ b/docs/8.x/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 8.x

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    +
    Version: 8.x

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    1. Install dependencies required by the official Jest documentation for Babel integration.

      @@ -32,6 +32,6 @@
      1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
      -
      module.exports = {
      transform: {
      '^.+\\.(ts|html)$': 'ts-jest',
      '^.+\\.js$': 'babel-jest',
      },
      };
    +
    module.exports = {
    transform: {
    '^.+\\.(ts|html)$': 'ts-jest',
    '^.+\\.js$': 'babel-jest',
    },
    };
    \ No newline at end of file diff --git a/docs/8.x/index.html b/docs/8.x/index.html index e62fe66ce0..c77c363dbe 100644 --- a/docs/8.x/index.html +++ b/docs/8.x/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 8.x

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    -

    This is a part of the article: Testing Angular faster with Jest.

    +
    Version: 8.x

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    +

    This is a part of the article: Testing Angular faster with Jest.

    \ No newline at end of file diff --git a/docs/8.x/processing/index.html b/docs/8.x/processing/index.html index 2a71910b32..ec3ff40347 100644 --- a/docs/8.x/processing/index.html +++ b/docs/8.x/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
    +
    \ No newline at end of file diff --git a/docs/9.x/getting-started/installation/index.html b/docs/9.x/getting-started/installation/index.html index 1428d79624..ef17d7f784 100644 --- a/docs/9.x/getting-started/installation/index.html +++ b/docs/9.x/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 9.x

    Installation

    Dependencies

    +
    Version: 9.x

    Installation

    Dependencies

    You can install jest-preset-angular and dependencies all at once with one of the following commands.

    npm install -D jest jest-preset-angular @types/jest

    Configuration

    @@ -45,6 +45,6 @@

    Global mo
    // Assuming that your global setup file is setup-jest.ts
    import 'jest-preset-angular/setup-jest';
    import './jest-global-mocks';
    tip

    An example for jest-global-mocks.ts

    Object.defineProperty(document, 'doctype', {
    value: '<!DOCTYPE html>',
    });
    Object.defineProperty(window, 'getComputedStyle', {
    value: () => {
    return {
    display: 'none',
    appearance: ['-webkit-appearance'],
    };
    },
    });
    /**
    * ISSUE: https://github.com/angular/material2/issues/7101
    * Workaround for JSDOM missing transform property
    */
    Object.defineProperty(document.body.style, 'transform', {
    value: () => {
    return {
    enumerable: true,
    configurable: true,
    };
    },
    });

    Avoid karma conflicts

    -

    By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

    +

    By Angular CLI defaults you'll have a src/test.ts file which will be picked up by jest. To circumvent this you can either rename it to src/karmaTest.ts or hide it from jest by adding <rootDir>/src/test.ts to jest testPathIgnorePatterns option.

    \ No newline at end of file diff --git a/docs/9.x/getting-started/options/index.html b/docs/9.x/getting-started/options/index.html index ae3e162910..6790594d71 100644 --- a/docs/9.x/getting-started/options/index.html +++ b/docs/9.x/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 9.x

    Options

    jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object +

    Version: 9.x

    Options

    jest-preset-angular uses ts-jest options under the hood, which are located under the globals of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

    More information about ts-jest options, see doc

    important

    Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -38,6 +38,6 @@

    +
    \ No newline at end of file diff --git a/docs/9.x/getting-started/presets/index.html b/docs/9.x/getting-started/presets/index.html index 9d31a8f5de..bce1cc67b5 100644 --- a/docs/9.x/getting-started/presets/index.html +++ b/docs/9.x/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 9.x

    Presets

    The presets

    +
    Version: 9.x

    Presets

    The presets

    jest-preset-angular comes with 2 presets, covering most of the project's base configuration:

    Preset nameDescription
    jest-preset-angular/presets/default
    or jest-preset-angular
    TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to CommonJS syntax.
    jest-preset-angular/presets/defaults-esm
    TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to ESM syntax.

    Basic usage

    @@ -34,6 +34,6 @@

    Advanced

    // jest.config.js
    const { defaults: jestNgPreset } = require('jest-preset-angular/presets');
    // const { defaultsESM: jestNgPreset } = require('jest-preset-angular/presets')

    module.exports = {
    // [...]
    globals: {
    'ts-jest': {
    ...jestNgPreset.globals['ts-jest'],
    // [...your overriden options]
    },
    },
    };

    Or through TypeScript (if ts-node is installed):

    -
    // jest.config.ts
    import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
    import { defaults as jestNgPreset } from 'jest-preset-angular/presets';
    // import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'

    const config: InitialOptionsTsJest = {
    // [...]
    globals: {
    'ts-jest': {
    ...jestNgPreset.globals['ts-jest'],
    // [...your overriden options]
    },
    },
    };

    export default config;
    +
    // jest.config.ts
    import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
    import { defaults as jestNgPreset } from 'jest-preset-angular/presets';
    // import { defaultsESM as jestNgPreset } from 'jest-preset-angular/presets'

    const config: InitialOptionsTsJest = {
    // [...]
    globals: {
    'ts-jest': {
    ...jestNgPreset.globals['ts-jest'],
    // [...your overriden options]
    },
    },
    };

    export default config;
    \ No newline at end of file diff --git a/docs/9.x/getting-started/test-environment/index.html b/docs/9.x/getting-started/test-environment/index.html index 562270841b..e9a2b09898 100644 --- a/docs/9.x/getting-started/test-environment/index.html +++ b/docs/9.x/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
    Version: 9.x

    Test environment

    If you look at setup-jest.ts, +

    Version: 9.x

    Test environment

    If you look at setup-jest.ts, what we're doing here is we're adding globals required by Angular. With the included jest-zone-patch -we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

    +we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal.

    \ No newline at end of file diff --git a/docs/9.x/guides/absolute-imports/index.html b/docs/9.x/guides/absolute-imports/index.html index 05f5348141..dfa61cfc1e 100644 --- a/docs/9.x/guides/absolute-imports/index.html +++ b/docs/9.x/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
    Version: 9.x

    Absolute Imports

    If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

    Version: 9.x

    Absolute Imports

    If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

    -

    More information see ts-jest paths mapping configuration documentation

    +

    More information see ts-jest paths mapping configuration documentation

    \ No newline at end of file diff --git a/docs/9.x/guides/angular-ivy/index.html b/docs/9.x/guides/angular-ivy/index.html index febe141cf6..8de1cb5470 100644 --- a/docs/9.x/guides/angular-ivy/index.html +++ b/docs/9.x/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
    Version: 9.x

    Angular Ivy

    Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the +

    Version: 9.x

    Angular Ivy

    Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

    jest-preset-angular also provides util script to help you to run ngcc with Jest but this script only works via the JavaScript version of Jest config

    -
    // jest.config.js
    require('jest-preset-angular/ngcc-jest-processor');

    module.exports = {
    // [...]
    };
    +
    // jest.config.js
    require('jest-preset-angular/ngcc-jest-processor');

    module.exports = {
    // [...]
    };
    \ No newline at end of file diff --git a/docs/9.x/guides/esm-support/index.html b/docs/9.x/guides/esm-support/index.html index 59b5285b12..4c21ca0495 100644 --- a/docs/9.x/guides/esm-support/index.html +++ b/docs/9.x/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 9.x

    ESM Support

    To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

    +
    Version: 9.x

    ESM Support

    To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

    jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

    There is also a preset to work with ESM.

    Examples

    @@ -29,6 +29,6 @@

    Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

    To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

    -
    // jest.config.js
    module.exports = {
    // [...]
    preset: 'jest-preset-angular/presets/defaults-esm',
    };
    +
    // jest.config.js
    module.exports = {
    // [...]
    preset: 'jest-preset-angular/presets/defaults-esm',
    };
    \ No newline at end of file diff --git a/docs/9.x/guides/jsdom-version/index.html b/docs/9.x/guides/jsdom-version/index.html index df9976ec00..0e606da029 100644 --- a/docs/9.x/guides/jsdom-version/index.html +++ b/docs/9.x/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
    Version: 9.x

    Configure other JSDOM versions

    Jest v26+ by default uses JSDOM 16 to support Node 10+.

    +
    Version: 9.x

    Configure other JSDOM versions

    Jest v26+ by default uses JSDOM 16 to support Node 10+.

    If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

    // jest.config.js
    module.exports = {
    testEnvironment: 'jest-environment-jsdom-sixteen',
    };

    If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

    -

    Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

    +

    Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

    \ No newline at end of file diff --git a/docs/9.x/guides/troubleshooting/index.html b/docs/9.x/guides/troubleshooting/index.html index 7bede805f1..b5241776be 100644 --- a/docs/9.x/guides/troubleshooting/index.html +++ b/docs/9.x/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 9.x

    Troubleshooting

    You can check Jest troubleshooting guide

    +
    Version: 9.x

    Troubleshooting

    You can check Jest troubleshooting guide

    Common issues

    Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

    Can't resolve all parameters for SomeClass(?)

    @@ -79,6 +79,6 @@

    Resolution<

    In these cases, a transformIgnorePatterns whitelisting could not fix the issue. The solution here is to use a custom resolver. You may or may not need to remove entries from transformIgnorePatterns whitelisting.

    Here is an example of a resolver which would fix firebase related packages.

    // jest.resolver.js
    module.exports = (path, options) => {
    // Call the defaultResolver, so we leverage its cache, error handling, etc.
    return options.defaultResolver(path, {
    ...options,
    // Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
    packageFilter: (pkg) => {
    const pkgNamesToTarget = new Set([
    'rxjs',
    '@firebase/auth',
    '@firebase/storage',
    '@firebase/functions',
    '@firebase/database',
    '@firebase/auth-compat',
    '@firebase/database-compat',
    '@firebase/app-compat',
    '@firebase/firestore',
    '@firebase/firestore-compat',
    '@firebase/messaging',
    '@firebase/util',
    'firebase',
    ]);

    if (pkgNamesToTarget.has(pkg.name)) {
    // console.log('>>>', pkg.name)
    delete pkg['exports'];
    delete pkg['module'];
    }

    return pkg;
    },
    });
    };
    -
    // jest.config.js
    ...
    resolver: '<rootDir>/src/jest.resolver.js',
    ...

    +
    // jest.config.js
    ...
    resolver: '<rootDir>/src/jest.resolver.js',
    ...
    \ No newline at end of file diff --git a/docs/9.x/guides/using-with-babel/index.html b/docs/9.x/guides/using-with-babel/index.html index 4ba8bc0911..b2a4fcaa00 100644 --- a/docs/9.x/guides/using-with-babel/index.html +++ b/docs/9.x/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 9.x

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    +
    Version: 9.x

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    1. Install dependencies required by the official Jest documentation for Babel integration.

      @@ -32,6 +32,6 @@
      1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
      -
      module.exports = {
      transform: {
      '^.+\\.(ts|html)$': 'jest-preset-angular',
      '^.+\\.js$': 'babel-jest',
      },
      };
    +
    module.exports = {
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };
    \ No newline at end of file diff --git a/docs/9.x/index.html b/docs/9.x/index.html index 474232b9aa..3d39f9a65a 100644 --- a/docs/9.x/index.html +++ b/docs/9.x/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
    Version: 9.x

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    +
    Version: 9.x

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    This is a part of the article: Testing Angular faster with Jest.

    important

    Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

    +@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

    \ No newline at end of file diff --git a/docs/9.x/processing/index.html b/docs/9.x/processing/index.html index 4075282659..9df4ffe71c 100644 --- a/docs/9.x/processing/index.html +++ b/docs/9.x/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
    +
    \ No newline at end of file diff --git a/docs/getting-started/installation/index.html b/docs/getting-started/installation/index.html index b02d9e8312..e5a1c57248 100644 --- a/docs/getting-started/installation/index.html +++ b/docs/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    Installation

    Dependencies

    +
    Version: 14.4

    Installation

    Dependencies

    You can install jest-preset-angular and dependencies all at once with one of the following commands.

    npm install -D jest jest-preset-angular @types/jest

    Configuration

    diff --git a/docs/getting-started/options/index.html b/docs/getting-started/options/index.html index 677af4cb06..8cb0ce36a9 100644 --- a/docs/getting-started/options/index.html +++ b/docs/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    Options

    jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object +

    Version: 14.4

    Options

    jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

    More information about ts-jest options, see doc

    important

    Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -41,6 +41,6 @@

    +
    \ No newline at end of file diff --git a/docs/getting-started/presets/index.html b/docs/getting-started/presets/index.html index cf3e92c5e1..93fefaeca5 100644 --- a/docs/getting-started/presets/index.html +++ b/docs/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    Presets

    In Jest, presets are pre-defined configurations that help streamline and standardize the process of setting up testing environments. +

    Version: 14.4

    Presets

    In Jest, presets are pre-defined configurations that help streamline and standardize the process of setting up testing environments. They allow developers to quickly configure Jest with specific transformers, file extensions, and other options.

    jest-preset-angular provides very opinionated presets and based on what we found to be useful.

    important

    The current best practice for using presets is to call one of the utility functions below to create (and optionally extend) presets. Legacy presets are listed at the bottom of the page.

    @@ -67,6 +67,6 @@

    Legacy These legacy presets will be removed in the next major release and users are HIGHLY RECOMMENDED to migrate to use the above utility functions.

    Preset nameDescription
    jest-preset-angular/presets/default
    or jest-preset-angular
    TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to CommonJS syntax.
    jest-preset-angular/presets/defaults-esm
    TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to ESM syntax.

    Example

    -
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    };

    export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/getting-started/test-environment/index.html b/docs/getting-started/test-environment/index.html index f28cf6808d..f22a6088cc 100644 --- a/docs/getting-started/test-environment/index.html +++ b/docs/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    Test environment

    In Jest, a test environment defines the sandbox context in which your tests run. +

    Version: 14.4

    Test environment

    In Jest, a test environment defines the sandbox context in which your tests run. For Angular projects, setting up the correct test environment is essential to ensure compatibility with the framework-specific features, such as dependency injection and change detection.

    jest-preset-angular provides utility functions to simplify setting up a Jest test environment tailored for Angular projects. @@ -60,6 +60,6 @@

    Example:
  • Update your Jest configuration:
  • -
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
    };

    export default jestConfig;

    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/guides/absolute-imports/index.html b/docs/guides/absolute-imports/index.html index c8131b9a28..93b3d4d4c5 100644 --- a/docs/guides/absolute-imports/index.html +++ b/docs/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
    Version: 14.4

    Absolute Imports

    If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

    Version: 14.4

    Absolute Imports

    If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

    -

    More information see ts-jest paths mapping configuration documentation

    +

    More information see ts-jest paths mapping configuration documentation

    \ No newline at end of file diff --git a/docs/guides/angular-13+/index.html b/docs/guides/angular-13+/index.html index 8da50788e4..81e9df48ea 100644 --- a/docs/guides/angular-13+/index.html +++ b/docs/guides/angular-13+/index.html @@ -2,7 +2,7 @@ - + Angular >=13 | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    Angular >=13

    Angular 13 introduces ESM package format for Angular packages. jest-preset-angular +

    Version: 14.4

    Angular >=13

    Angular 13 introduces ESM package format for Angular packages. jest-preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset.

    important

    With Jest 28 and jest-preset-angular v12.0.0, ng-jest-resolver is no longer required to have in Jest config. This resolver is also excluded from our default and default ESM presets.

    @@ -63,6 +63,6 @@

    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    // ...other options
    transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
    };

    export default jestConfig;

    Usage with Ionic 6 or 7

    To support Ionic 6 or 7 you will need to modify transformIgnorePatterns to be as following:

    -
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    // ...other options
    transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
    };

    export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    // ...other options
    transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/guides/angular-ivy/index.html b/docs/guides/angular-ivy/index.html index 6f77bc22e8..2def0f7621 100644 --- a/docs/guides/angular-ivy/index.html +++ b/docs/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    Angular Ivy

    important

    This step is OPTIONAL

    +
    Version: 14.4

    Angular Ivy

    important

    This step is OPTIONAL

    Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

    @@ -29,6 +29,6 @@
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    //...
    globalSetup: 'jest-preset-angular/global-setup',
    };

    export default jestConfig;

    Control ngcc processing

    Since v12.0.0, jest-preset-angular provide a possibility to skip ngcc via globalThis by doing the following

    -
    jest.config.ts
    import type { Config } from 'jest';

    globalThis.ngJest = {
    skipNgcc: true,
    tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
    };

    const jestConfig: Config = {
    //...
    globalSetup: 'jest-preset-angular/global-setup',
    };

    export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    globalThis.ngJest = {
    skipNgcc: true,
    tsconfig: 'tsconfig.spec.json', // this is the project root tsconfig
    };

    const jestConfig: Config = {
    //...
    globalSetup: 'jest-preset-angular/global-setup',
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/guides/esm-support/index.html b/docs/guides/esm-support/index.html index b68a88fa1b..c3b836cde6 100644 --- a/docs/guides/esm-support/index.html +++ b/docs/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    ESM Support

    To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

    +
    Version: 14.4

    ESM Support

    To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

    jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

    There is also a preset to work with ESM.

    tip

    We have example apps which contains base ESM setup to work with Jest and Angular.

    @@ -32,6 +32,6 @@

    Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

    To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

    -
    jest.config.mts
    import type { Config } from 'jest';

    const jestConfig = {
    //...
    preset: 'jest-preset-angular/presets/defaults-esm',
    };

    export default jestConfig;
    +
    jest.config.mts
    import type { Config } from 'jest';

    const jestConfig = {
    //...
    preset: 'jest-preset-angular/presets/defaults-esm',
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/guides/jsdom-version/index.html b/docs/guides/jsdom-version/index.html index db6b04993a..104c759ca6 100644 --- a/docs/guides/jsdom-version/index.html +++ b/docs/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + Configure other JSDOM versions | jest-preset-angular @@ -13,16 +13,16 @@ - - - + + + -
    Version: 14.4

    Configure other JSDOM versions

    Jest v26+ by default uses JSDOM 16 to support Node 10+.

    +
    Version: 14.4

    Configure other JSDOM versions

    Jest v26+ by default uses JSDOM 16 to support Node 10+.

    If you need a different JSDOM version than the one that ships with Jest, you can install a jsdom environment package, e.g. jest-environment-jsdom-sixteen and edit your Jest config like so:

    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    testEnvironment: 'jest-environment-jsdom-sixteen',
    };

    export default jestConfig;

    If you use JSDOM v11 or lower, you might have to mock localStorage or sessionStorage on your own or using some third-party library by loading it in setupFilesAfterEnv.

    -

    Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

    +

    Reference: https://jestjs.io/docs/en/configuration.html#testenvironment-string, https://github.com/jsdom/jsdom/blob/main/Changelog.md#1200

    \ No newline at end of file diff --git a/docs/guides/snapshot-testing/index.html b/docs/guides/snapshot-testing/index.html index 4cf42084ed..876018ebbf 100644 --- a/docs/guides/snapshot-testing/index.html +++ b/docs/guides/snapshot-testing/index.html @@ -2,7 +2,7 @@ - + Snapshot testing | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    Snapshot testing

    jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.

    + +
    foo.component.spec.ts
    import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';

    expect.addSnapshotSerializer(removeNgAttributes);

    it('should work', () => {
    //[...]
    });
    \ No newline at end of file diff --git a/docs/guides/troubleshooting/index.html b/docs/guides/troubleshooting/index.html index 8d65bd149b..347385fd57 100644 --- a/docs/guides/troubleshooting/index.html +++ b/docs/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    Troubleshooting

    You can check Jest troubleshooting guide

    +
    Version: 14.4

    Troubleshooting

    You can check Jest troubleshooting guide

    Common issues

    Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

    Can't resolve all parameters for SomeClass(?)

    @@ -82,6 +82,6 @@

    Resolution<
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    //...
    resolver: '<rootDir>/src/jest.resolver.ts',
    //...
    };

    export default jestConfig;

    Inject dependencies with TypeScript interface or exported namespace

    Please use Angular inject instead of @Inject. -This is because jest-preset-angular has caveat when working with class constructor and decorator.

    +This is because jest-preset-angular has caveat when working with class constructor and decorator.

    \ No newline at end of file diff --git a/docs/guides/using-with-babel/index.html b/docs/guides/using-with-babel/index.html index 0e9db6eb80..6921de838f 100644 --- a/docs/guides/using-with-babel/index.html +++ b/docs/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: 14.4

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    +
    Version: 14.4

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    1. Install dependencies required by the official Jest documentation for Babel integration.

      @@ -32,6 +32,6 @@
      1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
      -
      jest.config.ts
      import type { Config } from 'jest';

      const jestConfig: Config = {
      //...
      transform: {
      '^.+\\.(ts|html)$': 'jest-preset-angular',
      '^.+\\.js$': 'babel-jest',
      },
      };

      export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    //...
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 5e0530d9b5..3346fe5b2c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
    Version: 14.4

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    +
    Version: 14.4

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    This is a part of the article: Testing Angular faster with Jest.

    important

    Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

    +@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

    \ No newline at end of file diff --git a/docs/next/getting-started/installation/index.html b/docs/next/getting-started/installation/index.html index 59b1901232..2f8d6b3109 100644 --- a/docs/next/getting-started/installation/index.html +++ b/docs/next/getting-started/installation/index.html @@ -2,7 +2,7 @@ - + Installation | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    Installation

    Dependencies

    +
    Version: Next

    Installation

    Dependencies

    You can install jest-preset-angular and dependencies all at once with one of the following commands.

    npm install -D jest jest-preset-angular @types/jest

    Configuration

    diff --git a/docs/next/getting-started/options/index.html b/docs/next/getting-started/options/index.html index b55a2a5559..93fc520527 100644 --- a/docs/next/getting-started/options/index.html +++ b/docs/next/getting-started/options/index.html @@ -2,7 +2,7 @@ - + Options | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    Options

    jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object +

    Version: Next

    Options

    jest-preset-angular uses ts-jest options under the hood, which are located under the transform of Jest config object in the package.json file of your project, or through a jest.config.js, or jest.config.ts file.

    More information about ts-jest options, see doc

    important

    Since v9.0.0, jest-preset-angular default Jest configuration no longer provides moduleNameMapper. If you wish to reuse @@ -41,6 +41,6 @@

    +
    \ No newline at end of file diff --git a/docs/next/getting-started/presets/index.html b/docs/next/getting-started/presets/index.html index c470856cd3..2ac61ffdb5 100644 --- a/docs/next/getting-started/presets/index.html +++ b/docs/next/getting-started/presets/index.html @@ -2,7 +2,7 @@ - + Presets | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    Presets

    In Jest, presets are pre-defined configurations that help streamline and standardize the process of setting up testing environments. +

    Version: Next

    Presets

    In Jest, presets are pre-defined configurations that help streamline and standardize the process of setting up testing environments. They allow developers to quickly configure Jest with specific transformers, file extensions, and other options.

    jest-preset-angular provides very opinionated presets and based on what we found to be useful.

    important

    The current best practice for using presets is to call one of the utility functions below to create (and optionally extend) presets. Legacy presets are listed at the bottom of the page.

    @@ -67,6 +67,6 @@

    Legacy These legacy presets will be removed in the next major release and users are HIGHLY RECOMMENDED to migrate to use the above utility functions.

    Preset nameDescription
    jest-preset-angular/presets/default
    or jest-preset-angular
    TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to CommonJS syntax.
    jest-preset-angular/presets/defaults-esm
    TypeScript, JavaScript and HTML files (js, .ts, .html) will be transformed by jest-preset-angular to ESM syntax.

    Example

    -
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    };

    export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/next/getting-started/test-environment/index.html b/docs/next/getting-started/test-environment/index.html index 76bad253e0..fd91d94665 100644 --- a/docs/next/getting-started/test-environment/index.html +++ b/docs/next/getting-started/test-environment/index.html @@ -2,7 +2,7 @@ - + Test environment | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    Test environment

    In Jest, a test environment defines the sandbox context in which your tests run. +

    Version: Next

    Test environment

    In Jest, a test environment defines the sandbox context in which your tests run. For Angular projects, setting up the correct test environment is essential to ensure compatibility with the framework-specific features, such as dependency injection and change detection.

    jest-preset-angular provides utility functions to simplify setting up a Jest test environment tailored for Angular projects. @@ -60,6 +60,6 @@

    Example:
  • Update your Jest configuration:
  • -
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
    };

    export default jestConfig;

    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    preset: 'jest-preset-angular',
    setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/next/guides/absolute-imports/index.html b/docs/next/guides/absolute-imports/index.html index e37463aa83..1679592605 100644 --- a/docs/next/guides/absolute-imports/index.html +++ b/docs/next/guides/absolute-imports/index.html @@ -2,7 +2,7 @@ - + Absolute Imports | jest-preset-angular @@ -13,13 +13,13 @@ - - - + + + -
    Version: Next

    Absolute Imports

    If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the +

    Version: Next

    Absolute Imports

    If you wish to use TypeScript path mappings which are defined in paths of your tsconfig, make sure that you create the similar mapping for moduleNameMapper in Jest config.

    -

    More information see ts-jest paths mapping configuration documentation

    +

    More information see ts-jest paths mapping configuration documentation

    \ No newline at end of file diff --git a/docs/next/guides/angular-13+/index.html b/docs/next/guides/angular-13+/index.html index ce966f293d..f741f812a9 100644 --- a/docs/next/guides/angular-13+/index.html +++ b/docs/next/guides/angular-13+/index.html @@ -2,7 +2,7 @@ - + Angular >=13 | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    Angular >=13

    Angular 13 introduces ESM package format for Angular packages. jest-preset-angular +

    Version: Next

    Angular >=13

    Angular 13 introduces ESM package format for Angular packages. jest-preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset.

    important

    With Jest 28 and jest-preset-angular v12.0.0, ng-jest-resolver is no longer required to have in Jest config. This resolver is also excluded from our default and default ESM presets.

    @@ -63,6 +63,6 @@

    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    // ...other options
    transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
    };

    export default jestConfig;

    Usage with Ionic 6 or 7

    To support Ionic 6 or 7 you will need to modify transformIgnorePatterns to be as following:

    -
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    // ...other options
    transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
    };

    export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    // ...other options
    transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@ionic/core|@ionic/angular|@stencil/core|.*\\.mjs$))'],
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/next/guides/angular-ivy/index.html b/docs/next/guides/angular-ivy/index.html index 72c6296667..3fda3516de 100644 --- a/docs/next/guides/angular-ivy/index.html +++ b/docs/next/guides/angular-ivy/index.html @@ -2,7 +2,7 @@ - + Angular Ivy | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    Angular Ivy

    warning

    This guide is now DEPRECATED and will be removed in the next major release together with the below APIs.

    +
    Version: Next

    Angular Ivy

    warning

    This guide is now DEPRECATED and will be removed in the next major release together with the below APIs.

    Starting from v9.0.0+, jest-preset-angular is fully compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, you must run ngcc before running tests. ngcc will transform all Angular-format packages to be compatible with Ivy compiler.

    diff --git a/docs/next/guides/esm-support/index.html b/docs/next/guides/esm-support/index.html index efdec2abb3..b64683effd 100644 --- a/docs/next/guides/esm-support/index.html +++ b/docs/next/guides/esm-support/index.html @@ -2,7 +2,7 @@ - + ESM Support | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    ESM Support

    To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

    +
    Version: Next

    ESM Support

    To use jest-preset-angular with ESM support, you'll first need to check ESM Jest documentation.

    jest-preset-angular supports ESM via a ts-jest config option useESM in combination with jest config option extensionsToTreatAsEsm.

    There is also a preset to work with ESM.

    tip

    We have example apps which contains base ESM setup to work with Jest and Angular.

    @@ -32,6 +32,6 @@

    Use ES However, there are cases like Angular libraries ESM built files or ESM files which are outside node_modules might not be loaded correctly.

    To fix that, one can use moduleNameMapper in jest config to instruct Jest to load the correct ESM files or create a custom Jest resolver.

    -
    jest.config.mts
    import type { Config } from 'jest';

    const jestConfig = {
    //...
    preset: 'jest-preset-angular/presets/defaults-esm',
    };

    export default jestConfig;
    +
    jest.config.mts
    import type { Config } from 'jest';

    const jestConfig = {
    //...
    preset: 'jest-preset-angular/presets/defaults-esm',
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/next/guides/jsdom-version/index.html b/docs/next/guides/jsdom-version/index.html index 974104e7e4..4d286ce1ed 100644 --- a/docs/next/guides/jsdom-version/index.html +++ b/docs/next/guides/jsdom-version/index.html @@ -2,7 +2,7 @@ - + JSDOM version | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    JSDOM version

    jest-preset-angular provides a way to configure a different version of JSDOM than the one ships with Jest +

    Version: Next

    JSDOM version

    jest-preset-angular provides a way to configure a different version of JSDOM than the one ships with Jest via a custom JSDOM environment. One can follow the below steps to configure a different JSDOM version:

    • Install the desired JSDOM version
    • diff --git a/docs/next/guides/snapshot-testing/index.html b/docs/next/guides/snapshot-testing/index.html index 5ea6368112..445deb0d55 100644 --- a/docs/next/guides/snapshot-testing/index.html +++ b/docs/next/guides/snapshot-testing/index.html @@ -2,7 +2,7 @@ - + Snapshot testing | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
      Version: Next

      Snapshot testing

      jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.

      +
      Version: Next

      Snapshot testing

      jest-preset-angular provides several snapshot serializers to generate clearer and more human-readable snapshot.

      info

      BY DEFAULT, the preset provides all of the snapshot serializers below.

      Snapshot serializers

      @@ -92,6 +92,6 @@

      Examples:
    • Or in individual test files
    -
    foo.component.spec.ts
    import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';

    expect.addSnapshotSerializer(removeNgAttributes);

    it('should work', () => {
    //[...]
    });
    +
    foo.component.spec.ts
    import removeNgAttributes from 'jest-preset-angular/build/serializers/no-ng-attributes';

    expect.addSnapshotSerializer(removeNgAttributes);

    it('should work', () => {
    //[...]
    });
    \ No newline at end of file diff --git a/docs/next/guides/troubleshooting/index.html b/docs/next/guides/troubleshooting/index.html index d200e04db6..1ef8a4a53e 100644 --- a/docs/next/guides/troubleshooting/index.html +++ b/docs/next/guides/troubleshooting/index.html @@ -2,7 +2,7 @@ - + Troubleshooting | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    Troubleshooting

    You can check Jest troubleshooting guide

    +
    Version: Next

    Troubleshooting

    You can check Jest troubleshooting guide

    Common issues

    Problems may arise if you're using custom builds (this preset is tailored for angular-cli as firstly priority). Please be advised that every entry in default configuration may be overridden to best suite your app's needs.

    Can't resolve all parameters for SomeClass(?)

    @@ -82,6 +82,6 @@

    Resolution<
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    //...
    resolver: '<rootDir>/src/jest.resolver.ts',
    //...
    };

    export default jestConfig;

    Inject dependencies with TypeScript interface or exported namespace

    Please use Angular inject instead of @Inject. -This is because jest-preset-angular has caveat when working with class constructor and decorator.

    +This is because jest-preset-angular has caveat when working with class constructor and decorator.

    \ No newline at end of file diff --git a/docs/next/guides/using-with-babel/index.html b/docs/next/guides/using-with-babel/index.html index a30fdbbc85..5abea182a6 100644 --- a/docs/next/guides/using-with-babel/index.html +++ b/docs/next/guides/using-with-babel/index.html @@ -2,7 +2,7 @@ - + Using with Babel | jest-preset-angular @@ -13,12 +13,12 @@ - - - + + + -
    Version: Next

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    +
    Version: Next

    Using with Babel

    If you wish to use Babel, you need to say jest to transpile such files manually.

    1. Install dependencies required by the official Jest documentation for Babel integration.

      @@ -32,6 +32,6 @@
      1. Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
      -
      jest.config.ts
      import type { Config } from 'jest';

      const jestConfig: Config = {
      //...
      transform: {
      '^.+\\.(ts|html)$': 'jest-preset-angular',
      '^.+\\.js$': 'babel-jest',
      },
      };

      export default jestConfig;
    +
    jest.config.ts
    import type { Config } from 'jest';

    const jestConfig: Config = {
    //...
    transform: {
    '^.+\\.(ts|html)$': 'jest-preset-angular',
    '^.+\\.js$': 'babel-jest',
    },
    };

    export default jestConfig;
    \ No newline at end of file diff --git a/docs/next/index.html b/docs/next/index.html index 953e5ef582..c13b1e28d7 100644 --- a/docs/next/index.html +++ b/docs/next/index.html @@ -2,7 +2,7 @@ - + Introduction | jest-preset-angular @@ -13,14 +13,14 @@ - - - + + + -
    Version: Next

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    +
    Version: Next

    Introduction

    jest-preset-angular is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects.

    This is a part of the article: Testing Angular faster with Jest.

    important

    Starting from v9.0.0, we follow closely native Karma + Jasmine implementation which is default provided by -@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

    +@angular/cli. This will make the testing experience with Jest more inline native with Angular testing experience.

    \ No newline at end of file diff --git a/docs/next/processing/index.html b/docs/next/processing/index.html index d8116a89e2..ec58fb13b6 100644 --- a/docs/next/processing/index.html +++ b/docs/next/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
    +
    \ No newline at end of file diff --git a/docs/processing/index.html b/docs/processing/index.html index 509f403d0d..88ce212a1b 100644 --- a/docs/processing/index.html +++ b/docs/processing/index.html @@ -2,7 +2,7 @@ - + Processing flow | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -
    +
    \ No newline at end of file diff --git a/index.html b/index.html index 9dfaf61429..3bc94e178a 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + Jest preset configuration for Angular projects. | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -

    Docusaurus with KeytarDelightful testing with Jest and Angular

    Angular Ivy? Check out our Angular Ivy guidance.
    Migrate to Angular >=13? Check out our Angular >=13 guidance.

    Easy to Use

    Jest presets to let you start quickly with testing.

    View Engine/Ivy

    Support both Angular View Engine and Angular Ivy.

    Babel support

    Support working in combination with Babel

    +

    Docusaurus with KeytarDelightful testing with Jest and Angular

    Angular Ivy? Check out our Angular Ivy guidance.
    Migrate to Angular >=13? Check out our Angular >=13 guidance.

    Easy to Use

    Jest presets to let you start quickly with testing.

    View Engine/Ivy

    Support both Angular View Engine and Angular Ivy.

    Babel support

    Support working in combination with Babel

    \ No newline at end of file diff --git a/search/index.html b/search/index.html index b1b290d26c..185ea2c243 100644 --- a/search/index.html +++ b/search/index.html @@ -2,7 +2,7 @@ - + Search the documentation | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -

    Search the documentation

    +

    Search the documentation

    \ No newline at end of file diff --git a/sw.js b/sw.js index ae80d42332..32f4a752da 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -(()=>{"use strict";var e={136:()=>{try{self["workbox:core:7.0.0"]&&_()}catch(e){}},447:()=>{try{self["workbox:precaching:7.0.0"]&&_()}catch(e){}},227:()=>{try{self["workbox:routing:7.0.0"]&&_()}catch(e){}},390:()=>{try{self["workbox:strategies:7.0.0"]&&_()}catch(e){}}},t={};function s(a){var n=t[a];if(void 0!==n)return n.exports;var i=t[a]={exports:{}};return e[a](i,i.exports,s),i.exports}s(136);const a=(e,...t)=>{let s=e;return t.length>0&&(s+=` :: ${JSON.stringify(t)}`),s};class n extends Error{constructor(e,t){super(a(e,t)),this.name=e,this.details=t}}const i={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},r=e=>[i.prefix,e,i.suffix].filter((e=>e&&e.length>0)).join("-"),c=e=>e||r(i.precache),o=e=>e||r(i.runtime);function h(e,t){const s=t();return e.waitUntil(s),s}s(447);function l(e){if(!e)throw new n("add-to-cache-list-unexpected-type",{entry:e});if("string"==typeof e){const t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}const{revision:t,url:s}=e;if(!s)throw new n("add-to-cache-list-unexpected-type",{entry:e});if(!t){const e=new URL(s,location.href);return{cacheKey:e.href,url:e.href}}const a=new URL(s,location.href),i=new URL(s,location.href);return a.searchParams.set("__WB_REVISION__",t),{cacheKey:a.href,url:i.href}}class u{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)},this.cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:s})=>{if("install"===e.type&&t&&t.originalRequest&&t.originalRequest instanceof Request){const e=t.originalRequest.url;s?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return s}}}class f{constructor({precacheController:e}){this.cacheKeyWillBeUsed=async({request:e,params:t})=>{const s=(null==t?void 0:t.cacheKey)||this._precacheController.getCacheKeyForURL(e.url);return s?new Request(s,{headers:e.headers}):e},this._precacheController=e}}let d;async function p(e,t){let s=null;if(e.url){s=new URL(e.url).origin}if(s!==self.location.origin)throw new n("cross-origin-copy-response",{origin:s});const a=e.clone(),i={headers:new Headers(a.headers),status:a.status,statusText:a.statusText},r=t?t(i):i,c=function(){if(void 0===d){const t=new Response("");if("body"in t)try{new Response(t.body),d=!0}catch(e){d=!1}d=!1}return d}()?a.body:await a.blob();return new Response(c,r)}function g(e,t){const s=new URL(e);for(const a of t)s.searchParams.delete(a);return s.href}class y{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}const w=new Set;s(390);function v(e){return"string"==typeof e?new Request(e):e}class m{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new y,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(const s of this._plugins)this._pluginStateMap.set(s,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){const{event:t}=this;let s=v(e);if("navigate"===s.mode&&t instanceof FetchEvent&&t.preloadResponse){const e=await t.preloadResponse;if(e)return e}const a=this.hasCallback("fetchDidFail")?s.clone():null;try{for(const e of this.iterateCallbacks("requestWillFetch"))s=await e({request:s.clone(),event:t})}catch(r){if(r instanceof Error)throw new n("plugin-error-request-will-fetch",{thrownErrorMessage:r.message})}const i=s.clone();try{let e;e=await fetch(s,"navigate"===s.mode?void 0:this._strategy.fetchOptions);for(const s of this.iterateCallbacks("fetchDidSucceed"))e=await s({event:t,request:i,response:e});return e}catch(c){throw a&&await this.runCallbacks("fetchDidFail",{error:c,event:t,originalRequest:a.clone(),request:i.clone()}),c}}async fetchAndCachePut(e){const t=await this.fetch(e),s=t.clone();return this.waitUntil(this.cachePut(e,s)),t}async cacheMatch(e){const t=v(e);let s;const{cacheName:a,matchOptions:n}=this._strategy,i=await this.getCacheKey(t,"read"),r=Object.assign(Object.assign({},n),{cacheName:a});s=await caches.match(i,r);for(const c of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await c({cacheName:a,matchOptions:n,cachedResponse:s,request:i,event:this.event})||void 0;return s}async cachePut(e,t){const s=v(e);var a;await(a=0,new Promise((e=>setTimeout(e,a))));const i=await this.getCacheKey(s,"write");if(!t)throw new n("cache-put-with-no-response",{url:(r=i.url,new URL(String(r),location.href).href.replace(new RegExp(`^${location.origin}`),""))});var r;const c=await this._ensureResponseSafeToCache(t);if(!c)return!1;const{cacheName:o,matchOptions:h}=this._strategy,l=await self.caches.open(o),u=this.hasCallback("cacheDidUpdate"),f=u?await async function(e,t,s,a){const n=g(t.url,s);if(t.url===n)return e.match(t,a);const i=Object.assign(Object.assign({},a),{ignoreSearch:!0}),r=await e.keys(t,i);for(const c of r)if(n===g(c.url,s))return e.match(c,a)}(l,i.clone(),["__WB_REVISION__"],h):null;try{await l.put(i,u?c.clone():c)}catch(d){if(d instanceof Error)throw"QuotaExceededError"===d.name&&await async function(){for(const e of w)await e()}(),d}for(const n of this.iterateCallbacks("cacheDidUpdate"))await n({cacheName:o,oldResponse:f,newResponse:c.clone(),request:i,event:this.event});return!0}async getCacheKey(e,t){const s=`${e.url} | ${t}`;if(!this._cacheKeys[s]){let a=e;for(const e of this.iterateCallbacks("cacheKeyWillBeUsed"))a=v(await e({mode:t,request:a,event:this.event,params:this.params}));this._cacheKeys[s]=a}return this._cacheKeys[s]}hasCallback(e){for(const t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(const s of this.iterateCallbacks(e))await s(t)}*iterateCallbacks(e){for(const t of this._strategy.plugins)if("function"==typeof t[e]){const s=this._pluginStateMap.get(t),a=a=>{const n=Object.assign(Object.assign({},a),{state:s});return t[e](n)};yield a}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,s=!1;for(const a of this.iterateCallbacks("cacheWillUpdate"))if(t=await a({request:this.request,response:t,event:this.event})||void 0,s=!0,!t)break;return s||t&&200!==t.status&&(t=void 0),t}}class R{constructor(e={}){this.cacheName=o(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){const[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});const t=e.event,s="string"==typeof e.request?new Request(e.request):e.request,a="params"in e?e.params:void 0,n=new m(this,{event:t,request:s,params:a}),i=this._getResponse(n,s,t);return[i,this._awaitComplete(i,n,s,t)]}async _getResponse(e,t,s){let a;await e.runCallbacks("handlerWillStart",{event:s,request:t});try{if(a=await this._handle(t,e),!a||"error"===a.type)throw new n("no-response",{url:t.url})}catch(i){if(i instanceof Error)for(const n of e.iterateCallbacks("handlerDidError"))if(a=await n({error:i,event:s,request:t}),a)break;if(!a)throw i}for(const n of e.iterateCallbacks("handlerWillRespond"))a=await n({event:s,request:t,response:a});return a}async _awaitComplete(e,t,s,a){let n,i;try{n=await e}catch(i){}try{await t.runCallbacks("handlerDidRespond",{event:a,request:s,response:n}),await t.doneWaiting()}catch(r){r instanceof Error&&(i=r)}if(await t.runCallbacks("handlerDidComplete",{event:a,request:s,response:n,error:i}),t.destroy(),i)throw i}}class b extends R{constructor(e={}){e.cacheName=c(e.cacheName),super(e),this._fallbackToNetwork=!1!==e.fallbackToNetwork,this.plugins.push(b.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){const s=await t.cacheMatch(e);return s||(t.event&&"install"===t.event.type?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,t){let s;const a=t.params||{};if(!this._fallbackToNetwork)throw new n("missing-precache-entry",{cacheName:this.cacheName,url:e.url});{0;const n=a.integrity,i=e.integrity,r=!i||i===n;if(s=await t.fetch(new Request(e,{integrity:"no-cors"!==e.mode?i||n:void 0})),n&&r&&"no-cors"!==e.mode){this._useDefaultCacheabilityPluginIfNeeded();await t.cachePut(e,s.clone());0}}return s}async _handleInstall(e,t){this._useDefaultCacheabilityPluginIfNeeded();const s=await t.fetch(e);if(!await t.cachePut(e,s.clone()))throw new n("bad-precaching-response",{url:e.url,status:s.status});return s}_useDefaultCacheabilityPluginIfNeeded(){let e=null,t=0;for(const[s,a]of this.plugins.entries())a!==b.copyRedirectedCacheableResponsesPlugin&&(a===b.defaultPrecacheCacheabilityPlugin&&(e=s),a.cacheWillUpdate&&t++);0===t?this.plugins.push(b.defaultPrecacheCacheabilityPlugin):t>1&&null!==e&&this.plugins.splice(e,1)}}b.defaultPrecacheCacheabilityPlugin={cacheWillUpdate:async({response:e})=>!e||e.status>=400?null:e},b.copyRedirectedCacheableResponsesPlugin={cacheWillUpdate:async({response:e})=>e.redirected?await p(e):e};class C{constructor({cacheName:e,plugins:t=[],fallbackToNetwork:s=!0}={}){this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new b({cacheName:c(e),plugins:[...t,new f({precacheController:this})],fallbackToNetwork:s}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this._installAndActiveListenersAdded=!0)}addToCacheList(e){const t=[];for(const s of e){"string"==typeof s?t.push(s):s&&void 0===s.revision&&t.push(s.url);const{cacheKey:e,url:a}=l(s),i="string"!=typeof s&&s.revision?"reload":"default";if(this._urlsToCacheKeys.has(a)&&this._urlsToCacheKeys.get(a)!==e)throw new n("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(a),secondEntry:e});if("string"!=typeof s&&s.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==s.integrity)throw new n("add-to-cache-list-conflicting-integrities",{url:a});this._cacheKeysToIntegrities.set(e,s.integrity)}if(this._urlsToCacheKeys.set(a,e),this._urlsToCacheModes.set(a,i),t.length>0){const e=`Workbox is precaching URLs without revision info: ${t.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(e)}}}install(e){return h(e,(async()=>{const t=new u;this.strategy.plugins.push(t);for(const[n,i]of this._urlsToCacheKeys){const t=this._cacheKeysToIntegrities.get(i),s=this._urlsToCacheModes.get(n),a=new Request(n,{integrity:t,cache:s,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:i},request:a,event:e}))}const{updatedURLs:s,notUpdatedURLs:a}=t;return{updatedURLs:s,notUpdatedURLs:a}}))}activate(e){return h(e,(async()=>{const e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),s=new Set(this._urlsToCacheKeys.values()),a=[];for(const n of t)s.has(n.url)||(await e.delete(n),a.push(n.url));return{deletedURLs:a}}))}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){const t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){const t=e instanceof Request?e.url:e,s=this.getCacheKeyForURL(t);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(e){const t=this.getCacheKeyForURL(e);if(!t)throw new n("non-precached-url",{url:e});return s=>(s.request=new Request(e),s.params=Object.assign({cacheKey:t},s.params),this.strategy.handle(s))}}s(227);(async()=>{const e=function(){const e=JSON.parse(new URLSearchParams(self.location.search).get("params"));return e.debug&&console.log("[Docusaurus-PWA][SW]: Service Worker params:",e),e}(),t=[{"revision":"a7f47a4e0fbcd23867a4da1ba9a7ae33","url":"404.html"},{"revision":"8103c30be6e4a921135d43ccf88dbd28","url":"assets/css/styles.27f8d049.css"},{"revision":"3c4e0303aafb01c8a7c68a836fc4e31e","url":"assets/js/029bedf1.b7009fd1.js"},{"revision":"936ac1742987298f6d3843a9ec068287","url":"assets/js/02a1e558.7d8be562.js"},{"revision":"2edb44aad44bc8812e2d56729c67d292","url":"assets/js/03be7dae.946b6548.js"},{"revision":"4fe4a06ac70d9f5fd14f9144bc9aa780","url":"assets/js/04ae74d1.50384eca.js"},{"revision":"f63ea5b51167b420ae6b348071dbc2d3","url":"assets/js/04b3fc6c.268ff951.js"},{"revision":"5e1ab4fc35822faf2caff2ebd70b79c1","url":"assets/js/05916282.32c64332.js"},{"revision":"bef4f028f929475dbd58667cb59a4ae2","url":"assets/js/08804573.b158604d.js"},{"revision":"46774c741e84a1445c7a76402f9c9a0a","url":"assets/js/097bb47a.391c0328.js"},{"revision":"1d5d8e82d5840bac75514c9146d8dec6","url":"assets/js/09df063d.f8f4a530.js"},{"revision":"d86b0bbd74da80adc9212c8e2e8f0367","url":"assets/js/0d71a3f1.c30ddbf7.js"},{"revision":"26ce5a874a33484c323e7c7ac67cf148","url":"assets/js/0dc350cc.e5f566a7.js"},{"revision":"a215512a1bc5df2a712157e2ae57b0ce","url":"assets/js/0e35f71d.922de4b0.js"},{"revision":"a5c5804805187a03ccb824cc2fd6d260","url":"assets/js/135.634828fd.js"},{"revision":"b1f194ed2fcbcd5dbc045a83258e17fe","url":"assets/js/13973f06.622ff653.js"},{"revision":"16f232190570f3675df1d243e9ff2407","url":"assets/js/1438ea8f.864d0288.js"},{"revision":"1d284c50e78f7f9858a953a73bfaac17","url":"assets/js/14b133ce.ca79723e.js"},{"revision":"c97f475b4c0fdb3f2388c77479240ed2","url":"assets/js/151633a5.dd917c1e.js"},{"revision":"956260ddb5e5a82d201152c38a0334f0","url":"assets/js/15a051c9.2048c710.js"},{"revision":"cd982095d625a060a02129f6a4cf1024","url":"assets/js/164a8de7.9a3d6637.js"},{"revision":"14574d751b737018939b1ac344bef84e","url":"assets/js/17896441.703c7d4f.js"},{"revision":"55d8654df88553691531c1824539a0fe","url":"assets/js/1a421168.08e719a3.js"},{"revision":"c256a4f2483a6acecac957b515859383","url":"assets/js/1a4e3797.ad537829.js"},{"revision":"452b4bab8e7545dce9b2088b7bed874d","url":"assets/js/1a5572f6.22ecf73b.js"},{"revision":"8de2cf5f92d57aa3bfc98d63ae23c6b5","url":"assets/js/1d8e39f8.28a9d5a6.js"},{"revision":"48355435392d2c89cba1e030ded46aae","url":"assets/js/1df93b7f.0ac154cb.js"},{"revision":"1c3199fadae427c11402cdfe763a1a70","url":"assets/js/1e388ac9.a696ff9b.js"},{"revision":"32f0c7f7decb4fe8b4c4ba1d502f81a9","url":"assets/js/203fc93e.7717a5e9.js"},{"revision":"8874883076e9d42bc1edb65ad2b3fc5d","url":"assets/js/22e4d634.5953e3db.js"},{"revision":"8e1e5091cdf4d22faa95e9b514998b68","url":"assets/js/252e2b80.6bca9d9a.js"},{"revision":"a155ab01c2c64b0120fbf03ad087400a","url":"assets/js/2560.7545f406.js"},{"revision":"2ca72c693b368876ffbfe442ad115ef4","url":"assets/js/25e9e857.b319aa84.js"},{"revision":"54f9a5deb3f20ce31edd6f77c5ae3ab0","url":"assets/js/26cb42b7.ca0b9bce.js"},{"revision":"7ecde6d729a1d3860b1133453d19a4f0","url":"assets/js/27299a3b.0baa2ff1.js"},{"revision":"2a45bb51de5e0b8750f343ff9227b9d2","url":"assets/js/27af8d7b.9de1f2c2.js"},{"revision":"dab1026725272d8f8b72e7e0e0402508","url":"assets/js/29d26392.5eb3a2bf.js"},{"revision":"ba9f8133117aebbe326c09f31e42d718","url":"assets/js/2a474b18.cfe459b8.js"},{"revision":"08faf20a5b6dab115aaee52f40b1466e","url":"assets/js/2ab18ce5.1e2fe14a.js"},{"revision":"7433c4052f86ef5f00a7abe298edcdc4","url":"assets/js/2ae17008.b6fb38a0.js"},{"revision":"efab24ed7cd7f4d77293b31aea01dbca","url":"assets/js/2e81e74f.72bf63cc.js"},{"revision":"dc3b30f0da8e28b6f47c0c2a0cf0232a","url":"assets/js/30388853.4a389d8b.js"},{"revision":"5bc9c34bdcf62bf58515737e82d61c8a","url":"assets/js/327b6d8e.a792b02a.js"},{"revision":"99eb6c56191611a66956bf731bd4f3d8","url":"assets/js/33a5adb4.da7594a1.js"},{"revision":"87707d56b8b55c6aa7f5cb2a3e32325c","url":"assets/js/357d33d4.016ccac9.js"},{"revision":"65f77482ce4ef0ef3d4faa72dce9e467","url":"assets/js/388d3430.e737585e.js"},{"revision":"d98fced288ff4a40ccc62affe476ddbb","url":"assets/js/3b270bcb.d3a960d4.js"},{"revision":"7bcf98673f6a55b4f00851b8d1909e70","url":"assets/js/3c7caf67.de9cda30.js"},{"revision":"ad0d2ec4867b39d0934274bc4cc6b791","url":"assets/js/407f8801.47c8babd.js"},{"revision":"f9ffeac344419651a6a292bd6e2af614","url":"assets/js/433cefd8.811b4e4b.js"},{"revision":"14cbc9094d2f6df4ed0e846bd8a5ec61","url":"assets/js/4351d34b.d303a2d1.js"},{"revision":"e710893f2c41dafc50c3c2ab832cbeb1","url":"assets/js/44821296.31f97174.js"},{"revision":"837717eb40781f2f48b899a5a7171b43","url":"assets/js/44b4d73b.fce6c49e.js"},{"revision":"6d01dbd11ef2818a4264f7bedc363bae","url":"assets/js/47c825a2.cec4acbf.js"},{"revision":"3a5915fcc17c9c3e5066bb427e3a5c24","url":"assets/js/47cccd8d.034e13f6.js"},{"revision":"460a042a824a0eba81be08be4f40ed7c","url":"assets/js/48dd39e2.23402173.js"},{"revision":"69855eadaa73b7460b9bb61c61eaa203","url":"assets/js/4941928a.987af661.js"},{"revision":"d788872a31a07ab94490638be823cc15","url":"assets/js/494f4f5e.5f51525d.js"},{"revision":"cba8735500144b1d1c3e5d3a76a03487","url":"assets/js/4b3f866b.0d5003f7.js"},{"revision":"09e8864af3f849a85c0601ddd87877d5","url":"assets/js/4e0c07c5.eac8a70f.js"},{"revision":"776d27d85e29219b9397ab6788aec0ea","url":"assets/js/51d67042.940d81a8.js"},{"revision":"5c728d07b5f0e1b346618b75ae48e0ea","url":"assets/js/5253afba.caa0464d.js"},{"revision":"2a4fe5c1100325a78ad202a2ae0cc046","url":"assets/js/54071611.0c97ca50.js"},{"revision":"6b279ac2815906cb631c6c89e10d6bd4","url":"assets/js/5465ebbc.0cf559d5.js"},{"revision":"9e1b02881fd476762801c1674d824640","url":"assets/js/54f44165.93cf3ebf.js"},{"revision":"738cba36206ed339ca8041b2a21c904c","url":"assets/js/5635425a.bba12edf.js"},{"revision":"88dd64541056f76f4abf387e941e2422","url":"assets/js/5691.f523bf42.js"},{"revision":"aa94e957fe3739eda6aa4d4f924ff1f5","url":"assets/js/56acf0ae.afcb0a82.js"},{"revision":"0df29271aa097e0bc3f0f3ca4b03da43","url":"assets/js/58f4fbf7.4de8f557.js"},{"revision":"468466d02c94c5723f5d8c713c5ea741","url":"assets/js/5ae6b2db.2ada3389.js"},{"revision":"ad54471e97c57cfdb37ce5dc2b2a08b8","url":"assets/js/5b125e0e.b9d894f0.js"},{"revision":"34cbd8922eea44476a4902f86ffcb50b","url":"assets/js/5b1cb890.dd9ccb6e.js"},{"revision":"7a45409c4337a04672283d5ac4e41655","url":"assets/js/5d23d50c.f2043806.js"},{"revision":"528fb6c6bc4b6c1c577d7d9299d43d50","url":"assets/js/5e95c892.5227adc5.js"},{"revision":"d53ec643e0ba3aeb4a51a3cd79a929d0","url":"assets/js/5ee9d842.78f8f27b.js"},{"revision":"07bcd52b7b2effc255296dd9c569a225","url":"assets/js/5f85402d.53f0bb2a.js"},{"revision":"a1e33b38c0f10c7aac132f43a96a939d","url":"assets/js/6059e070.024aac93.js"},{"revision":"9aa4f509057554701044f6c4af1c3b57","url":"assets/js/6266f1ba.fd3bdaf0.js"},{"revision":"984324913f28c3e8d2141af9be1ef98a","url":"assets/js/63150b11.f5130b32.js"},{"revision":"4c943118994e1f2feabd283edea1e263","url":"assets/js/6368.21689f03.js"},{"revision":"847efb9941a9da84c74735c1a45c511b","url":"assets/js/651850eb.3203f10b.js"},{"revision":"c17ef8583f8af9327ec39e94fd8c86cb","url":"assets/js/6608151e.d6012343.js"},{"revision":"51e7070a148a09becd2591c340439986","url":"assets/js/68240572.4abb7551.js"},{"revision":"7a92880ae9f961df9c26718259265f3e","url":"assets/js/68e3f1d5.e94951ee.js"},{"revision":"2e9e8b668144e9e138842905d9a3286f","url":"assets/js/6916680a.bd1707c0.js"},{"revision":"ef9bb894b4307420f01e9e4e9b99b960","url":"assets/js/6a6dcee7.f491b0e8.js"},{"revision":"cad676711fbe3e5b12aca23348889b8d","url":"assets/js/6d1ddfa7.eec75fa6.js"},{"revision":"264cbaf2b6cfcdd023c24d9592ffe863","url":"assets/js/6f809103.be235bda.js"},{"revision":"7e0c4eceaea8122e676b67c43bbe4b91","url":"assets/js/710ad8a9.3d148adf.js"},{"revision":"83fab1ce221423201e700541f25259c6","url":"assets/js/72f058d3.64fb9f56.js"},{"revision":"96c3015a3edb1dfc7e240fdeb183e44c","url":"assets/js/732c3ce9.9d6521cf.js"},{"revision":"e257985da5173be5fd84ac9bad4fb9a3","url":"assets/js/79ea3e73.75325dd6.js"},{"revision":"c9e41194122e1fbb4150abcabecff43c","url":"assets/js/7aeeadd4.b225a810.js"},{"revision":"af75fc4fe8aa5db377000c420880f9b0","url":"assets/js/7d7dbec2.c7cd48e8.js"},{"revision":"61fb06f73c727372bcec1f2bd798971c","url":"assets/js/80b4c599.261e4d2d.js"},{"revision":"ae316f48e008602629b6dcd8d8093a90","url":"assets/js/85e14910.87c74441.js"},{"revision":"513ef70a04b440a0699c33a0d1506ed6","url":"assets/js/8665e647.d63ea67b.js"},{"revision":"66ed106347a8b14dabb7cc67cc84c948","url":"assets/js/8913.83bce4ad.js"},{"revision":"b73405e3d7356cce2c902749b1974e25","url":"assets/js/8afa1348.be179ee9.js"},{"revision":"2ae1ba192d49320c8c40320b923589f1","url":"assets/js/8b263414.5e9b72ee.js"},{"revision":"4d7708b764c59b778c441114b96dbefb","url":"assets/js/8e1736e0.20c92fa9.js"},{"revision":"b9399c142f0b3cf598b9b3a2cdd1834b","url":"assets/js/8f3baa16.eedf606f.js"},{"revision":"c1b560b2a669c2e3410ddb4dd816e017","url":"assets/js/915eea02.bb6bc5ce.js"},{"revision":"0c6a44ce2706f80eb1d694232a5c7b5e","url":"assets/js/9251a350.db2cbcb1.js"},{"revision":"21b1d048ad3b4f5f3eb16c64fabb5208","url":"assets/js/93f0793d.11aaa541.js"},{"revision":"6f49fef70cf480453cdd10bd816b35a6","url":"assets/js/9462.284a2c7b.js"},{"revision":"6e21ffe48fa91efc665a4c6acff00763","url":"assets/js/95451dd5.9ac91751.js"},{"revision":"f5554d5b07e9c6dedf8a447cbaaaaf7b","url":"assets/js/9730.144f0feb.js"},{"revision":"91d74a4e7edfede5edef49db53b629bf","url":"assets/js/9798ce17.9f5df379.js"},{"revision":"8ffed533b1d53c4d19b775a80a83e2db","url":"assets/js/9828.03c26e5d.js"},{"revision":"5bfd4657c61a7bbbd7b74d76a7576ceb","url":"assets/js/9903dc99.85f43b2f.js"},{"revision":"a537731d4dedda5e7824c60e5a99cbba","url":"assets/js/9a2fa73a.ef8612ec.js"},{"revision":"2e8f22960df5084ea0618ee0cf735318","url":"assets/js/9bc9e25c.c9f71c3d.js"},{"revision":"178ec1e4865bd837929fadf413160a6c","url":"assets/js/9d48492b.b8c10d9a.js"},{"revision":"e273d878cab818567fce6c88b039433e","url":"assets/js/9fc1d339.231cb785.js"},{"revision":"4d4aa32fd0b5d9adb0a94221fd0b6a0f","url":"assets/js/a05464cd.b42f96f6.js"},{"revision":"a36f87c7b1fe22d58d671cfc05dd7384","url":"assets/js/a09c2993.1d3055e0.js"},{"revision":"5b33f687f65aa5f314aea8bebac38319","url":"assets/js/a389e28e.d95c09f9.js"},{"revision":"b0286d93b8f0c7533c616fc543923a10","url":"assets/js/a7456010.7b4b0a20.js"},{"revision":"41d3357d6f23e7050602d15813f6e458","url":"assets/js/a74b641e.c778c318.js"},{"revision":"22631607a5ef8f16d870150ce423b589","url":"assets/js/a7bd4aaa.f0be55e8.js"},{"revision":"c6f2e17a7e731938f9aad872e18275ed","url":"assets/js/a7d04da7.92ad4b1c.js"},{"revision":"b95fb8c204b42463a16d7f5c3ed1b0d5","url":"assets/js/a7d61b99.d79ff599.js"},{"revision":"06fbd06cf475ca2be0656ad6beb063f3","url":"assets/js/a89007e0.e6910c63.js"},{"revision":"df122347a46cb5412f09a6b607ae4ca8","url":"assets/js/a94703ab.5a426d96.js"},{"revision":"4d699bf77cc500402a056bf774853ed0","url":"assets/js/a9789633.ba5010f0.js"},{"revision":"72b698dc021b2b16f844359269812288","url":"assets/js/aa079c8b.6e9216b4.js"},{"revision":"4b24fa32759e808aef53af236dabe318","url":"assets/js/aad144a3.581d5e11.js"},{"revision":"aea484d67c6257fde3fbb92a0235e7b5","url":"assets/js/aba21aa0.9ac6642b.js"},{"revision":"109f968367df37eccdd6ee36e4745ec0","url":"assets/js/adb64ee2.a262d5b4.js"},{"revision":"76a5319f73ea44c564472c3c2d51b509","url":"assets/js/af572879.4cc2ec36.js"},{"revision":"47083cd5a7e09d6bbe1a544e0bbed05d","url":"assets/js/afba4106.0969fa6f.js"},{"revision":"055c76ba5f11d42eafb106cc347675b2","url":"assets/js/b2161dc5.e0f04e03.js"},{"revision":"2f5f94ae9f596bdd4e0e4a92513563d5","url":"assets/js/b4c5bdfe.29fd6207.js"},{"revision":"f8bf0a6d1fe004d7aee99f646eb12045","url":"assets/js/b647df5a.3c8c159b.js"},{"revision":"9000993175cc962ac9d55dea5d887a1c","url":"assets/js/b83f237d.e714b26f.js"},{"revision":"6ace4bccaf69ba6f6c58fcd7f09d6f8f","url":"assets/js/bb70b9c8.eed402bb.js"},{"revision":"3270ac5f92194036d72c345e782fd1bf","url":"assets/js/c00c612c.d919a0b2.js"},{"revision":"64d6060b5783edce03bcf6b709a0a4c7","url":"assets/js/c141421f.94fe8bc5.js"},{"revision":"6139c021c17988c437c1ee6d93201e5a","url":"assets/js/c1865e7c.279e0d2b.js"},{"revision":"52eacc26dfa59ea01c0ca798456561d2","url":"assets/js/c1bdbc58.9d4617ce.js"},{"revision":"134a623a96f3e2a5861a2c2bace329c3","url":"assets/js/c44fa306.ef143eab.js"},{"revision":"d10d08370f9424f08e85ee44c2fbacc6","url":"assets/js/c49413db.ce0f734b.js"},{"revision":"a3c1e68f22958807c9f4df38cfb01d88","url":"assets/js/c4ba122c.e20af9ef.js"},{"revision":"01d4e9780e7686b491ea355c4a545d46","url":"assets/js/c62dfc48.365183b8.js"},{"revision":"fbad9d2f1a5099fb4c6de95d23a972df","url":"assets/js/c7279284.f7c6a82e.js"},{"revision":"70ce683d68246e3be49a4a2990c8fcde","url":"assets/js/c9f7f11b.c8d58cc9.js"},{"revision":"b490bcfff00e4cc0d215e33c77c549c2","url":"assets/js/cd9c57cb.dccd457f.js"},{"revision":"41850b20281fc8617511808e6deffae6","url":"assets/js/d069ae84.9a63b295.js"},{"revision":"ffff3edd26079e93e33bbccd38184e34","url":"assets/js/d19b9e8a.629e3e46.js"},{"revision":"2a820a2cbda71497459366474acf5b8d","url":"assets/js/d1b207fe.5f201ca7.js"},{"revision":"06da3ed9e5ffee61f0cafc72c4605f1d","url":"assets/js/d2df711a.695c325b.js"},{"revision":"1674a36a418d33063e68ea21ac86926d","url":"assets/js/d30d9744.477fbc7c.js"},{"revision":"e169de96b8dee8f780103571d0124d29","url":"assets/js/d4836a8e.7c5ead09.js"},{"revision":"f0e75dc173ffaf4b76521f8486fc177c","url":"assets/js/d720bb60.685933de.js"},{"revision":"becc82e2ea8e6d359072d405ea3d5bca","url":"assets/js/d9330f66.04da02d0.js"},{"revision":"6d70733c2dda8691d98e5b2fe3951eae","url":"assets/js/d957c22b.8cc61010.js"},{"revision":"0fe865c1c7e0a086d71fa2e6da9c987f","url":"assets/js/daab97c5.9a3b2179.js"},{"revision":"25d623bd6a7f525e79261fe61657172b","url":"assets/js/dc033a20.9d70ff8c.js"},{"revision":"4cd1ad0dad3b588df39a18d42fee9da8","url":"assets/js/dd1da75d.e12469a5.js"},{"revision":"92febe83ad8c708d508b8af473d1a966","url":"assets/js/dd8b0175.869182ee.js"},{"revision":"71b015ea914061780c2cfc6f54d8baff","url":"assets/js/df70a34a.201b89c1.js"},{"revision":"347bd9805f7e008eda61c971eb3215d4","url":"assets/js/dff5aaca.23b97e4b.js"},{"revision":"16e54bde08c7016c9d144dd2b3d1184a","url":"assets/js/e0a3f9c8.842f8c29.js"},{"revision":"5615ad4abbed3c088f7346032b4650f2","url":"assets/js/e1715838.0954cdaf.js"},{"revision":"8887fe4152a0e7672cc27b357230acf2","url":"assets/js/e36b815f.28711f06.js"},{"revision":"bac94abf0860ce49385c418da8eb9c66","url":"assets/js/e59053ae.3b71f4c4.js"},{"revision":"63c0e018953014234b71a30143e5a389","url":"assets/js/e5a27df7.b9c2bdee.js"},{"revision":"41f72fbbfc1c64be395fa5f84de1da9b","url":"assets/js/ea131d77.93990663.js"},{"revision":"126849e7c5ad540d23dfacd679c5d109","url":"assets/js/eabdbf07.41728050.js"},{"revision":"19d6139052c688a20eec9ff20716b9fb","url":"assets/js/eae657ee.c98b4b06.js"},{"revision":"95318724641fc4e9743a76a98db6f0b2","url":"assets/js/ebf39289.3821314c.js"},{"revision":"6cde1a03839468912e8ae6534a792186","url":"assets/js/ec1d9510.dc9d9713.js"},{"revision":"f4ea39375c5e7f1ff907300f27dccc48","url":"assets/js/ec7d5e88.21848047.js"},{"revision":"7e48cb139ab3f29a4f38ae5a6f2d50ea","url":"assets/js/ecfacc56.c1366c1f.js"},{"revision":"17a7ed0609107ed184597621eb1c594a","url":"assets/js/ef2f3ccd.1b4146ed.js"},{"revision":"e8989d6084b85bce94e22235e535aca5","url":"assets/js/f0447160.3ca4f473.js"},{"revision":"8c2c388ba2c3d2421315d9d4da941c12","url":"assets/js/f14ecac0.20b5ab59.js"},{"revision":"cabe9c123553f155a0f42aa8b56106cb","url":"assets/js/f2ed1a27.fb1768e4.js"},{"revision":"36e1ed08c240d6d43ad0b2761a020cd8","url":"assets/js/f3212b1e.2634897e.js"},{"revision":"e5fe7fb53adf60d66d95d5cdfa99a505","url":"assets/js/f43def45.0f79f52e.js"},{"revision":"0763377aa0719967151b02b671963622","url":"assets/js/f546eb96.51277a34.js"},{"revision":"f54f24bd6cae837ce49adb54eb33ae89","url":"assets/js/f67ebb5d.b58d033a.js"},{"revision":"8ec6f1d0db5565bc8776f4acd5089661","url":"assets/js/f97daad0.563a1806.js"},{"revision":"f2dfa0b11c2b595595622284985b07f1","url":"assets/js/fa17a3e5.80c989de.js"},{"revision":"f3585f4ab5a3bbb38cfeb800c1da0df2","url":"assets/js/fa9f2ace.5b075c64.js"},{"revision":"1839cdaf83be23a5074b7083ada89d08","url":"assets/js/fbd32610.10da846f.js"},{"revision":"1b756f3cf7a3dfd0e58950e40573a805","url":"assets/js/fc80686b.26ca8247.js"},{"revision":"6ec70b0d894cf1f64895469ecea04d64","url":"assets/js/fea96f18.715bd36c.js"},{"revision":"13eb419f9141dcece1f7e682c5f52bfc","url":"assets/js/main.7bd9ef8c.js"},{"revision":"1fac0eec7f4fbcf1c5b527f3e6487dee","url":"assets/js/runtime~main.e6ce19fb.js"},{"revision":"ad4d7a545da20bbf120809e6aad8368b","url":"docs/10.x/getting-started/installation/index.html"},{"revision":"80fab5c78e8e3a03619c49fc9eee87b9","url":"docs/10.x/getting-started/options/index.html"},{"revision":"bea0cf4abaa738663edab1dbe598504c","url":"docs/10.x/getting-started/presets/index.html"},{"revision":"9df3553d325151a7976df6ed6aa4bdd4","url":"docs/10.x/getting-started/test-environment/index.html"},{"revision":"578b3d4fc6cb61ca596d21e2b7494edf","url":"docs/10.x/guides/absolute-imports/index.html"},{"revision":"3d0f2a60554834382aaf871094235332","url":"docs/10.x/guides/angular-ivy/index.html"},{"revision":"63b7d0ef7353e36c989d48b7af74c9ca","url":"docs/10.x/guides/esm-support/index.html"},{"revision":"3a50454e37a14b5f0c4574204f93562a","url":"docs/10.x/guides/jsdom-version/index.html"},{"revision":"7b3b8a76c8e45499c21d47aba5955c5a","url":"docs/10.x/guides/troubleshooting/index.html"},{"revision":"2d8020c1b81785ebf89ef4f50d37cdfb","url":"docs/10.x/guides/using-with-babel/index.html"},{"revision":"541d4b7e004a779ff9412b1f4c73ed46","url":"docs/10.x/index.html"},{"revision":"86268f7841872652fa2402d6c872e150","url":"docs/10.x/processing/index.html"},{"revision":"42873d57ccd9756c2e1e6d2aa833345f","url":"docs/11.0/getting-started/installation/index.html"},{"revision":"acd943b76e3f394cbfc4fcecee61aa42","url":"docs/11.0/getting-started/options/index.html"},{"revision":"390844d0e71c948db71b0db84eb7295b","url":"docs/11.0/getting-started/presets/index.html"},{"revision":"24fe9a12c48d08bb16336a4912a47e3b","url":"docs/11.0/getting-started/test-environment/index.html"},{"revision":"9bbd27a8cc881da888f4b4223983b724","url":"docs/11.0/guides/absolute-imports/index.html"},{"revision":"a3ab7db663fd804b9dee6ef0571d3724","url":"docs/11.0/guides/angular-13+/index.html"},{"revision":"0732e2fca2d9d0f38da0eed1fe87d272","url":"docs/11.0/guides/angular-ivy/index.html"},{"revision":"704baadba9ba04d2d1b537e12fd06bd1","url":"docs/11.0/guides/esm-support/index.html"},{"revision":"b7afa0e8ea1db0e9cee195591c031ee7","url":"docs/11.0/guides/jsdom-version/index.html"},{"revision":"48d5c9240864d544dd2fd6a12c4c39e2","url":"docs/11.0/guides/troubleshooting/index.html"},{"revision":"0ea3826284bb29828551ad72d2ebe91a","url":"docs/11.0/guides/using-with-babel/index.html"},{"revision":"cb9a888d80bdb1b5c9ed253b00ac4243","url":"docs/11.0/index.html"},{"revision":"a710b7eade6d91c7895d3e4ccc703850","url":"docs/11.0/processing/index.html"},{"revision":"7afb2a5c178a7217d0aabd4eed8950cd","url":"docs/11.1/getting-started/installation/index.html"},{"revision":"3e906acc2a14dca73381cf05666516d7","url":"docs/11.1/getting-started/options/index.html"},{"revision":"04ecf84d5b774ea9ffd858f881447da4","url":"docs/11.1/getting-started/presets/index.html"},{"revision":"4f2633026112034a0c1f12731d40d443","url":"docs/11.1/getting-started/test-environment/index.html"},{"revision":"b848e094aa7fdfc5026c7aa3eae76023","url":"docs/11.1/guides/absolute-imports/index.html"},{"revision":"e837ee7c9c96d56f5d382a1b9ee07691","url":"docs/11.1/guides/angular-13+/index.html"},{"revision":"ef9b7bb642c50748adba96966e4d7a33","url":"docs/11.1/guides/angular-ivy/index.html"},{"revision":"f4a36fb32183d7d5c9d1f5e2f3faeec9","url":"docs/11.1/guides/esm-support/index.html"},{"revision":"c4421d0ac81309a39bfea9da3948d372","url":"docs/11.1/guides/jsdom-version/index.html"},{"revision":"003d2c911f547b6aa4f3bbeff97fcd3e","url":"docs/11.1/guides/troubleshooting/index.html"},{"revision":"ec3432d4f3e68d37348048bb337379bc","url":"docs/11.1/guides/using-with-babel/index.html"},{"revision":"eb4788b1519941225cd50532d8c0fbca","url":"docs/11.1/index.html"},{"revision":"443b08e1093b0dc434fdc5f8a2403604","url":"docs/11.1/processing/index.html"},{"revision":"f6918644b28cea880a007e4288140cca","url":"docs/12.0/getting-started/installation/index.html"},{"revision":"9023e19eb5d607d9dd8ee1f73db700f7","url":"docs/12.0/getting-started/options/index.html"},{"revision":"9ef1956c99a108bc2ab9b5cc101cb714","url":"docs/12.0/getting-started/presets/index.html"},{"revision":"09050933cb911532876c6fe9584f81bd","url":"docs/12.0/getting-started/test-environment/index.html"},{"revision":"139005ec5582d010621238c43cffe5b9","url":"docs/12.0/guides/absolute-imports/index.html"},{"revision":"1b972a6034b03201702dc5e4542a8de5","url":"docs/12.0/guides/angular-13+/index.html"},{"revision":"0e6197d81cd83386b9f4feae7fc88a6d","url":"docs/12.0/guides/angular-ivy/index.html"},{"revision":"8c7ebb4fe9093f694bdfa27ede737f3d","url":"docs/12.0/guides/esm-support/index.html"},{"revision":"2bc8d1a871e1758d0eac08e7c91caf14","url":"docs/12.0/guides/jsdom-version/index.html"},{"revision":"0d109511d37c4f867707b2489c334c91","url":"docs/12.0/guides/troubleshooting/index.html"},{"revision":"d25a2f83c21d207c8a06483fda95f0a5","url":"docs/12.0/guides/using-with-babel/index.html"},{"revision":"c95bc2dcf865542e9ae8f70fdcc788fd","url":"docs/12.0/index.html"},{"revision":"95a7e5c0cd1eb5a1944f849bb4a7d78a","url":"docs/12.0/processing/index.html"},{"revision":"e50c1e852e2075fca84023039601e68c","url":"docs/13.0/getting-started/installation/index.html"},{"revision":"c41f7ff5a4c83f41b947e0ee0a1da383","url":"docs/13.0/getting-started/options/index.html"},{"revision":"931c2aa1c081b7d67de838ec68da5d00","url":"docs/13.0/getting-started/presets/index.html"},{"revision":"6d218f0e83811b65e531abb73aad4a4b","url":"docs/13.0/getting-started/test-environment/index.html"},{"revision":"5a00656744dd86052c0741fc3869583b","url":"docs/13.0/guides/absolute-imports/index.html"},{"revision":"bbb80ba12be813236ee995393eee97a0","url":"docs/13.0/guides/angular-13+/index.html"},{"revision":"3e54a872a7427771ed5fb2facf04e987","url":"docs/13.0/guides/angular-ivy/index.html"},{"revision":"20ffce004a955a0b6b3e0140426a2050","url":"docs/13.0/guides/esm-support/index.html"},{"revision":"3b89e57a8be637d0ee843e896bd05545","url":"docs/13.0/guides/jsdom-version/index.html"},{"revision":"64a038a7347e93a006f8ad00b2203a7b","url":"docs/13.0/guides/troubleshooting/index.html"},{"revision":"5e1c2b843751471327f6c0ea653db646","url":"docs/13.0/guides/using-with-babel/index.html"},{"revision":"eca7216e166fbeccb9ca8873cfc755e0","url":"docs/13.0/index.html"},{"revision":"64549ad310c2fa4d7ce0085d60c0ccc1","url":"docs/13.0/processing/index.html"},{"revision":"45ae15f3e2a48b46ba74f1151b9d1146","url":"docs/14.0/getting-started/installation/index.html"},{"revision":"1297ce84660aa2cf6ffbe4702c9f1936","url":"docs/14.0/getting-started/options/index.html"},{"revision":"f50985b82d22de7b85d9c5017919576f","url":"docs/14.0/getting-started/presets/index.html"},{"revision":"21736d222c17fb7c01bb98577642691b","url":"docs/14.0/getting-started/test-environment/index.html"},{"revision":"3cbb25f5a06f98c8d97b999daca78e79","url":"docs/14.0/guides/absolute-imports/index.html"},{"revision":"3e27a6213a1b425c2204d11870b1ce22","url":"docs/14.0/guides/angular-13+/index.html"},{"revision":"e04b35148f82f5ea060aee3672a997cb","url":"docs/14.0/guides/angular-ivy/index.html"},{"revision":"78161a37fc090054b463234fd89f5de2","url":"docs/14.0/guides/esm-support/index.html"},{"revision":"f1506a026d0a75e5222dd3293fcca645","url":"docs/14.0/guides/jsdom-version/index.html"},{"revision":"9f89661fd063b2f2f63a621ce67dfa71","url":"docs/14.0/guides/troubleshooting/index.html"},{"revision":"f568d202d8662af808478b5f3c4c3ec1","url":"docs/14.0/guides/using-with-babel/index.html"},{"revision":"bdeb2f3cfa4b0a9c289514fc48c598a0","url":"docs/14.0/index.html"},{"revision":"255d2b216da889731fb51f5e53b9dd25","url":"docs/14.0/processing/index.html"},{"revision":"1e48c28f20d7a988924c4c23b244c391","url":"docs/14.2/getting-started/installation/index.html"},{"revision":"8833e2d1184f6a89eb777fc4a23ba181","url":"docs/14.2/getting-started/options/index.html"},{"revision":"3b83c8f12c76ee100eb50a889fe62efa","url":"docs/14.2/getting-started/presets/index.html"},{"revision":"2d77a387727b910424c8643588494571","url":"docs/14.2/getting-started/test-environment/index.html"},{"revision":"c9f65d40c5b02a673b44d8625b48ce84","url":"docs/14.2/guides/absolute-imports/index.html"},{"revision":"ea83dba89197c50e7cace8c09af0abf1","url":"docs/14.2/guides/angular-13+/index.html"},{"revision":"79d6cea72f1d4cebfaf397d07794ca19","url":"docs/14.2/guides/angular-ivy/index.html"},{"revision":"369461081a28b2594eab171fc2d40c43","url":"docs/14.2/guides/esm-support/index.html"},{"revision":"9883fafcb1e01965a4fe57ffc4c2dbbb","url":"docs/14.2/guides/jsdom-version/index.html"},{"revision":"b7b63319b7307d8d9222453b9c7ae2d6","url":"docs/14.2/guides/snapshot-testing/index.html"},{"revision":"365c266e830eb3c9ce663561722efb96","url":"docs/14.2/guides/troubleshooting/index.html"},{"revision":"58e748c7b3fcd2a662e7887d41c57d7b","url":"docs/14.2/guides/using-with-babel/index.html"},{"revision":"3700cf27bbfb8dd49dd0c6229ae7da99","url":"docs/14.2/index.html"},{"revision":"de565e4e5711179e897f1c294a6b1698","url":"docs/14.2/processing/index.html"},{"revision":"cd1317de4c01960f9de13ea9cae5a0dd","url":"docs/14.3/getting-started/installation/index.html"},{"revision":"87707c3ed1d2e32ef12c72a3e86c4557","url":"docs/14.3/getting-started/options/index.html"},{"revision":"50f8fba5167ba1fa0124ed11a41eb94e","url":"docs/14.3/getting-started/presets/index.html"},{"revision":"3fd46e66ff009a423b29c095c0eca0ad","url":"docs/14.3/getting-started/test-environment/index.html"},{"revision":"67b631d2fe492d3b442299c70d957321","url":"docs/14.3/guides/absolute-imports/index.html"},{"revision":"3e53109e2661c2dbb25c16003f8fe8e9","url":"docs/14.3/guides/angular-13+/index.html"},{"revision":"cf1fdcb7ad7e0ba47341b847a588dfec","url":"docs/14.3/guides/angular-ivy/index.html"},{"revision":"e26cecc9f6a1e50f2a3e206402cd2dc8","url":"docs/14.3/guides/esm-support/index.html"},{"revision":"46285dacbaaa20c3cf241144fdf94dc5","url":"docs/14.3/guides/jsdom-version/index.html"},{"revision":"5725fc9c42d5ad8d8f534efc9948c59a","url":"docs/14.3/guides/snapshot-testing/index.html"},{"revision":"1fed99afec169e0031a2ceee6b054b0b","url":"docs/14.3/guides/troubleshooting/index.html"},{"revision":"87f811c46cc88a742d166ad9dadfd3ff","url":"docs/14.3/guides/using-with-babel/index.html"},{"revision":"0369875c3d8e296a69c5e29f295769c5","url":"docs/14.3/index.html"},{"revision":"1720b28c311c545f747fa75c7f0c8539","url":"docs/14.3/processing/index.html"},{"revision":"db9ab3318eb7845dc65a97ac41eea4f2","url":"docs/8.x/getting-started/installation/index.html"},{"revision":"f661b808d993810a0a836de9b07f03c7","url":"docs/8.x/getting-started/options/index.html"},{"revision":"8d3fe8827dee06728b7f04848a76d746","url":"docs/8.x/getting-started/presets/index.html"},{"revision":"07d05f8a29f6f92417f340c9f3a66c1c","url":"docs/8.x/getting-started/test-environment/index.html"},{"revision":"445a551224ed768e8973e7650b293d77","url":"docs/8.x/guides/absolute-imports/index.html"},{"revision":"eb3aed18e0415655720e66dcc46d22fe","url":"docs/8.x/guides/angular-ivy/index.html"},{"revision":"513eac72877b1d973a80f564a786c643","url":"docs/8.x/guides/esm-support/index.html"},{"revision":"699029c83ae241108f1a63d0722c2091","url":"docs/8.x/guides/jsdom-version/index.html"},{"revision":"607eb8da3f8b76113683a52358ca594e","url":"docs/8.x/guides/troubleshooting/index.html"},{"revision":"78098a96632b42f36a434a824964bb38","url":"docs/8.x/guides/using-with-babel/index.html"},{"revision":"0e3ba14d45da421b26bd13e8240e380d","url":"docs/8.x/index.html"},{"revision":"d852b3beac4e924cdfc545ae7a8ec428","url":"docs/8.x/processing/index.html"},{"revision":"c0801c5faeb4bead249cae5ac2f70a3d","url":"docs/9.x/getting-started/installation/index.html"},{"revision":"6b5527270058d4382b1e155c2fa71ccb","url":"docs/9.x/getting-started/options/index.html"},{"revision":"89fc487733ca97e0c6d9a10b9ebad408","url":"docs/9.x/getting-started/presets/index.html"},{"revision":"1b6261b37e456109017ce8088ec2050a","url":"docs/9.x/getting-started/test-environment/index.html"},{"revision":"c109ae44ed666ee843c1aa2e5f07b8f5","url":"docs/9.x/guides/absolute-imports/index.html"},{"revision":"388312b1c576b602404c20de4e07c490","url":"docs/9.x/guides/angular-ivy/index.html"},{"revision":"c3ef6c3a213335c0637d443aef18b121","url":"docs/9.x/guides/esm-support/index.html"},{"revision":"89066913d1b1c65f95a5072e651d32cf","url":"docs/9.x/guides/jsdom-version/index.html"},{"revision":"3356851d0b6dcf446f5b050007867412","url":"docs/9.x/guides/troubleshooting/index.html"},{"revision":"fadcb268148a196b556da66cae6a7788","url":"docs/9.x/guides/using-with-babel/index.html"},{"revision":"bccb73ecdd48b11648103f22e0a7e281","url":"docs/9.x/index.html"},{"revision":"855177f37b0755018ae39e4ccc525e3a","url":"docs/9.x/processing/index.html"},{"revision":"e12704f434f6d6739caa34ff63d4f785","url":"docs/getting-started/installation/index.html"},{"revision":"0910e5322d3e18792b0c5732bf470968","url":"docs/getting-started/options/index.html"},{"revision":"6269e3dfffbaed4ac1eaf10277709df8","url":"docs/getting-started/presets/index.html"},{"revision":"1e9bb8560ff7689417d2239a74d50b56","url":"docs/getting-started/test-environment/index.html"},{"revision":"8064eed2113d260f1ce84ec2cbb87468","url":"docs/guides/absolute-imports/index.html"},{"revision":"d478828a182faa915964e3a5e6f2c546","url":"docs/guides/angular-13+/index.html"},{"revision":"e3e260cc1cdc06837223ff1c7fa2d489","url":"docs/guides/angular-ivy/index.html"},{"revision":"7034408c1da9112e6433f6f08a2c8c4d","url":"docs/guides/esm-support/index.html"},{"revision":"040b4015b9ffc9f1e8b33c7ce1f6ef24","url":"docs/guides/jsdom-version/index.html"},{"revision":"5e5d2e242c2da73ea9b8eb1277531b87","url":"docs/guides/snapshot-testing/index.html"},{"revision":"d00489e46d9cf1a2cc4cc9948a425340","url":"docs/guides/troubleshooting/index.html"},{"revision":"e03b812fda0f88c514d95dab856083b9","url":"docs/guides/using-with-babel/index.html"},{"revision":"dd158fe58db9a38d0048e74ceba2abb8","url":"docs/index.html"},{"revision":"f2083c1aa5d3b5b4515772fe3374264a","url":"docs/next/getting-started/installation/index.html"},{"revision":"a9b92ff9be503d4f5f57822083490ad9","url":"docs/next/getting-started/options/index.html"},{"revision":"b39144d536427b0d5734cdaaf37d778c","url":"docs/next/getting-started/presets/index.html"},{"revision":"0c978175f4472404348c364c3849c687","url":"docs/next/getting-started/test-environment/index.html"},{"revision":"4d1785a89953c36e887345fdae9b7bb9","url":"docs/next/guides/absolute-imports/index.html"},{"revision":"4ed3166a19e4088dad380d0210b66b75","url":"docs/next/guides/angular-13+/index.html"},{"revision":"4f35fbb91b15cddc8982d7be9a14ec00","url":"docs/next/guides/angular-ivy/index.html"},{"revision":"7e6106c9de8fde47b8514577ed65a2cd","url":"docs/next/guides/esm-support/index.html"},{"revision":"db71fd0f48e83bf7e288420cf2e51775","url":"docs/next/guides/jsdom-version/index.html"},{"revision":"22e895181b42edba48f962117a5059ef","url":"docs/next/guides/snapshot-testing/index.html"},{"revision":"4d4599bd427731f05c7099ad0c1e85fd","url":"docs/next/guides/troubleshooting/index.html"},{"revision":"554d13376448c0a1d1d8f8883ae8eaab","url":"docs/next/guides/using-with-babel/index.html"},{"revision":"8f0e04dde6f785876212c1c341cce2bd","url":"docs/next/index.html"},{"revision":"0dc5339d21543694c563df3f694833b6","url":"docs/next/processing/index.html"},{"revision":"e949468f6e59a39fea3df97366825c01","url":"docs/processing/index.html"},{"revision":"4a58348a38910edda984915ecd58c22f","url":"index.html"},{"revision":"39d0f7b81200aacb9b15b16745bd2264","url":"manifest.json"},{"revision":"eadb2b04baf97a7314853a05772cb43f","url":"search/index.html"},{"revision":"aba85dd9077a15092892f2aadda76b43","url":"versions/index.html"},{"revision":"f8389ca1a741a115313bede9ac02e2c0","url":"img/discord.svg"},{"revision":"5e0e02d0c0f021b2037ed926d68ea1be","url":"img/documentation.png"},{"revision":"a83841c50aa67da6144860bd5031cc53","url":"img/github.png"},{"revision":"a2552d19b3538a030407a0191c99cae1","url":"img/logo.svg"},{"revision":"ee83b65c3aed4a45b928a4bebeb97a98","url":"img/pull-request.png"},{"revision":"cce226b035fb4ab5eee43b077db1ba4a","url":"img/troubleshooting.png"}],s=new C({fallbackToNetwork:!0});e.offlineMode&&(s.addToCacheList(t),e.debug&&console.log("[Docusaurus-PWA][SW]: addToCacheList",{precacheManifest:t})),await async function(e){}(),self.addEventListener("install",(t=>{e.debug&&console.log("[Docusaurus-PWA][SW]: install event",{event:t}),t.waitUntil(s.install(t))})),self.addEventListener("activate",(t=>{e.debug&&console.log("[Docusaurus-PWA][SW]: activate event",{event:t}),t.waitUntil(s.activate(t))})),self.addEventListener("fetch",(async t=>{if(e.offlineMode){const a=t.request.url,n=function(e){const t=new URL(e,self.location.href);return t.origin!==self.location.origin?[]:(t.search="",t.hash="",[t.href,`${t.href}${t.pathname.endsWith("/")?"":"/"}index.html`])}(a);for(const i of n){const r=s.getCacheKeyForURL(i);if(r){const s=caches.match(r);e.debug&&console.log("[Docusaurus-PWA][SW]: serving cached asset",{requestURL:a,possibleURL:i,possibleURLs:n,cacheKey:r,cachedResponse:s}),t.respondWith(s);break}}}})),self.addEventListener("message",(async t=>{e.debug&&console.log("[Docusaurus-PWA][SW]: message event",{event:t});const s=t.data?.type;"SKIP_WAITING"===s&&self.skipWaiting()}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={136:()=>{try{self["workbox:core:7.0.0"]&&_()}catch(e){}},447:()=>{try{self["workbox:precaching:7.0.0"]&&_()}catch(e){}},227:()=>{try{self["workbox:routing:7.0.0"]&&_()}catch(e){}},390:()=>{try{self["workbox:strategies:7.0.0"]&&_()}catch(e){}}},t={};function s(a){var n=t[a];if(void 0!==n)return n.exports;var i=t[a]={exports:{}};return e[a](i,i.exports,s),i.exports}s(136);const a=(e,...t)=>{let s=e;return t.length>0&&(s+=` :: ${JSON.stringify(t)}`),s};class n extends Error{constructor(e,t){super(a(e,t)),this.name=e,this.details=t}}const i={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},r=e=>[i.prefix,e,i.suffix].filter((e=>e&&e.length>0)).join("-"),c=e=>e||r(i.precache),o=e=>e||r(i.runtime);function h(e,t){const s=t();return e.waitUntil(s),s}s(447);function l(e){if(!e)throw new n("add-to-cache-list-unexpected-type",{entry:e});if("string"==typeof e){const t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}const{revision:t,url:s}=e;if(!s)throw new n("add-to-cache-list-unexpected-type",{entry:e});if(!t){const e=new URL(s,location.href);return{cacheKey:e.href,url:e.href}}const a=new URL(s,location.href),i=new URL(s,location.href);return a.searchParams.set("__WB_REVISION__",t),{cacheKey:a.href,url:i.href}}class u{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)},this.cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:s})=>{if("install"===e.type&&t&&t.originalRequest&&t.originalRequest instanceof Request){const e=t.originalRequest.url;s?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return s}}}class f{constructor({precacheController:e}){this.cacheKeyWillBeUsed=async({request:e,params:t})=>{const s=(null==t?void 0:t.cacheKey)||this._precacheController.getCacheKeyForURL(e.url);return s?new Request(s,{headers:e.headers}):e},this._precacheController=e}}let d;async function p(e,t){let s=null;if(e.url){s=new URL(e.url).origin}if(s!==self.location.origin)throw new n("cross-origin-copy-response",{origin:s});const a=e.clone(),i={headers:new Headers(a.headers),status:a.status,statusText:a.statusText},r=t?t(i):i,c=function(){if(void 0===d){const t=new Response("");if("body"in t)try{new Response(t.body),d=!0}catch(e){d=!1}d=!1}return d}()?a.body:await a.blob();return new Response(c,r)}function g(e,t){const s=new URL(e);for(const a of t)s.searchParams.delete(a);return s.href}class y{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}const w=new Set;s(390);function v(e){return"string"==typeof e?new Request(e):e}class m{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new y,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(const s of this._plugins)this._pluginStateMap.set(s,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){const{event:t}=this;let s=v(e);if("navigate"===s.mode&&t instanceof FetchEvent&&t.preloadResponse){const e=await t.preloadResponse;if(e)return e}const a=this.hasCallback("fetchDidFail")?s.clone():null;try{for(const e of this.iterateCallbacks("requestWillFetch"))s=await e({request:s.clone(),event:t})}catch(r){if(r instanceof Error)throw new n("plugin-error-request-will-fetch",{thrownErrorMessage:r.message})}const i=s.clone();try{let e;e=await fetch(s,"navigate"===s.mode?void 0:this._strategy.fetchOptions);for(const s of this.iterateCallbacks("fetchDidSucceed"))e=await s({event:t,request:i,response:e});return e}catch(c){throw a&&await this.runCallbacks("fetchDidFail",{error:c,event:t,originalRequest:a.clone(),request:i.clone()}),c}}async fetchAndCachePut(e){const t=await this.fetch(e),s=t.clone();return this.waitUntil(this.cachePut(e,s)),t}async cacheMatch(e){const t=v(e);let s;const{cacheName:a,matchOptions:n}=this._strategy,i=await this.getCacheKey(t,"read"),r=Object.assign(Object.assign({},n),{cacheName:a});s=await caches.match(i,r);for(const c of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await c({cacheName:a,matchOptions:n,cachedResponse:s,request:i,event:this.event})||void 0;return s}async cachePut(e,t){const s=v(e);var a;await(a=0,new Promise((e=>setTimeout(e,a))));const i=await this.getCacheKey(s,"write");if(!t)throw new n("cache-put-with-no-response",{url:(r=i.url,new URL(String(r),location.href).href.replace(new RegExp(`^${location.origin}`),""))});var r;const c=await this._ensureResponseSafeToCache(t);if(!c)return!1;const{cacheName:o,matchOptions:h}=this._strategy,l=await self.caches.open(o),u=this.hasCallback("cacheDidUpdate"),f=u?await async function(e,t,s,a){const n=g(t.url,s);if(t.url===n)return e.match(t,a);const i=Object.assign(Object.assign({},a),{ignoreSearch:!0}),r=await e.keys(t,i);for(const c of r)if(n===g(c.url,s))return e.match(c,a)}(l,i.clone(),["__WB_REVISION__"],h):null;try{await l.put(i,u?c.clone():c)}catch(d){if(d instanceof Error)throw"QuotaExceededError"===d.name&&await async function(){for(const e of w)await e()}(),d}for(const n of this.iterateCallbacks("cacheDidUpdate"))await n({cacheName:o,oldResponse:f,newResponse:c.clone(),request:i,event:this.event});return!0}async getCacheKey(e,t){const s=`${e.url} | ${t}`;if(!this._cacheKeys[s]){let a=e;for(const e of this.iterateCallbacks("cacheKeyWillBeUsed"))a=v(await e({mode:t,request:a,event:this.event,params:this.params}));this._cacheKeys[s]=a}return this._cacheKeys[s]}hasCallback(e){for(const t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(const s of this.iterateCallbacks(e))await s(t)}*iterateCallbacks(e){for(const t of this._strategy.plugins)if("function"==typeof t[e]){const s=this._pluginStateMap.get(t),a=a=>{const n=Object.assign(Object.assign({},a),{state:s});return t[e](n)};yield a}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,s=!1;for(const a of this.iterateCallbacks("cacheWillUpdate"))if(t=await a({request:this.request,response:t,event:this.event})||void 0,s=!0,!t)break;return s||t&&200!==t.status&&(t=void 0),t}}class R{constructor(e={}){this.cacheName=o(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){const[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});const t=e.event,s="string"==typeof e.request?new Request(e.request):e.request,a="params"in e?e.params:void 0,n=new m(this,{event:t,request:s,params:a}),i=this._getResponse(n,s,t);return[i,this._awaitComplete(i,n,s,t)]}async _getResponse(e,t,s){let a;await e.runCallbacks("handlerWillStart",{event:s,request:t});try{if(a=await this._handle(t,e),!a||"error"===a.type)throw new n("no-response",{url:t.url})}catch(i){if(i instanceof Error)for(const n of e.iterateCallbacks("handlerDidError"))if(a=await n({error:i,event:s,request:t}),a)break;if(!a)throw i}for(const n of e.iterateCallbacks("handlerWillRespond"))a=await n({event:s,request:t,response:a});return a}async _awaitComplete(e,t,s,a){let n,i;try{n=await e}catch(i){}try{await t.runCallbacks("handlerDidRespond",{event:a,request:s,response:n}),await t.doneWaiting()}catch(r){r instanceof Error&&(i=r)}if(await t.runCallbacks("handlerDidComplete",{event:a,request:s,response:n,error:i}),t.destroy(),i)throw i}}class b extends R{constructor(e={}){e.cacheName=c(e.cacheName),super(e),this._fallbackToNetwork=!1!==e.fallbackToNetwork,this.plugins.push(b.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){const s=await t.cacheMatch(e);return s||(t.event&&"install"===t.event.type?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,t){let s;const a=t.params||{};if(!this._fallbackToNetwork)throw new n("missing-precache-entry",{cacheName:this.cacheName,url:e.url});{0;const n=a.integrity,i=e.integrity,r=!i||i===n;if(s=await t.fetch(new Request(e,{integrity:"no-cors"!==e.mode?i||n:void 0})),n&&r&&"no-cors"!==e.mode){this._useDefaultCacheabilityPluginIfNeeded();await t.cachePut(e,s.clone());0}}return s}async _handleInstall(e,t){this._useDefaultCacheabilityPluginIfNeeded();const s=await t.fetch(e);if(!await t.cachePut(e,s.clone()))throw new n("bad-precaching-response",{url:e.url,status:s.status});return s}_useDefaultCacheabilityPluginIfNeeded(){let e=null,t=0;for(const[s,a]of this.plugins.entries())a!==b.copyRedirectedCacheableResponsesPlugin&&(a===b.defaultPrecacheCacheabilityPlugin&&(e=s),a.cacheWillUpdate&&t++);0===t?this.plugins.push(b.defaultPrecacheCacheabilityPlugin):t>1&&null!==e&&this.plugins.splice(e,1)}}b.defaultPrecacheCacheabilityPlugin={cacheWillUpdate:async({response:e})=>!e||e.status>=400?null:e},b.copyRedirectedCacheableResponsesPlugin={cacheWillUpdate:async({response:e})=>e.redirected?await p(e):e};class C{constructor({cacheName:e,plugins:t=[],fallbackToNetwork:s=!0}={}){this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new b({cacheName:c(e),plugins:[...t,new f({precacheController:this})],fallbackToNetwork:s}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this._installAndActiveListenersAdded=!0)}addToCacheList(e){const t=[];for(const s of e){"string"==typeof s?t.push(s):s&&void 0===s.revision&&t.push(s.url);const{cacheKey:e,url:a}=l(s),i="string"!=typeof s&&s.revision?"reload":"default";if(this._urlsToCacheKeys.has(a)&&this._urlsToCacheKeys.get(a)!==e)throw new n("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(a),secondEntry:e});if("string"!=typeof s&&s.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==s.integrity)throw new n("add-to-cache-list-conflicting-integrities",{url:a});this._cacheKeysToIntegrities.set(e,s.integrity)}if(this._urlsToCacheKeys.set(a,e),this._urlsToCacheModes.set(a,i),t.length>0){const e=`Workbox is precaching URLs without revision info: ${t.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(e)}}}install(e){return h(e,(async()=>{const t=new u;this.strategy.plugins.push(t);for(const[n,i]of this._urlsToCacheKeys){const t=this._cacheKeysToIntegrities.get(i),s=this._urlsToCacheModes.get(n),a=new Request(n,{integrity:t,cache:s,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:i},request:a,event:e}))}const{updatedURLs:s,notUpdatedURLs:a}=t;return{updatedURLs:s,notUpdatedURLs:a}}))}activate(e){return h(e,(async()=>{const e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),s=new Set(this._urlsToCacheKeys.values()),a=[];for(const n of t)s.has(n.url)||(await e.delete(n),a.push(n.url));return{deletedURLs:a}}))}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){const t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){const t=e instanceof Request?e.url:e,s=this.getCacheKeyForURL(t);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(e){const t=this.getCacheKeyForURL(e);if(!t)throw new n("non-precached-url",{url:e});return s=>(s.request=new Request(e),s.params=Object.assign({cacheKey:t},s.params),this.strategy.handle(s))}}s(227);(async()=>{const e=function(){const e=JSON.parse(new URLSearchParams(self.location.search).get("params"));return e.debug&&console.log("[Docusaurus-PWA][SW]: Service Worker params:",e),e}(),t=[{"revision":"9a78bb2bfa637f093a08b2599d78ac88","url":"404.html"},{"revision":"0f5dab3ab27be51c0fc4159b965ac564","url":"assets/css/styles.73165556.css"},{"revision":"5e6e5636a7b02eaa89d97b8cc758bf28","url":"assets/js/029bedf1.5c086163.js"},{"revision":"b73086c3152dae96e4990b9b64b20d47","url":"assets/js/02a1e558.3695ef1c.js"},{"revision":"22b16efcd318bb427353198feda018bd","url":"assets/js/03be7dae.e6cf5ed1.js"},{"revision":"5c300fc4a4ca987f4840da4434ce39b6","url":"assets/js/04ae74d1.415e8c45.js"},{"revision":"65da5cffcc2b3193e1ead141b258b3be","url":"assets/js/04b3fc6c.0ae6bbb7.js"},{"revision":"428972d40253290de20ce16cb8794a54","url":"assets/js/05916282.a686b861.js"},{"revision":"4a6b8cc97a155821fd6f3cdf9522d041","url":"assets/js/08804573.542b86a7.js"},{"revision":"20912486e87a4092e0220d1109158666","url":"assets/js/097bb47a.e3aa4bf2.js"},{"revision":"6aa860347a56374505122b3bc5106bb7","url":"assets/js/09df063d.e4ecd33e.js"},{"revision":"94bd468288200baed3ddd8d4a9cb7c4e","url":"assets/js/0d71a3f1.bb603643.js"},{"revision":"3db2bb8729202ee013ddf9815995f3d0","url":"assets/js/0dc350cc.701cfe13.js"},{"revision":"d2ed0a7d00e7b3397d6a7d90b52008b0","url":"assets/js/0e35f71d.4f1b452c.js"},{"revision":"3d603eaf40daa7692471f2a1f10ca8b7","url":"assets/js/13973f06.e6f985d5.js"},{"revision":"dc6680874b6ea93ea6bf9a852918a987","url":"assets/js/1438ea8f.38a1d8c7.js"},{"revision":"d8f6bf79c9a8681d7beb4ae619ce7ec1","url":"assets/js/14b133ce.68259f60.js"},{"revision":"0e64ede85c4df8035d5af6286cc334c9","url":"assets/js/151633a5.435147e0.js"},{"revision":"e578a508dbcbbf47bb4ed6457bcf7688","url":"assets/js/15a051c9.63f493b4.js"},{"revision":"33b0fceab67f4b4c126ca757a76426d1","url":"assets/js/164a8de7.cd7de8b4.js"},{"revision":"9bd272e4a78dc8f8492867355c7f626e","url":"assets/js/17896441.bc529dae.js"},{"revision":"765960dc184e26311917718584e2aaad","url":"assets/js/1a421168.f7ed44e7.js"},{"revision":"33bcf7edb246458f6d99cd25db3bf498","url":"assets/js/1a4e3797.0f622ad9.js"},{"revision":"f1d785f5a5177dcb3571c036771d1ff7","url":"assets/js/1a5572f6.6ebec477.js"},{"revision":"6c0b9bf08557de3f6503be1c6126ccc9","url":"assets/js/1d8e39f8.de7224df.js"},{"revision":"70199817ead75b1af908c3338cfa120e","url":"assets/js/1df93b7f.9d5da231.js"},{"revision":"c22890b12d8cf81e9d9caee4f1bfd428","url":"assets/js/1e388ac9.ea3c7fd8.js"},{"revision":"ba87cf97403b0db903e190eb400d9765","url":"assets/js/203fc93e.bdb97e17.js"},{"revision":"f0644907bbc95ea414fc2c5503c08fd5","url":"assets/js/2237.c581d9e3.js"},{"revision":"c9311f93464fafcd8b6a062aa073f2f9","url":"assets/js/22e4d634.6f42655d.js"},{"revision":"46f6bf4c343a503b98a67e5b8bf64cfd","url":"assets/js/2362.a90cc913.js"},{"revision":"388901dd6338d37396ef1d7e2d47981e","url":"assets/js/252e2b80.534b45e9.js"},{"revision":"2ca72c693b368876ffbfe442ad115ef4","url":"assets/js/25e9e857.b319aa84.js"},{"revision":"d72a6922d5ac7d7e3a65690acfe7d5f5","url":"assets/js/26cb42b7.9b793bb7.js"},{"revision":"97f575a967847757c5a3489a7f93a76f","url":"assets/js/27299a3b.22bdc7e3.js"},{"revision":"ff88c046d332f26f80a10118113c00c1","url":"assets/js/27af8d7b.85d2d0c3.js"},{"revision":"1e815b44964917e16b5451ea558aaaf5","url":"assets/js/29d26392.11552c90.js"},{"revision":"085565e0fa084523597e3445217c02e7","url":"assets/js/2a474b18.80846051.js"},{"revision":"f0f275bbde7e371fef56625da23627c8","url":"assets/js/2ab18ce5.89cd24ce.js"},{"revision":"1c2bc952de6d5d2d1daaadef9b2eaaca","url":"assets/js/2ae17008.ef1cd84b.js"},{"revision":"615c0bffe3a50d7907a902dac288907e","url":"assets/js/2e81e74f.1eaa47fd.js"},{"revision":"99c8019ba3f2ac29ab10b4ce38c4754a","url":"assets/js/30388853.16698a7a.js"},{"revision":"658e48c55f81fc6558611145ae8ee2cc","url":"assets/js/327b6d8e.f4a93af4.js"},{"revision":"38142942991034d0be6b11a69f7f87fc","url":"assets/js/33a5adb4.15cf890c.js"},{"revision":"993eddbb63854a99978baf32c89f25c9","url":"assets/js/357d33d4.136d1448.js"},{"revision":"6ed0f2b50b69bedf4ff34c3b5c195e23","url":"assets/js/388d3430.b1604206.js"},{"revision":"45d3feb9e34e7d56b76198e86cff6c9d","url":"assets/js/3b270bcb.8655ff4b.js"},{"revision":"a5b15eb23475f5de6f19c9f7e3be498c","url":"assets/js/3c7caf67.88462c2e.js"},{"revision":"5f1ee701817bc1f6a3bab01ce9d0dae3","url":"assets/js/407f8801.0db5cbe9.js"},{"revision":"c3513288c8dd2fe0be2ff40de9ee9024","url":"assets/js/416.36a683d5.js"},{"revision":"d44856ecba04b66f215028315b4c3650","url":"assets/js/4334.0bfa0a25.js"},{"revision":"8011f2821c0442f6718ef1240dec6f38","url":"assets/js/433cefd8.18f9a6b3.js"},{"revision":"4f22c65de4e91cf5ff265f4ad4092a60","url":"assets/js/4351d34b.e150e3f4.js"},{"revision":"381703345d573670c86d6aab70d6a62f","url":"assets/js/44821296.1e9cc76b.js"},{"revision":"29231062cd4605a35b5aedbec966b696","url":"assets/js/44b4d73b.ae997243.js"},{"revision":"b452e239fadba205c9ded504c78d7ba1","url":"assets/js/47c825a2.b7d8bd79.js"},{"revision":"465fe59568d81c9c1b8f9ae8906f6c05","url":"assets/js/47cccd8d.aef5dc41.js"},{"revision":"a1d54a5b18a39e819cdf3865121c975b","url":"assets/js/48dd39e2.2d081c36.js"},{"revision":"81fc52dca5f83dfcc53289e8ad436189","url":"assets/js/4941928a.6d853ed2.js"},{"revision":"be5ba07f3339b4acc4c3c7cd2496b728","url":"assets/js/494f4f5e.bb0900b0.js"},{"revision":"7cfacb14e341fc114830573fba97fb21","url":"assets/js/4b3f866b.a99cf192.js"},{"revision":"c78902a07fc0c755cf89951161394a71","url":"assets/js/4e0c07c5.4c5cce2f.js"},{"revision":"ae695f8ed436086ea032f72dc3b9e0a8","url":"assets/js/51d67042.09e30cff.js"},{"revision":"8c7759193c97905e69d3e17bea050699","url":"assets/js/5253afba.6e93956b.js"},{"revision":"ee88cfa201b26f6b52dbe78a5499c662","url":"assets/js/54071611.05faf7f7.js"},{"revision":"eacb7ca31b89ba7f0eae5a88204aad14","url":"assets/js/5465ebbc.e27bdab3.js"},{"revision":"ae0ca807078b3c0c9cd4988a333534a7","url":"assets/js/54f44165.5995fb4f.js"},{"revision":"07c69057c658ae3540fe63e6c6b15397","url":"assets/js/5635425a.7e3fe4b7.js"},{"revision":"410ea9149fe4f9c602859230f069a062","url":"assets/js/56acf0ae.5b78e041.js"},{"revision":"0df29271aa097e0bc3f0f3ca4b03da43","url":"assets/js/58f4fbf7.4de8f557.js"},{"revision":"de6e2342a1e15701c9086c594464689c","url":"assets/js/5ae6b2db.a5d48355.js"},{"revision":"3e7a513afe397b1921d661285ce763a5","url":"assets/js/5b125e0e.697a5467.js"},{"revision":"962c7ea53699047229dc97c86c25f6b3","url":"assets/js/5b1cb890.1130ccab.js"},{"revision":"7a45409c4337a04672283d5ac4e41655","url":"assets/js/5d23d50c.f2043806.js"},{"revision":"86a90a225dbc90bdf1e3aa55a17e6d18","url":"assets/js/5e95c892.3981f719.js"},{"revision":"1bf9973a502361734c65d8ca7d07c02f","url":"assets/js/5ee9d842.b7446e8f.js"},{"revision":"95124f616821ff317a40a0abc8506b13","url":"assets/js/5f85402d.42415850.js"},{"revision":"7fada66182ce73820df5847c852e9e08","url":"assets/js/6059e070.a1ff5026.js"},{"revision":"f8d53681452807dfa41b8a464d183dd5","url":"assets/js/6266f1ba.08903fa7.js"},{"revision":"3f814cde2a004450aa84b7dff7e02df8","url":"assets/js/63150b11.42797a50.js"},{"revision":"99b715ffb6f780e2e028366ea3148fd3","url":"assets/js/651850eb.42c01b62.js"},{"revision":"da26cac78063b3ea619034eb99593981","url":"assets/js/6608151e.663dee4c.js"},{"revision":"5a28afe96b84c9ea87a3d2b056af7f65","url":"assets/js/68240572.0e0b55b5.js"},{"revision":"f8f8ae4bd88efcb8285f111f7ff145be","url":"assets/js/68e3f1d5.55912d98.js"},{"revision":"62c05d70c505e1e95849801eb3cc024a","url":"assets/js/6916680a.d798bef1.js"},{"revision":"8292648b3f76473187c1ad9bec98721e","url":"assets/js/6a6dcee7.ab46b1af.js"},{"revision":"fa365c6d152f8558c7dc077e8ac94828","url":"assets/js/6d1ddfa7.d95a92fa.js"},{"revision":"3070873d36e7b736953c1c8b2185c690","url":"assets/js/6f809103.c4f140f6.js"},{"revision":"bf9ca57e715b4695c608207e8683d87d","url":"assets/js/710ad8a9.6a8f363e.js"},{"revision":"dde73b395414150f28702a4fc66c1be6","url":"assets/js/72f058d3.18f8fac5.js"},{"revision":"fe9a1c881617de1361e30d68c04d0e4a","url":"assets/js/732c3ce9.fc9a795c.js"},{"revision":"58f93b255ccadfb4dc6297b45351f946","url":"assets/js/79ea3e73.bbf47963.js"},{"revision":"bb6de72ccdc9a3f999ff4baea42bc87d","url":"assets/js/7aeeadd4.bb4e52e9.js"},{"revision":"af75fc4fe8aa5db377000c420880f9b0","url":"assets/js/7d7dbec2.c7cd48e8.js"},{"revision":"d04256d19e976f6923fcb66c63f07afd","url":"assets/js/80b4c599.9b906aa6.js"},{"revision":"90d472dfa63b4b16118819a90e12f34b","url":"assets/js/8158.900dc11d.js"},{"revision":"b49b0a52a0314181467ea4324e588052","url":"assets/js/85e14910.b3004c42.js"},{"revision":"6a7945ab08ee45b253ac362c7d404aca","url":"assets/js/8665e647.4422a4a5.js"},{"revision":"dd0414674c2d1bd7e888f8cc39f132eb","url":"assets/js/8737.2a18c482.js"},{"revision":"66ed106347a8b14dabb7cc67cc84c948","url":"assets/js/8913.83bce4ad.js"},{"revision":"2fbb76685260e926902b1ac28bcadc3e","url":"assets/js/8afa1348.21501e6a.js"},{"revision":"ac5026bc69e831c8021ea63724907b65","url":"assets/js/8b263414.fd8c1ed5.js"},{"revision":"4d7708b764c59b778c441114b96dbefb","url":"assets/js/8e1736e0.20c92fa9.js"},{"revision":"b2c85b6cfefed0a966b16306b3565271","url":"assets/js/8f3baa16.1830da85.js"},{"revision":"cd7434293e925f85f01bd1b7fcf0b055","url":"assets/js/915eea02.36cf32b2.js"},{"revision":"7db01938ce114e8b29d5f1ebe0f84dd2","url":"assets/js/9251a350.0b393dc5.js"},{"revision":"4e3e28e0b4be2e86bf4cb5539b7e82cc","url":"assets/js/93f0793d.e7cdef71.js"},{"revision":"6ebafb9f319b76c426614a1423b5f6b8","url":"assets/js/95451dd5.59f15bad.js"},{"revision":"f5554d5b07e9c6dedf8a447cbaaaaf7b","url":"assets/js/9730.144f0feb.js"},{"revision":"4608e1b099acceebf6c892ba9a18e926","url":"assets/js/9798ce17.33b4a4af.js"},{"revision":"87987109446a7ace22ae9491892a700c","url":"assets/js/9903dc99.4700933f.js"},{"revision":"4bf3e7abd63c2ee5545095a3e9f2b11d","url":"assets/js/9a2fa73a.ee87693b.js"},{"revision":"9aa9cec5dd5072023e5cdb0ab97c09d6","url":"assets/js/9bc9e25c.8097de8a.js"},{"revision":"224206052b807c3eee9da21faaaa18fc","url":"assets/js/9d48492b.d956ac2e.js"},{"revision":"0933c0ead059a4196752c0a80c9775a1","url":"assets/js/9fc1d339.037448cd.js"},{"revision":"e400d23044381dd971ea39c7b6c1283b","url":"assets/js/a05464cd.859016ea.js"},{"revision":"5099c51b666b362826e2275561e63a60","url":"assets/js/a09c2993.812a7242.js"},{"revision":"93b0e480e288e8a00371355dfc2128ae","url":"assets/js/a389e28e.c7e40c39.js"},{"revision":"b0286d93b8f0c7533c616fc543923a10","url":"assets/js/a7456010.7b4b0a20.js"},{"revision":"e9dc08b93f88aabfc137f6039d0397d4","url":"assets/js/a74b641e.088cd730.js"},{"revision":"eb920fc54a4c6161b669ec9b52a115f8","url":"assets/js/a7bd4aaa.95046d7a.js"},{"revision":"a8d0387521ab3da1f7868bc6339ce1a9","url":"assets/js/a7d04da7.18bdb0d0.js"},{"revision":"57e3c2c790b9ef1a61689cf3a748715c","url":"assets/js/a7d61b99.269f525c.js"},{"revision":"dad32197f5ad98692d598aa617a81c46","url":"assets/js/a89007e0.5198d775.js"},{"revision":"f6eed6f91cd39df233b58e8c1d59565a","url":"assets/js/a94703ab.95f72f34.js"},{"revision":"4c9e1b13d03a3443f8c6817cf2671d31","url":"assets/js/a9789633.e91e430c.js"},{"revision":"05779c9e558bca8f40bc065f8e9bce80","url":"assets/js/aa079c8b.94ee3eac.js"},{"revision":"899e2bbde2786be66bd81332ce0b4750","url":"assets/js/aad144a3.5ad8a7db.js"},{"revision":"aea484d67c6257fde3fbb92a0235e7b5","url":"assets/js/aba21aa0.9ac6642b.js"},{"revision":"da659ab1f34b5874d2a1bf029524c6c0","url":"assets/js/adb64ee2.7b680c76.js"},{"revision":"b516fdd54eac0fc64607b9561ab83885","url":"assets/js/af572879.2b536d52.js"},{"revision":"e185662226ea4fea29ba5618ec2bf654","url":"assets/js/afba4106.7e5bad69.js"},{"revision":"4a0f15767303f434aa519b2d35c7531b","url":"assets/js/b2161dc5.e00abd30.js"},{"revision":"0df977e46702de42940ed55838eae4d2","url":"assets/js/b4c5bdfe.92ec3263.js"},{"revision":"6c1e4af462e34f748126a77453e4ff0c","url":"assets/js/b647df5a.d394a46f.js"},{"revision":"543a27f5e74b2b52ee9df9d09939c7f9","url":"assets/js/b83f237d.212ef8af.js"},{"revision":"6ace4bccaf69ba6f6c58fcd7f09d6f8f","url":"assets/js/bb70b9c8.eed402bb.js"},{"revision":"dc6751dcef2b7791e8e01b160b78add0","url":"assets/js/c00c612c.b8bba764.js"},{"revision":"64d6060b5783edce03bcf6b709a0a4c7","url":"assets/js/c141421f.94fe8bc5.js"},{"revision":"6139c021c17988c437c1ee6d93201e5a","url":"assets/js/c1865e7c.279e0d2b.js"},{"revision":"b4cd77d78559aaac1efd38b082e7ed6e","url":"assets/js/c1bdbc58.fa73e3a0.js"},{"revision":"f40ec995f8d4ac942705f78771dad8ad","url":"assets/js/c44fa306.cd9e8bfb.js"},{"revision":"a7795fceba9bde031135a9fcd72be8df","url":"assets/js/c49413db.72672b32.js"},{"revision":"94f7a30ad6bc57dbb12af1e8c6c79021","url":"assets/js/c4ba122c.fcb4165c.js"},{"revision":"da10593579e490d5c375573d35e3c334","url":"assets/js/c62dfc48.f814772c.js"},{"revision":"f2513ed6d154e9dec38a8aad3c1c4a98","url":"assets/js/c7279284.2f96c938.js"},{"revision":"70ce683d68246e3be49a4a2990c8fcde","url":"assets/js/c9f7f11b.c8d58cc9.js"},{"revision":"bc61fa971523196008932f4ae0870683","url":"assets/js/cd9c57cb.e70ee565.js"},{"revision":"f241d258801bef89315dc0ef091d37f6","url":"assets/js/d069ae84.1510012e.js"},{"revision":"79dfc3d3fbf51af2d95ad9f411d5c1cb","url":"assets/js/d19b9e8a.e88ee538.js"},{"revision":"ab7629686c0d0ec3ba689344e91dfe72","url":"assets/js/d1b207fe.fcc3dae8.js"},{"revision":"ec783fdc2bc032c248ad616406ecd2f3","url":"assets/js/d2df711a.592d21bd.js"},{"revision":"1674a36a418d33063e68ea21ac86926d","url":"assets/js/d30d9744.477fbc7c.js"},{"revision":"4c431cb0571cbf36a14eef1e1ebb44f0","url":"assets/js/d4836a8e.f08aad97.js"},{"revision":"4556f27f4cefba100cffb0a03c3003d9","url":"assets/js/d720bb60.590e55e8.js"},{"revision":"d05936727684a5562d3783f69ec5af1b","url":"assets/js/d9330f66.00861d4f.js"},{"revision":"9def5a8adde0fa569b1ac709f3c55842","url":"assets/js/d957c22b.3c2b6e64.js"},{"revision":"afc5d6b2d72a53ed048e9e2bd9681a1d","url":"assets/js/daab97c5.b99fdee7.js"},{"revision":"25d623bd6a7f525e79261fe61657172b","url":"assets/js/dc033a20.9d70ff8c.js"},{"revision":"aede179a771bfa484c406f382be263cf","url":"assets/js/dd1da75d.2f2e0f37.js"},{"revision":"d10beb1d7bee86db94ac32043846444d","url":"assets/js/dd8b0175.809badf8.js"},{"revision":"53c6c3b98e7c695ce8de0685dfc86e6c","url":"assets/js/df70a34a.23f587dc.js"},{"revision":"47542320484f6fd91d898aca8867c03b","url":"assets/js/dff5aaca.ce3ca414.js"},{"revision":"e69c615424785297fab6d22949dd5ef5","url":"assets/js/e0a3f9c8.908793f9.js"},{"revision":"9e408dc8e9375345e12a76b98d7f088a","url":"assets/js/e1715838.1d92ad5f.js"},{"revision":"a3337288966775ea645dcd3661325a7c","url":"assets/js/e36b815f.c818c8fc.js"},{"revision":"2e1d019acebcdbfa6831caf36865c245","url":"assets/js/e59053ae.ff0eafd7.js"},{"revision":"9c3ce04d6cfadf17e626235f4b2d37af","url":"assets/js/e5a27df7.5fe7eaf0.js"},{"revision":"877c202b5b4c5e6840bd274603ca47d9","url":"assets/js/ea131d77.d9c6661d.js"},{"revision":"770c34c78604d5ad9704a3b70e8eac1b","url":"assets/js/eabdbf07.959addb9.js"},{"revision":"60a2d01e34c14052efe5aaa100846b2c","url":"assets/js/eae657ee.fc74d885.js"},{"revision":"cd8c4a66b6355bb9f86657adc93581ce","url":"assets/js/ebf39289.8bb0879e.js"},{"revision":"ea343e66c3d6de2e363baa18bb73f1c6","url":"assets/js/ec1d9510.91d9ecd6.js"},{"revision":"c25b57d63be573d2077b8974836ca3b7","url":"assets/js/ec7d5e88.be57bf5b.js"},{"revision":"c8e841f4a4e202c55a0f67521c6c1129","url":"assets/js/ecfacc56.ac9aa5e6.js"},{"revision":"b3ee2863d76e5cddc8ec5d23233c4b3b","url":"assets/js/ef2f3ccd.6a46eb02.js"},{"revision":"15e8765eeafb01b95df14e288c6ae08b","url":"assets/js/f0447160.334fdac1.js"},{"revision":"429122d4891e55dc48a23ad0c7b628df","url":"assets/js/f14ecac0.d868567d.js"},{"revision":"cabe9c123553f155a0f42aa8b56106cb","url":"assets/js/f2ed1a27.fb1768e4.js"},{"revision":"0b18a6706f93ed7f9f5383cea4aee98f","url":"assets/js/f3212b1e.60888de7.js"},{"revision":"d2b0423a20f42c36dc7efd3536bea20f","url":"assets/js/f43def45.6a04eee8.js"},{"revision":"b6db1c804ea518f2c06047daffee70f6","url":"assets/js/f546eb96.0b4fe835.js"},{"revision":"f54f24bd6cae837ce49adb54eb33ae89","url":"assets/js/f67ebb5d.b58d033a.js"},{"revision":"a8514ab3b40be901204e8288c4cd059f","url":"assets/js/f97daad0.bdabcf59.js"},{"revision":"574d242009c441201e51050bcf48e36a","url":"assets/js/fa17a3e5.f3f22079.js"},{"revision":"54d72d9d20db7bb8f2b010f0ec460482","url":"assets/js/fa9f2ace.edfa5c22.js"},{"revision":"d83310d6bacf16a292f088b7f82f9d4f","url":"assets/js/fbd32610.d9f43b70.js"},{"revision":"fbaf84d2d038b0c8706685f8aefbf6d7","url":"assets/js/fc80686b.49156ad8.js"},{"revision":"d236306d5dd5620e73da7489e279469f","url":"assets/js/fea96f18.e8c94212.js"},{"revision":"06c3313f96d7d36d5bb6490b5925406f","url":"assets/js/main.bef18837.js"},{"revision":"41b02910950eb247d49948164a3007e7","url":"assets/js/runtime~main.99379c03.js"},{"revision":"98f20131fe37d259b67b0892d2d066bf","url":"docs/10.x/getting-started/installation/index.html"},{"revision":"5e6e909c384634a9d22aeeb0ed7220b3","url":"docs/10.x/getting-started/options/index.html"},{"revision":"24b5a7fb3d5c069fcafee1cfe0c29392","url":"docs/10.x/getting-started/presets/index.html"},{"revision":"c46d3c5000a43214fdf85125cc1a9505","url":"docs/10.x/getting-started/test-environment/index.html"},{"revision":"37231ae48b9a4da5bd3a2ffbae85cb60","url":"docs/10.x/guides/absolute-imports/index.html"},{"revision":"c181875bac13d63bebed2560113bc141","url":"docs/10.x/guides/angular-ivy/index.html"},{"revision":"1b501599b6580a767be241fc0d0dd273","url":"docs/10.x/guides/esm-support/index.html"},{"revision":"b58fcb3489a06519e7a94b68a14379da","url":"docs/10.x/guides/jsdom-version/index.html"},{"revision":"57710eecb5de0fed14fe60a14d7f7eee","url":"docs/10.x/guides/troubleshooting/index.html"},{"revision":"c56ce5efea7a948b04b670ca351fc544","url":"docs/10.x/guides/using-with-babel/index.html"},{"revision":"3dc8e514cb8cb60204ebb719b7d01156","url":"docs/10.x/index.html"},{"revision":"f52ba8363798d35d54b67204baacd26a","url":"docs/10.x/processing/index.html"},{"revision":"aaebd934cb7042253daf152517582598","url":"docs/11.0/getting-started/installation/index.html"},{"revision":"8c3ad4617978e7b25fc23afb161369ad","url":"docs/11.0/getting-started/options/index.html"},{"revision":"4ca9377f4c5b416acfd3d6db9257196b","url":"docs/11.0/getting-started/presets/index.html"},{"revision":"e8fe143f0ac8a7a4c5aef770aaac3bcf","url":"docs/11.0/getting-started/test-environment/index.html"},{"revision":"53982c382f0333a7a32cd12a95d08be9","url":"docs/11.0/guides/absolute-imports/index.html"},{"revision":"31ae2cd21faceb7032048cdd9134868a","url":"docs/11.0/guides/angular-13+/index.html"},{"revision":"ff50acc223aa7a2574b5aa0499868747","url":"docs/11.0/guides/angular-ivy/index.html"},{"revision":"3f1cc4641a862f7ae309d29f8bfc2e2c","url":"docs/11.0/guides/esm-support/index.html"},{"revision":"60e434b35d54588118132a06e4e8de03","url":"docs/11.0/guides/jsdom-version/index.html"},{"revision":"4fc290425682b9bcf128cb0e7163a33a","url":"docs/11.0/guides/troubleshooting/index.html"},{"revision":"83650b4e32cd5e31ca79b80a60245f4b","url":"docs/11.0/guides/using-with-babel/index.html"},{"revision":"c3a124c3dba0ca37544fc922834e95e3","url":"docs/11.0/index.html"},{"revision":"7ed478fd69f159ace2a64baf2377024c","url":"docs/11.0/processing/index.html"},{"revision":"bfc8f99d9c4150ebcb645bb1a24ef557","url":"docs/11.1/getting-started/installation/index.html"},{"revision":"aa711ce7746df616fb209caf5e29ccd2","url":"docs/11.1/getting-started/options/index.html"},{"revision":"7d10376517148c36ea2ca2943970d7f0","url":"docs/11.1/getting-started/presets/index.html"},{"revision":"7a9e83369130f60def76b6853c6c7ed1","url":"docs/11.1/getting-started/test-environment/index.html"},{"revision":"73acc946c5abb3cf272cfdd3e1981de9","url":"docs/11.1/guides/absolute-imports/index.html"},{"revision":"95be9f9ca89a81c510016c6a943b7c97","url":"docs/11.1/guides/angular-13+/index.html"},{"revision":"a0649459437e8159baa391a1af5bee18","url":"docs/11.1/guides/angular-ivy/index.html"},{"revision":"a180164aaa3abdd1b8e06e900f4f8f29","url":"docs/11.1/guides/esm-support/index.html"},{"revision":"5fdeb209fc20e07af21767cc8c5f26b4","url":"docs/11.1/guides/jsdom-version/index.html"},{"revision":"a18a2efb0731711bfe9e16c72a206b02","url":"docs/11.1/guides/troubleshooting/index.html"},{"revision":"acc3253a7274ff259d242e8dede032ce","url":"docs/11.1/guides/using-with-babel/index.html"},{"revision":"7541f0224bfb31a42dff3d2b59b63889","url":"docs/11.1/index.html"},{"revision":"0212e72f390e7535d850773392dc46f6","url":"docs/11.1/processing/index.html"},{"revision":"38d754a2c1f7aebd5e834aad5911df6c","url":"docs/12.0/getting-started/installation/index.html"},{"revision":"1a1dee5320c8cb55c50b0c963480d8db","url":"docs/12.0/getting-started/options/index.html"},{"revision":"01f6e7210054db92241e5e59df1fea25","url":"docs/12.0/getting-started/presets/index.html"},{"revision":"d2ebac65d8bf98bf43e672c4f96704f9","url":"docs/12.0/getting-started/test-environment/index.html"},{"revision":"28f2c6190cb7f8d3f4979dade28a6d0e","url":"docs/12.0/guides/absolute-imports/index.html"},{"revision":"0d5a4c24f0475ebbc4e6507ea6fd6987","url":"docs/12.0/guides/angular-13+/index.html"},{"revision":"47ae3b8336c540657d1b83668710c645","url":"docs/12.0/guides/angular-ivy/index.html"},{"revision":"dae4b06d288d62cd632f23eb7e01aa4e","url":"docs/12.0/guides/esm-support/index.html"},{"revision":"621f4baa2eb150e503ed949596c395df","url":"docs/12.0/guides/jsdom-version/index.html"},{"revision":"87712558dd6a0f6afd709ead07ab5831","url":"docs/12.0/guides/troubleshooting/index.html"},{"revision":"c0550009d1ffeb3da1e7f2fde78fc28d","url":"docs/12.0/guides/using-with-babel/index.html"},{"revision":"3f435d10695a104715d1b922e5685953","url":"docs/12.0/index.html"},{"revision":"5e5b620e551fa15239c1c89084d08a59","url":"docs/12.0/processing/index.html"},{"revision":"2efcbd535f330092e4981a02063df7b4","url":"docs/13.0/getting-started/installation/index.html"},{"revision":"1742c1af637eddb65472d04d6b332d2b","url":"docs/13.0/getting-started/options/index.html"},{"revision":"786bc23330edca2032ba82c51ce87822","url":"docs/13.0/getting-started/presets/index.html"},{"revision":"ed0fe4ec9aa9e1281b48fa44af6f1d11","url":"docs/13.0/getting-started/test-environment/index.html"},{"revision":"8ace59ffcee0a4ba1ff55bf8ad826ba5","url":"docs/13.0/guides/absolute-imports/index.html"},{"revision":"a49d57468604ae26fb4fd550693d092d","url":"docs/13.0/guides/angular-13+/index.html"},{"revision":"7f2d3e2bb472c3232850724b44800200","url":"docs/13.0/guides/angular-ivy/index.html"},{"revision":"81952b0e4822510802742cc302a088cd","url":"docs/13.0/guides/esm-support/index.html"},{"revision":"d0f03c1f8b074fc011abf71b65d02d79","url":"docs/13.0/guides/jsdom-version/index.html"},{"revision":"2305e04bc1ed6e18db35639f5e256506","url":"docs/13.0/guides/troubleshooting/index.html"},{"revision":"6b4d67ac968c7adbccd38f0badc05e44","url":"docs/13.0/guides/using-with-babel/index.html"},{"revision":"75f1e7092267bb60bb6e94bd6bc0974d","url":"docs/13.0/index.html"},{"revision":"58d3507021595c6128ed08661a7222d0","url":"docs/13.0/processing/index.html"},{"revision":"e45eff306a8d4d866933f58f671c1912","url":"docs/14.0/getting-started/installation/index.html"},{"revision":"c2f761b42371ce15612aecabb32b9669","url":"docs/14.0/getting-started/options/index.html"},{"revision":"07166a6478530da37dd47db678a7eed3","url":"docs/14.0/getting-started/presets/index.html"},{"revision":"af7fd26807b245a9e63d2da87c61cbf5","url":"docs/14.0/getting-started/test-environment/index.html"},{"revision":"96a36794b7bb18a7cb8f1a8ee2053f00","url":"docs/14.0/guides/absolute-imports/index.html"},{"revision":"3449e1b067d9bcde6f44cbf18607a485","url":"docs/14.0/guides/angular-13+/index.html"},{"revision":"9a9d23499f1e153e25b926484be073ae","url":"docs/14.0/guides/angular-ivy/index.html"},{"revision":"571dc14685418f71015b65a8fc98a31d","url":"docs/14.0/guides/esm-support/index.html"},{"revision":"908ecfbe07356b8a0f9079f1bac65e8c","url":"docs/14.0/guides/jsdom-version/index.html"},{"revision":"534aeb0915cb37b8a608299ae75fda33","url":"docs/14.0/guides/troubleshooting/index.html"},{"revision":"abdf6604e131076031eee06c7ffefeb2","url":"docs/14.0/guides/using-with-babel/index.html"},{"revision":"bd31db0593994381c57affe643257979","url":"docs/14.0/index.html"},{"revision":"c42491ebcf0ca46b6d4e700aea9b9d58","url":"docs/14.0/processing/index.html"},{"revision":"e446e5370dcf5aa6a5e81f46cf20a567","url":"docs/14.2/getting-started/installation/index.html"},{"revision":"58e27b762d7a873cbcc4f648b28b1734","url":"docs/14.2/getting-started/options/index.html"},{"revision":"7ee7bb38139c5280177a5d98ee58f344","url":"docs/14.2/getting-started/presets/index.html"},{"revision":"bb99a43b5e147b30545633629f2321f5","url":"docs/14.2/getting-started/test-environment/index.html"},{"revision":"7f6314356488bf9872a47ede309f2fb2","url":"docs/14.2/guides/absolute-imports/index.html"},{"revision":"f2bd8bc9ba1019b3c2688b1b37b34ecc","url":"docs/14.2/guides/angular-13+/index.html"},{"revision":"bd3c0ce1e040b1d1ed729641ba920763","url":"docs/14.2/guides/angular-ivy/index.html"},{"revision":"b04adb538c920b24598d116f6531b483","url":"docs/14.2/guides/esm-support/index.html"},{"revision":"d2c2931a7da9cdbea2c5f94a8622fee4","url":"docs/14.2/guides/jsdom-version/index.html"},{"revision":"04955ec41d1f3578fdba48f1a36fcd57","url":"docs/14.2/guides/snapshot-testing/index.html"},{"revision":"445464d6213094170b8145039e0b257b","url":"docs/14.2/guides/troubleshooting/index.html"},{"revision":"560d9f9603d55e3b3c1d1a7c7154e6ba","url":"docs/14.2/guides/using-with-babel/index.html"},{"revision":"d50af3a6d2f5ba03caa33a5375165e68","url":"docs/14.2/index.html"},{"revision":"c1620b5c02d93b857a8e5c978f639506","url":"docs/14.2/processing/index.html"},{"revision":"507233d50e9a6090802cf0352c4f07ff","url":"docs/14.3/getting-started/installation/index.html"},{"revision":"bc9a0654a29d151d9bcf03f239687627","url":"docs/14.3/getting-started/options/index.html"},{"revision":"f737d49b05fa2a3ada9efae8b4623107","url":"docs/14.3/getting-started/presets/index.html"},{"revision":"9e8309769d2ff2f3c52604300215c3bf","url":"docs/14.3/getting-started/test-environment/index.html"},{"revision":"d5051a69ff9f29708da0aa947ce4623c","url":"docs/14.3/guides/absolute-imports/index.html"},{"revision":"300b3da1beee8fa6ca9c745821ea51ec","url":"docs/14.3/guides/angular-13+/index.html"},{"revision":"0383de583b438f2dc01e1deec105aef8","url":"docs/14.3/guides/angular-ivy/index.html"},{"revision":"41d86aa9094458c84bd13f3649355900","url":"docs/14.3/guides/esm-support/index.html"},{"revision":"74fc7adb9972d7581321e792ad93ec4e","url":"docs/14.3/guides/jsdom-version/index.html"},{"revision":"d8b777646be0014936e0fdc2333f0193","url":"docs/14.3/guides/snapshot-testing/index.html"},{"revision":"81e4214a27b2686f3bd83c7e92eefb6a","url":"docs/14.3/guides/troubleshooting/index.html"},{"revision":"4b737bffea992d2fcadb5207fd293c2d","url":"docs/14.3/guides/using-with-babel/index.html"},{"revision":"710510b4e2bff39b218308c9d1a563a3","url":"docs/14.3/index.html"},{"revision":"edee274f2d9df0068da5e581556af5d3","url":"docs/14.3/processing/index.html"},{"revision":"a9b9713c470c2f8a48bbdfc7c27adb3d","url":"docs/8.x/getting-started/installation/index.html"},{"revision":"42542f228cc9b21603b132a59aabee29","url":"docs/8.x/getting-started/options/index.html"},{"revision":"75642e7ffb8392bc024bf134f7b74e8e","url":"docs/8.x/getting-started/presets/index.html"},{"revision":"84f90837ec745492501e0989e8b16f48","url":"docs/8.x/getting-started/test-environment/index.html"},{"revision":"18ac1a6fcfabf247e461e11de735c904","url":"docs/8.x/guides/absolute-imports/index.html"},{"revision":"a4e1ca993aacb867040b8115640a9545","url":"docs/8.x/guides/angular-ivy/index.html"},{"revision":"a7e64072462c0a03c7b635050e6f171f","url":"docs/8.x/guides/esm-support/index.html"},{"revision":"2e98e71ab14efd71206fb6491db9f938","url":"docs/8.x/guides/jsdom-version/index.html"},{"revision":"644e623b19698c259a5eccbb33cb386c","url":"docs/8.x/guides/troubleshooting/index.html"},{"revision":"82ed68e4f8c1a768d2b807dd0bfa8e04","url":"docs/8.x/guides/using-with-babel/index.html"},{"revision":"b7214b6e754062c037b78d0af98391da","url":"docs/8.x/index.html"},{"revision":"196178762ebc8a3f802f21626aaaceb5","url":"docs/8.x/processing/index.html"},{"revision":"ba9915a256d94c48fb18d3bd14c7f8c8","url":"docs/9.x/getting-started/installation/index.html"},{"revision":"c29660382f919234e6c41f6cfdaf2e6b","url":"docs/9.x/getting-started/options/index.html"},{"revision":"acd7ba4374cd5922736b1ca9d882a64c","url":"docs/9.x/getting-started/presets/index.html"},{"revision":"ea378a9459a68bf3166b365ebe4d4e1e","url":"docs/9.x/getting-started/test-environment/index.html"},{"revision":"111c986f1ac10efa015baeeec8e8c391","url":"docs/9.x/guides/absolute-imports/index.html"},{"revision":"ca15651f53182e0b418f234439516906","url":"docs/9.x/guides/angular-ivy/index.html"},{"revision":"38b001ce5184b7c5e66fbbeb1c59d011","url":"docs/9.x/guides/esm-support/index.html"},{"revision":"c23fcc18ce2d04222424336b9fba63a3","url":"docs/9.x/guides/jsdom-version/index.html"},{"revision":"ead72666a385992cf436c52a1b2ad930","url":"docs/9.x/guides/troubleshooting/index.html"},{"revision":"2aa45abc46af1a0a5e5ceb88fc5eac94","url":"docs/9.x/guides/using-with-babel/index.html"},{"revision":"3fdda3dab424441c97d3452ad28240d2","url":"docs/9.x/index.html"},{"revision":"a497726797c7e8c2a53b9f2adb5d8cf3","url":"docs/9.x/processing/index.html"},{"revision":"089aa4938478e3da76623ac082b1e728","url":"docs/getting-started/installation/index.html"},{"revision":"3729d3053bf76e4403f4f939b0f66653","url":"docs/getting-started/options/index.html"},{"revision":"80db89b0d5c0d3539cc49abe9bcbfc6b","url":"docs/getting-started/presets/index.html"},{"revision":"1c0d2c3782aefe4352516191a182d244","url":"docs/getting-started/test-environment/index.html"},{"revision":"e3241b0a7adf01e24794c468dd21a145","url":"docs/guides/absolute-imports/index.html"},{"revision":"a8bfe49e47e4f0ebaf233485086374ef","url":"docs/guides/angular-13+/index.html"},{"revision":"db7bb3c7be8623818fc20040d7c9a2bf","url":"docs/guides/angular-ivy/index.html"},{"revision":"37000042df9482c04e0a69aacd0fb49e","url":"docs/guides/esm-support/index.html"},{"revision":"3267117b28b2f7f2162e8f1fac7cddf4","url":"docs/guides/jsdom-version/index.html"},{"revision":"a96423ba52e10fae0e6aac9b978d2fb1","url":"docs/guides/snapshot-testing/index.html"},{"revision":"57c5a2d48cbac5803a4c55ff3d79170d","url":"docs/guides/troubleshooting/index.html"},{"revision":"a853927175245500142f9fbda0a46da7","url":"docs/guides/using-with-babel/index.html"},{"revision":"506fce9a44325e156417045a7cdb7058","url":"docs/index.html"},{"revision":"f9401ffe594ae04456263e1c859e1f47","url":"docs/next/getting-started/installation/index.html"},{"revision":"94ac55671ceb2dd6d0e33c46da95bd04","url":"docs/next/getting-started/options/index.html"},{"revision":"a24c811c7a7d3cf8669eae496cab7200","url":"docs/next/getting-started/presets/index.html"},{"revision":"d684543cecabba0335d69db26748d39a","url":"docs/next/getting-started/test-environment/index.html"},{"revision":"80c1f5366ced922835d48fb5133aa29b","url":"docs/next/guides/absolute-imports/index.html"},{"revision":"fd98e722950d1e6c353c3d275f06e170","url":"docs/next/guides/angular-13+/index.html"},{"revision":"b89306eec073d1631a4d69e16d55a45f","url":"docs/next/guides/angular-ivy/index.html"},{"revision":"6bd4054fe23f7d86cf11be1c96687bcb","url":"docs/next/guides/esm-support/index.html"},{"revision":"76894fdbab56186bf9ae2e405001b6c2","url":"docs/next/guides/jsdom-version/index.html"},{"revision":"36c98c179b39d26fcf19a8a53dee8094","url":"docs/next/guides/snapshot-testing/index.html"},{"revision":"e4b4b90dbb69f7a84af48d602d4e0cb3","url":"docs/next/guides/troubleshooting/index.html"},{"revision":"2e34aa65e446cb6ef7de3b70b3163715","url":"docs/next/guides/using-with-babel/index.html"},{"revision":"b97ab9a0da2db7529aa49dc79171be57","url":"docs/next/index.html"},{"revision":"6c1c3b7700945b424433bcfbe382dad7","url":"docs/next/processing/index.html"},{"revision":"ba802b2fc5b080c0310761f525ae34c6","url":"docs/processing/index.html"},{"revision":"bccf29c4a14a21707a0fdb26cd1d912b","url":"index.html"},{"revision":"39d0f7b81200aacb9b15b16745bd2264","url":"manifest.json"},{"revision":"861e2a0921de39d698f73b3d22a1ab68","url":"search/index.html"},{"revision":"c560673d1c2592e81d93dd2f10d0d773","url":"versions/index.html"},{"revision":"f8389ca1a741a115313bede9ac02e2c0","url":"img/discord.svg"},{"revision":"5e0e02d0c0f021b2037ed926d68ea1be","url":"img/documentation.png"},{"revision":"a83841c50aa67da6144860bd5031cc53","url":"img/github.png"},{"revision":"a2552d19b3538a030407a0191c99cae1","url":"img/logo.svg"},{"revision":"ee83b65c3aed4a45b928a4bebeb97a98","url":"img/pull-request.png"},{"revision":"cce226b035fb4ab5eee43b077db1ba4a","url":"img/troubleshooting.png"}],s=new C({fallbackToNetwork:!0});e.offlineMode&&(s.addToCacheList(t),e.debug&&console.log("[Docusaurus-PWA][SW]: addToCacheList",{precacheManifest:t})),await async function(e){}(),self.addEventListener("install",(t=>{e.debug&&console.log("[Docusaurus-PWA][SW]: install event",{event:t}),t.waitUntil(s.install(t))})),self.addEventListener("activate",(t=>{e.debug&&console.log("[Docusaurus-PWA][SW]: activate event",{event:t}),t.waitUntil(s.activate(t))})),self.addEventListener("fetch",(async t=>{if(e.offlineMode){const a=t.request.url,n=function(e){const t=new URL(e,self.location.href);return t.origin!==self.location.origin?[]:(t.search="",t.hash="",[t.href,`${t.href}${t.pathname.endsWith("/")?"":"/"}index.html`])}(a);for(const i of n){const r=s.getCacheKeyForURL(i);if(r){const s=caches.match(r);e.debug&&console.log("[Docusaurus-PWA][SW]: serving cached asset",{requestURL:a,possibleURL:i,possibleURLs:n,cacheKey:r,cachedResponse:s}),t.respondWith(s);break}}}})),self.addEventListener("message",(async t=>{e.debug&&console.log("[Docusaurus-PWA][SW]: message event",{event:t});const s=t.data?.type;"SKIP_WAITING"===s&&self.skipWaiting()}))})()})(); \ No newline at end of file diff --git a/versions/index.html b/versions/index.html index fdbc6bc7e5..35bd96decb 100644 --- a/versions/index.html +++ b/versions/index.html @@ -2,7 +2,7 @@ - + Versions | jest-preset-angular @@ -13,11 +13,11 @@ - - - + + + -

    jest-preset-angular documentation versions

    Next version (Unreleased)

    Here you can find the documentation for work-in-process unreleased version.

    NextDocumentationRelease Notes

    Latest version (Stable)

    Here you can find the documentation for current released version.

    14.4DocumentationRelease Notes
    +

    jest-preset-angular documentation versions

    Next version (Unreleased)

    Here you can find the documentation for work-in-process unreleased version.

    NextDocumentationRelease Notes

    Latest version (Stable)

    Here you can find the documentation for current released version.

    14.4DocumentationRelease Notes
    \ No newline at end of file