require()
shouldn't be cached when the required files throws
#11259
Labels
require()
shouldn't be cached when the required files throws
#11259
🐛 Bug Report
If a CJS file that throws is requried twice, the second time Jest doesn't throw but returns a cached result.
To Reproduce
See repo below
Expected behavior
Jest should throw both times, but the second time it returns the
module.exports
object defined by the requried module before throwing.Link to repl or repo (highly encouraged)
https://github.com/nicolo-ribaudo/jest-bug-require-throws
envinfo
Context
I found this while trying to work around #11258, but it's not related to ESM.
The text was updated successfully, but these errors were encountered: