require-blocker

    1.0.1 • Public • Published

    Build Status npm version

    Require Blocker

    Prevents modules from being loaded when running unit tests.

    Features

    • Hide multiple modules
    • Will fail the same way that require() does when a module cannot be found
    • No dependencies

    Installation

    Install via npm.

    npm install require-blocker --save-dev
    

    Getting Started

    'use strict';
     
    const requireBlocker = require( 'require-blocker' );
     
     
    requireBlocker.block( 'http', 'https' );
     
    // require( 'http' ); will fail
    // require( 'https' ); will fail
     
    requireBlocker.reset();
     
    // require( 'http' ); will load
    // require( 'https' ); will load

    Feedback

    We'd love to get feedback on how to make this tool better. Feel free to contact us at feedback@vandium.io

    License

    BSD-3-Clause

    Install

    npm i require-blocker

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    BSD-3-Clause

    Last publish

    Collaborators

    • richardhyatt