require cache can mess with JS file-loading in tests
See original GitHub issueSee https://github.com/davidtheclark/cosmiconfig/pull/147/files#r189721953
Because we’re now using require
, it makes sense that the require cache could get in our way for testing.
This may be as simple as using jest.resetModules()
?
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
node.js require() cache - possible to invalidate? - Stack Overflow
Yes, you can invalidate cache. The cache is stored in an object called require. cache which you can access directly according to filenames...
Read more >Clearing require.cache of native addon makes it throw when ...
I have created a native module which handles licenses for my soft and which can change its internal state irreversible when something is...
Read more >Put mock data into Node require cache - Gleb Bahmutov
Let us solve the first problem: imagine we really want to load something else instead of the actual file foo.js . We can...
Read more >Optimizing WordPress to 100% With LiteSpeed Cache Plugin
We have tested the LiteSpeed Cache plugin and configured the settings of three different websites. This article will walk you through the ...
Read more >What is a cache? And why does clearing it fix things? - Zapier
It's timeless advice: if a website isn't loading properly, clear your browser's cache. We've all done it, noticed that things work again, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We are already using
jest.resetModules()
, BUT maybe it has the same issue as https://github.com/facebook/jest/issues/6059.@evocateur can you please provide the steps to reproduce the error you were getting?
Since we haven’t seen any other reports of this problem and it sounds like the problem has resolved itself, let’s close the issue. If something similar arises in the future, we’ll address it then.