Skip to content
This repository has been archived by the owner. It is now read-only.
No description or website provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.editorconfig
.eslintrc.json
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
package.json

README.md

rollup-plugin-mockr Build Status Dependency Status devDependency Status

Allows mocking ES6 modules for tests. Heavily inspired by rollup-plugin-alias.

Installation

npm install rollup-plugin-mockr [--save-dev]

Usage

import { rollup } from 'rollup';
import mockr from 'rollup-plugin-mockr';

rollup( {
	entry: './src/index.js',
	plugins: [
		mockr( {
			'./src/index.js': {
				exampleLib: 'path/to/localMock'
			}
		} )
	]
} );

You can also specify file extension for ES6 modules:

rollup( {
	entry: './src/index.js',
	plugins: [
		mockr( {
			modules: {
				'./src/index.js': {
					exampleLib: 'path/to/localMock'
				}
			},
			fileExtension: 'jsm'
		} )
	]
} );

You can also specify more than one entry point (added with karma-rollup-preprocessor in mind; unfortunately it doesn't work with rollup-plugin-multi-entry… yet).

rollup( {
	entry: './src/index.js',
	plugins: [
		mockr( {
			'./src/index.js': {
				exampleLib: 'path/to/localMock'
			},
			'./src/index2.js': {
				someOtherLib: 'path/to/localMock2'
			}
		} )
	]
} );

License

See LICENSE file for details.

You can’t perform that action at this time.