Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    requireincontextpublic

    RequireInContext

    Allows you to do a require() with a custom context.

    Useful for emulating a browser environment in Node:

    var requireInContext = require('requireincontext');
    var myclient = requireInContext('./myclient.js', {
      window: {},
      io: require('socket.io')
    });
    

    Or for specifying mock objects for running tests:

    var requireInContext = require('requireincontext');
    var mycode = requireInContext('./mycode.js', {
      mydependency: require('./dependency_mock.js')
    });
    

    Keywords

    none

    install

    npm i requireincontext

    Downloadslast 7 days

    0

    version

    0.0.2

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar