bug: calling configure() without reactStrictMode resets it to undefined, silently disabling strict mode
@suhailopensource is already working on this.
Since Jul 29, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- javascript
- Domain
- testing
Research direction
Start in src/config.js at configure(), then review how getConfig() exposes the saved reactStrictMode value. The fix is done when a later configure() call that omits reactStrictMode preserves the prior setting, including the plain-object case described in the reproduction.
Written by the indexing model from the issue text.
Description
Bug
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:
function configure(newConfig) {
if (typeof newConfig === 'function') {
newConfig = newConfig(getConfig())
}
const {reactStrictMode, ...configForDTL} = newConfig
configureDTL(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 mode
configure({ reactStrictMode: true })
console.log(getConfig().reactStrictMode) // true ✓
// Later, an unrelated configure() call — e.g. from a setup file
configure({ 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:
configForRTL = {
...configForRTL,
...(reactStrictMode !== undefined && {reactStrictMode}),
}
PR #1461 implements exactly this fix.
- Dominant language
- JavaScript
- Stars
- 19.7k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from testing-library/react-testing-library
-
fireEvent.select does not wrap its automatic native focus in actPossibly taken @sergioperezcheco claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
testing-library/react-testing-library#1459 · 2 comments ·
-
perf: optimize container lookup with early exitMay be free again @Ch-Abhinav-Chowdary claimed this 299 days ago, and no pull request is open. Open
Difficulty 1/5 Under an hour Newbie friendliness 35/100
testing-library/react-testing-library#1430 · 1 comment ·
-
`fireEvent.mouseEnter` does not forward `relatedTarget` (relatedTarget is the window instead)Possibly taken @swarnim02 claimed this 317 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
testing-library/react-testing-library#1421 · 1 comment ·
All issues in testing-library/react-testing-library
Similar issues
-
documentation good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug release:v5.56
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Jason-Vaughan/TangleClaw#2270 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
style-dictionary/style-dictionary#1773 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SignalK/signalk-server#3143 ·
Maintainers usually reply within 1 day