Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vandium-io/require-blocker
Prevents modules from being loaded via require()
https://github.com/vandium-io/require-blocker
Last synced: 3 days ago
JSON representation
Prevents modules from being loaded via require()
- Host: GitHub
- URL: https://github.com/vandium-io/require-blocker
- Owner: vandium-io
- License: bsd-3-clause
- Created: 2016-06-22T19:16:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-06-22T21:46:36.000Z (over 8 years ago)
- Last Synced: 2024-12-08T13:48:28.608Z (about 1 month ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/vandium-io/require-blocker.svg?branch=master)](https://travis-ci.org/vandium-io/require-blocker)
[![npm version](https://badge.fury.io/js/require-blocker.svg)](https://badge.fury.io/js/require-blocker)# 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
```js
'use strict';const requireBlocker = require( 'require-blocker' );
requireBlocker.block( 'http', 'https' );
// require( 'http' ); will fail
// require( 'https' ); will failrequireBlocker.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 `[email protected]`
## License
[BSD-3-Clause](https://en.wikipedia.org/wiki/BSD_licenses)