question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

require cache can mess with JS file-loading in tests

See original GitHub issue

See 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:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisblossomcommented, May 22, 2018

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?

0reactions
davidtheclarkcommented, Jul 20, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found