mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
"use strict";(self.rspackChunkwebsite=self.rspackChunkwebsite||[]).push([["8901"],{2084(e,n,s){s.r(n),s.d(n,{default:()=>t});var r=s(4848),i=s(8453);function o(e){let n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",pre:"pre",span:"span",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.h1,{id:"configuration",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#configuration",children:"#"}),"Configuration"]}),"\n",(0,r.jsxs)(n.h2,{id:"configure",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#configure",children:"#"}),(0,r.jsx)(n.code,{children:"configure"})]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(n.pre,{className:"shiki css-variables",style:{backgroundColor:"var(--shiki-background)",color:"var(--shiki-foreground)"},tabIndex:"0",lang:"ts",children:(0,r.jsxs)(n.code,{children:[(0,r.jsxs)(n.span,{className:"line",children:[(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"type"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:" Config"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:" ="}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:" {"})]}),"\n",(0,r.jsxs)(n.span,{className:"line",children:[(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:" asyncUtilTimeout"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-constant)"},children:" number"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:";"})]}),"\n",(0,r.jsxs)(n.span,{className:"line",children:[(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:" defaultHidden"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-constant)"},children:" boolean"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:";"})]}),"\n",(0,r.jsxs)(n.span,{className:"line",children:[(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:" defaultDebugOptions"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:" Partial"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:"<"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"DebugOptions"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:">;"})]}),"\n",(0,r.jsxs)(n.span,{className:"line",children:[(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:" concurrentRoot"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-constant)"},children:" boolean"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:";"})]}),"\n",(0,r.jsx)(n.span,{className:"line",children:(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:"};"})}),"\n",(0,r.jsx)(n.span,{className:"line"}),"\n",(0,r.jsxs)(n.span,{className:"line",children:[(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:" configure"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:"(options"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:" Partial"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:"<"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"Config"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:">) {}"})]})]})})}),"\n",(0,r.jsxs)(n.h3,{id:"asyncutiltimeout-option",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#asyncutiltimeout-option",children:"#"}),(0,r.jsx)(n.code,{children:"asyncUtilTimeout"})," option"]}),"\n",(0,r.jsxs)(n.p,{children:["Default timeout, in ms, for async helper functions (",(0,r.jsx)(n.code,{children:"waitFor"}),", ",(0,r.jsx)(n.code,{children:"waitForElementToBeRemoved"}),") and ",(0,r.jsx)(n.code,{children:"findBy*"})," queries. Defaults to 1000 ms."]}),"\n",(0,r.jsxs)(n.h3,{id:"defaultincludehiddenelements-option",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#defaultincludehiddenelements-option",children:"#"}),(0,r.jsx)(n.code,{children:"defaultIncludeHiddenElements"})," option"]}),"\n",(0,r.jsxs)(n.p,{children:["Default value for ",(0,r.jsx)(n.a,{href:"/13.x/docs/api/queries.html#includehiddenelements-option",children:"includeHiddenElements"})," query option for all queries. The default value is ",(0,r.jsx)(n.code,{children:"false"}),", so all queries won't match ",(0,r.jsx)(n.a,{href:"#ishiddenfromaccessibility",children:"elements hidden from accessibility"}),". This is because users of the app wouldn't be able to see such elements."]}),"\n",(0,r.jsxs)(n.p,{children:["This option is also available as ",(0,r.jsx)(n.code,{children:"defaultHidden"})," alias for compatibility with ",(0,r.jsx)(n.a,{href:"https://testing-library.com/docs/dom-testing-library/api-configuration/#defaulthidden",rel:"noopener noreferrer",target:"_blank",children:"React Testing Library"}),"."]}),"\n",(0,r.jsxs)(n.h3,{id:"defaultdebugoptions-option",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#defaultdebugoptions-option",children:"#"}),(0,r.jsx)(n.code,{children:"defaultDebugOptions"})," option"]}),"\n",(0,r.jsxs)(n.p,{children:["Default ",(0,r.jsx)(n.a,{href:"#debug",children:"debug options"})," used when calling ",(0,r.jsx)(n.code,{children:"debug()"}),". These default options are overridden by the ones you specify directly when calling ",(0,r.jsx)(n.code,{children:"debug()"}),"."]}),"\n",(0,r.jsxs)(n.h3,{id:"concurrent-root",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#concurrent-root",children:"#"}),(0,r.jsx)(n.code,{children:"concurrentRoot"})," option"]}),"\n",(0,r.jsxs)(n.p,{children:["Set to ",(0,r.jsx)(n.code,{children:"false"})," to disable concurrent rendering.\nOtherwise, ",(0,r.jsx)(n.code,{children:"render"})," defaults to using concurrent rendering used in the React Native New Architecture."]}),"\n",(0,r.jsxs)(n.h2,{id:"resettodefaults",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#resettodefaults",children:"#"}),(0,r.jsx)(n.code,{children:"resetToDefaults()"})]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(n.pre,{className:"shiki css-variables",style:{backgroundColor:"var(--shiki-background)",color:"var(--shiki-foreground)"},tabIndex:"0",lang:"ts",children:(0,r.jsx)(n.code,{children:(0,r.jsxs)(n.span,{className:"line",children:[(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:" resetToDefaults"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-foreground)"},children:"() {}"})]})})})}),"\n",(0,r.jsxs)(n.h2,{id:"environment-variables",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#environment-variables",children:"#"}),"Environment variables"]}),"\n",(0,r.jsxs)(n.h3,{id:"rntl_skip_auto_cleanup",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#rntl_skip_auto_cleanup",children:"#"}),(0,r.jsx)(n.code,{children:"RNTL_SKIP_AUTO_CLEANUP"})]}),"\n",(0,r.jsxs)(n.p,{children:["Set to ",(0,r.jsx)(n.code,{children:"true"})," to disable automatic ",(0,r.jsx)(n.code,{children:"cleanup()"})," after each test. This works the same as importing ",(0,r.jsx)(n.code,{children:"react-native-testing-library/dont-cleanup-after-each"})," or using ",(0,r.jsx)(n.code,{children:"react-native-testing-library/pure"}),"."]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(n.pre,{className:"shiki css-variables",style:{backgroundColor:"var(--shiki-background)",color:"var(--shiki-foreground)"},tabIndex:"0",lang:"shell",children:(0,r.jsx)(n.code,{children:(0,r.jsxs)(n.span,{className:"line",children:[(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-string)"},children:" RNTL_SKIP_AUTO_CLEANUP="}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-constant)"},children:"true"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-string)"},children:" jest"})]})})})}),"\n",(0,r.jsxs)(n.h3,{id:"rntl_skip_auto_detect_fake_timers",children:[(0,r.jsx)(n.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#rntl_skip_auto_detect_fake_timers",children:"#"}),(0,r.jsx)(n.code,{children:"RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS"})]}),"\n",(0,r.jsxs)(n.p,{children:["Set to ",(0,r.jsx)(n.code,{children:"true"})," to disable auto-detection of fake timers. This might be useful in rare cases when you want to use non-Jest fake timers. See ",(0,r.jsx)(n.a,{href:"https://github.com/callstack/react-native-testing-library/issues/886",rel:"noopener noreferrer",target:"_blank",children:"issue #886"})," for more details."]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(n.pre,{className:"shiki css-variables",style:{backgroundColor:"var(--shiki-background)",color:"var(--shiki-foreground)"},tabIndex:"0",lang:"shell",children:(0,r.jsx)(n.code,{children:(0,r.jsxs)(n.span,{className:"line",children:[(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-string)"},children:" RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS="}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-constant)"},children:"true"}),(0,r.jsx)(n.span,{style:{color:"var(--shiki-token-string)"},children:" jest"})]})})})})]})}function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(o,{...e})}):o(e)}t.__RSPRESS_PAGE_META={},t.__RSPRESS_PAGE_META["13.x%2Fdocs%2Fapi%2Fmisc%2Fconfig.mdx"]={toc:[{id:"configure",text:"`configure`",depth:2},{id:"asyncutiltimeout-option",text:"`asyncUtilTimeout` option",depth:3},{id:"defaultincludehiddenelements-option",text:"`defaultIncludeHiddenElements` option",depth:3},{id:"defaultdebugoptions-option",text:"`defaultDebugOptions` option",depth:3},{id:"concurrent-root",text:"`concurrentRoot` option",depth:3},{id:"resettodefaults",text:"`resetToDefaults()`",depth:2},{id:"environment-variables",text:"Environment variables",depth:2},{id:"rntl_skip_auto_cleanup",text:"`RNTL_SKIP_AUTO_CLEANUP`",depth:3},{id:"rntl_skip_auto_detect_fake_timers",text:"`RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS`",depth:3}],title:"Configuration",headingTitle:"Configuration",frontmatter:{}}}}]); |