Skip to content

mlmorg/mockit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
});

About

Simple module dependency mocking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published