I have a module that exports an object, let's call it myObject.
This export is used somewhere on the call-stack of the test case, but not directly in the test-case.
I would like to mock different values for this export depending on test cases.
Currently, the mock works if I have it top-level and use jest.mock:
jest.mock('../myModulePath', () => ({myObject: {mocked: 'valueHere'}))
However, using jest.doMock instead, while making sure to reset modules before each test with
beforeEach(() => jest.resetModules()) doesn't work.
I've tried using a require right after my doMock call but as expected it didn't work, as I'm not using the module directly in my tests.
Has anyone managed to achieve this?