Karma preprocessor that bundles ES2015 modules using Rollup for testing. Version 1.0.1 is the latest stable release (as of 2023+). Designed for use with Karma test runner, it integrates Rollup as a preprocessor to transpile and bundle ES module imports/exports into a single file per test file. Supports Rollup plugins (e.g., Bublé, Babel), custom preprocessors, watch mode with caching, and sourcemaps. Differentiators: lightweight compared to Webpack-based preprocessors, leverages Rollup's tree-shaking and fast bundling. Requires Rollup >=1.0.0 as a peer dependency.
npm install karma-rollupVerified import paths — ran on the pinned version, not inferred.
Basic Karma configuration using karma-rollup preprocessor with Rollup and Bublé for ES2015 transpilation, outputting in IIFE format with inline sourcemaps.
Remove 'input' from options; the input file is determined by Karma's files and preprocessors.
Update karma-rollup or downgrade Rollup to >=1.0.0 <2.0.0; or test with Rollup 2.0 and adjust output config accordingly.
Set the config key as 'rollupPreprocessor' (not 'rollup') in karma.conf.js.
Add 'output.name: 'YourProject'' to rollupPreprocessor.options.
Add 'karma-rollup' to config.plugins or use the wildcard pattern 'karma-*'.
Run 'npm install karma-rollup --save-dev' and ensure plugins includes 'karma-*' or 'karma-rollup'.
Add property 'output.name: 'MyProject'' to rollupPreprocessor.options.
Run 'npm install karma-jasmine --save-dev' and add 'jasmine' to frameworks array.