jest.doMock cannot affect something because it already uses original mock.json and needs to be reimported, while reimporting mock.json in tests cannot affect anything on its own.

It should be:

    jest.doMock('../data/mock.json', () => ({
        __esModule: true,
        default: undefined,

    const { something } = await import('./handler');

    await expect(something()).resolves.toBe('error is here');

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top