mfncooper / mockery

Simplifying the use of mocks with Node.js
Other
1.1k stars 60 forks source link

`registerMock` should throw an error if the module being mocked has already been required #62

Open tyron-j opened 7 years ago

tyron-j commented 7 years ago

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.