Open smcenlly opened 2 years ago
Thanks for opening this ticket. 🙂
The analysis of what's mocked and isn't mocked doesn't have to be perfect. It would still be useful if it could handle simple cases like:
jest.mock("./path/to/file.js");
jest.mock("./path/to/another-file.js", () => {
// custom mock, but not calls to jest.requireActual()
});
If the mock includes a call to jest.requireActual()
then all bets are off and we can fallback to the current behaviour.
The cases in the snippet above should be statically analyzable without having to inspect values at runtime.
FTR, I meant to say this wasn't the first time I forgot that I had mocked a module.
From discord: