1 | # karma-rollup-plugin
|
2 |
|
3 | [![Build Status](https://travis-ci.org/Kflash/karma-rollup-plugin.svg?branch=master)](https://travis-ci.org/Kflash/karma-rollup-plugin)
|
4 | [![npm version](https://img.shields.io/npm/v/karma-rollup-plugin.svg)](https://www.npmjs.org/package/karma-rollup-plugin)
|
5 |
|
6 | > A Karma preprocessor plugin to offer seamless integration with [rollup](http://rollupjs.org/)
|
7 |
|
8 | This plugin is a Karma preprocessor to compile and bundle your spec entry point on the fly. It works seamless with all Rollup plugins.
|
9 |
|
10 | # Features
|
11 |
|
12 | - supports Rollup by default
|
13 | - supports both Babel and Buble as the ES2015 compiler
|
14 | - sourceMap
|
15 | - recompiling of dependencies when files changes
|
16 | - ES3, ES5, ES2015, ES2016, and ES2017 (*with Babel*)
|
17 |
|
18 | # Installation
|
19 |
|
20 | The easiest way is to keep karma-rollup-plugin as a `devDependency`. You can simple do it by:
|
21 |
|
22 | ```js
|
23 | npm i karma-rollup-plugin --save-dev
|
24 | ```
|
25 |
|
26 | # Configuration
|
27 |
|
28 | See [Rollup documentation - JavaScript API](https://github.com/rollup/rollup/wiki/JavaScript-API) for more details.
|
29 |
|
30 | Following code shows the default configuration
|
31 |
|
32 | ```js
|
33 | // karma.conf.js
|
34 | module.exports = function (config) {
|
35 | config.set({
|
36 | preprocessors: {
|
37 | 'test/**/*.js': ['rollup']
|
38 | },
|
39 | rollupPreprocessor: {
|
40 | // rollup settings. See Rollup documentation
|
41 | rollup: {
|
42 | plugins: [
|
43 | multiEntry(), // Allows specifying multiple entry points with rollup.
|
44 | buble() // ES2015 compiler by the same author as Rollup
|
45 | ]
|
46 | })
|
47 | ]
|
48 | },
|
49 | bundle: {
|
50 | sourceMap: 'inline'
|
51 | }
|
52 | }
|
53 | });
|
54 | };
|
55 | ```
|
56 |
|
57 | # Why this plugin?
|
58 |
|
59 | There exist a `karma-rollup-preprocessor` plugin for `Karma`, but it contains too many bugs, and doesn't seem to be maintained atm.
|
60 | This plugin try to stay true to the `Rollup ecosystem`.
|