Created by: KennethSundqvist
This PR fixes #7539.
The Jest documentation says:
If the module you are mocking is a Node module (e.g.: lodash), the mock should be placed in the __mocks__ directory adjacent to node_modules (unless you configured roots to point to a folder other than the project root) and will be automatically mocked.
We have to check if the directory exists before we add it because the watcher used by Jest (jest-haste-map > './lib/FSEventsWatcher.js' > walker) will throw an error if '<rootDir>/__mocks__' doesn't exist.