When it comes to unit testing in Typescript using Jest, I am looking to mock a .json file.
Currently, I have a global mock set up inside my jest.config.js file which works perfectly:
'package.json': '<rootDir>/__tests__/tasks/__mocks__/data.json'
However, I would like to create a local mock within my test class.
I attempted the following approach, but it did not yield the desired result:
jest.mock('../../package.json', () => ({
package : { name: '__name__', 'version': '__version__'};
}), { virtual: true })