You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: calling configure() without reactStrictMode resets it to undefined, silently disabling strict mode #1466
Calling configure() with any config object that omits reactStrictMode silently resets the previously-configured strict mode flag to undefined.
Root cause
In src/config.js:
functionconfigure(newConfig){if(typeofnewConfig==='function'){newConfig=newConfig(getConfig())}const{reactStrictMode, ...configForDTL}=newConfigconfigureDTL(configForDTL)configForRTL={
...configForRTL,
reactStrictMode,// <-- always overwrites, even when undefined}}
When newConfig does not include a reactStrictMode key, destructuring yields reactStrictMode = undefined. The spread ...configForRTL correctly carries the previously saved value, but the explicit reactStrictMode property after it overwrites it with undefined.
Reproduction
import{configure,getConfig}from'@testing-library/react'// Enable strict modeconfigure({reactStrictMode: true})console.log(getConfig().reactStrictMode)// true ✓// Later, an unrelated configure() call — e.g. from a setup fileconfigure({asyncUtilTimeout: 2000})console.log(getConfig().reactStrictMode)// undefined ✗ (expected: true)
The second configure() call erases the strict-mode setting. The function-form callback is affected identically:
configure(prev=>({ ...prev,asyncUtilTimeout: 2000}))// Works because prev spreads reactStrictMode — but only if callers remember to spread prev.// The plain-object form has no such safety net.
Impact
Tests that rely on global strict-mode configuration (e.g. set in a setupFilesAfterFramework) silently lose that configuration if any later configure() call omits reactStrictMode. This is particularly easy to hit when test utilities or libraries call configure() with their own options.
Fix
Only write reactStrictMode into configForRTL when it is explicitly present in newConfig:
Activity
suhailopensource commentedon Jul 29, 2026
@MatanBobi i would like to work on this. i have already tested a fix do assign me this issue . im confident i can fix this .