mockit

0.1.1 • Public • Published

Mockit

Mockit is a simple library for mocking module dependencies during testing. Other dependency injection libraries create a sandbox around the tested module forcing the user to deal with an entirely new module context. Mockit simply overwrites the mocked dependencies and includes the module in its original scope.

Installation

$ npm install mockit

Usage

To mock the http module in a required file:

var mockit = require('mockit');
 
var mockHttp = {
  // Mocked methods here...
};
 
var Downloader = mockit('../lib/downloader', {
  http: mockHttp
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    1
  • 0.1.0
    2

Package Sidebar

Install

npm i mockit

Weekly Downloads

3

Version

0.1.1

License

MIT

Last publish

Collaborators

  • mlmorg