I have a test file that has this line
jest.mock('../request');
but it seems couldn't find my mocks folder and it's request file. My folder structure as below
I followed the example of jest here https://github.com/facebook/jest/tree/master/examples/async
Any clue what's wrong?
The path in jest.mock
needs to be the relative path from your test to the module you want to mock (request.js
) and the __mocks__
folder needs to be in the folder where the original request.js
file is in. From your screenshot its hard to see if its like this. Also your test dont show the jest.mock('../request');
line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With