This package has been deprecated

Author message:

The package is no longer maintained.

rollup-plugin-mockr

1.0.5 • Public • Published

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.

Package Sidebar

Install

npm i rollup-plugin-mockr

Weekly Downloads

0

Version

1.0.5

License

MIT

Last publish

Collaborators

  • comandeer