mfncooper/mockery — Issue #4: Mocking across tests
Author: BryanDonovan
Created: 2011-12-20 01:11:48+00:00
State: open

Hi Martin,

I don't think this is necessarily an issue with Mockery, but I'm having a hard time finding a good solution for this problem. The problem is that if I run one test that requires a real module, and then run another that mocks that same module, the mocked version fails (the reverse is also seems to be true but I'm having a hard time proving it). This is only a problem when a test runner loads all the test files at once, which caches the require paths and mockery gets bypassed (or something).

I've simplified the problem into a standalone git repo here:

https://github.com/BryanDonovan/nodejs-mock-test

If you have a chance to take a look, I'd really appreciate it. It might just be something obvious that I'm doing wrong.

Thanks,
Bryan