1.0.3 • Published 8 years ago

babel-plugin-proxyquire-namespace v1.0.3

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

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;