Wildhoney / babel-plugin-mock-imports

Babel plugin for redirecting and mocking imports

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Babel Plugin Mock Imports

Mock import statements with ease, for testing purposes.

Quickstart

npm install babel-plugin-mock-imports --save-dev

Example usage in .babelrc:

{
	"plugins": [
		["mock-imports", {
			"redirects": [
				{
					"pattern": ".(svg)$",
					"location": "path/to/mocked/react/component"
				},
				{
					"pattern": "^redux-form/es$",
					"location": "redux-form"
				}
			]
		}]
	]
}

The pattern is evaluated using the RegExp constructor.

About

Babel plugin for redirecting and mocking imports

License:MIT License


Languages

Language:JavaScript 100.0%