'Is there a way to change jest.mock(<path>) automatically, when we modify the filename?

I am using jest for testing and doing sth like this often:

jest.mock('../../<my_path_to_file>');

But when I decide to change the <my_path_to_file> name (rename the file basically), visual studio automatically detects imports in files to change and shows them, but I still have to manually change this jest.mock path.

Is there a way to automatically do this ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source