So I know the proper way to use registerMock is to call it before requiring modules in the unit test. However this a little unintuitive for developers unfamiliar with mockery, and it would make a lot more sense if there was an option to throw an error if the module being mocked has already been required in an earlier statement (say, inside beforeEach). If this sounds useful, I can submit a PR.
So I know the proper way to use
registerMock
is to call it before requiring modules in the unit test. However this a little unintuitive for developers unfamiliar withmockery
, and it would make a lot more sense if there was an option to throw an error if the module being mocked has already been required in an earlier statement (say, insidebeforeEach
). If this sounds useful, I can submit a PR.