Mocked is a small library that allows you to intercept calls to require() and load the specified libaries from a directory of your choosing.
npm install mocked
UsageThe usage is as so:
var mocked = require('mocked'); // Use the directory ./tests/mocks and list the libs to be mocked mocked('./tests/mocks', ['http', 'net', './some/dependency']); // this will be at ./tests/mocks/deps/logger.js var logger = require('./deps/logger');
GithubFor git repository and issues, please see
LicenseMIT. (See LICENSE file)
AuthorScott McWhirter - Github profile