Skip to content
This repository has been archived by the owner on Jun 23, 2018. It is now read-only.

Comandeer/rollup-plugin-mockr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.