Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-proxyquire-namespace

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-proxyquire-namespace

For use with namespaced importing and proxyquire

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Using Proxyquire & Namespaces

This is a simple plugin that allows you to use <name-space>/moduleFile syntax when smashing dependencies with proxyquire.

This plugin simply adds proxyquire method calls to babel-plugin-namespaces Read the documentation there for how to configure your namespaces in package.json. This plugin includes functionality from the base plugin so you only need to install this one.

Simply replace "namespaces" key in babel plugins array with "proxyquire-namespace" and your tests will pass again!

Example Usage

import { noCallThru } from 'proxyquire';
import { stub } from 'sinon';

const proxyquireStrict = noCallThru();

const stubs = {
  stubFoo: stub(),
  stubBar: stub()
};

const config = { static: 'test.value' };

const testModule = proxyquireStrict('./testModule', {
    '<config>/': config,
    '<my-name-space>/someDependencyToSmash': stubs
  }).default;

Keywords

FAQs

Package last updated on 17 Oct 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc