So it looks like the Mocha Framework doesn't support mocks directly but a separate library called sinon.js does, it appears to have basically all the functionality we need in a mocking/stubbing library.
We can either create mocks in pure javascript or use something like sinon to do this.
We probably need to explicitly make our modules require dependency injection so we can pass these mock objects in. Unless you know of some way of temporarily changing what require('fs') resolves to?
What are your thoughts? I'll keep looking stuff up in the meantime.
So it looks like the Mocha Framework doesn't support mocks directly but a separate library called sinon.js does, it appears to have basically all the functionality we need in a mocking/stubbing library.
We can either create mocks in pure javascript or use something like sinon to do this.
We probably need to explicitly make our modules require dependency injection so we can pass these mock objects in. Unless you know of some way of temporarily changing what require('fs') resolves to?
What are your thoughts? I'll keep looking stuff up in the meantime.