Socket
Book a DemoInstallSign in
Socket

require-blocker

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-blocker

Prevents modules from being loaded via require()

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

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

Keywords

unit test

FAQs

Package last updated on 22 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts