Registry / testing / karma-rollup

karma-rollup

JSON →
library1.0.1jsnpmunverified

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-rollup
INSTALL
IMPORT
SIG · KARMA-ROLLUP
K
karma-rollup
testingjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rollupPreprocessor
// Configure in karma.conf.js – no import needed
const rollupPreprocessor = require('karma-rollup')
This package is a Karma plugin, not a direct import. It's loaded via Karma's plugin system (plugins: ['karma-*']).
customPreprocessors
// Configure in karma.conf.js – no import needed
const customPreprocessors = require('karma-rollup').customPreprocessors
Custom preprocessors are defined inside karma.conf.js per Karma documentation; not exported by this package.
karma-rollup
npm install karma-rollup --save-dev
npm install karma-rollup
Always install as a dev dependency; it's only used during testing.

Basic Karma configuration using karma-rollup preprocessor with Rollup and Bublé for ES2015 transpilation, outputting in IIFE format with inline sourcemaps.

// karma.conf.js module.exports = function(config) { config.set({ basePath: '', frameworks: ['jasmine'], files: [ 'test/**/*.spec.js' ], plugins: [ 'karma-jasmine', 'karma-chrome-launcher', 'karma-rollup' ], preprocessors: { 'test/**/*.spec.js': ['rollup'] }, rollupPreprocessor: { options: { plugins: [require('rollup-plugin-buble')()], output: { format: 'iife', name: 'MyProject', sourcemap: 'inline' } } }, browsers: ['ChromeHeadless'], reporters: ['progress'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, singleRun: false, concurrency: Infinity }); }
Debug
Known issues
gotcha'input' property is handled automatically by karma-rollup; do not set it in rollupPreprocessor.options.
fix
Remove 'input' from options; the input file is determined by Karma's files and preprocessors.
affects: *
gotchaRollup 2.0+ changed the output format structure; older karma-rollup versions may not support Rollup >=2. Check peer dep: rollup >=1.0.0 (but may work with 2.x).
fix
Update karma-rollup or downgrade Rollup to >=1.0.0 <2.0.0; or test with Rollup 2.0 and adjust output config accordingly.
affects: <=1.0.0
gotchaUsing 'rollupPreprocessor' configuration, not 'rollup' – the key must be exactly 'rollupPreprocessor'.
fix
Set the config key as 'rollupPreprocessor' (not 'rollup') in karma.conf.js.
affects: *
gotchaMissing 'name' in output for 'iife' format will cause Rollup error: 'You must supply output.name for IIFE format'.
fix
Add 'output.name: 'YourProject'' to rollupPreprocessor.options.
affects: *
gotchaIf not using default plugins array, ensure 'karma-rollup' is included in the plugins list (or 'karma-*').
fix
Add 'karma-rollup' to config.plugins or use the wildcard pattern 'karma-*'.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'karma-rollup'
karma-rollup is not installed or not listed in plugins.
fix
Run 'npm install karma-rollup --save-dev' and ensure plugins includes 'karma-*' or 'karma-rollup'.
RollupError: You must supply output.name for IIFE format
IIFE output format requires a name to avoid global scope collision.
fix
Add property 'output.name: 'MyProject'' to rollupPreprocessor.options.
Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
Karma Jasmine framework not installed.
fix
Run 'npm install karma-jasmine --save-dev' and add 'jasmine' to frameworks array.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
rolluprequiredPeer dependency: Rollup >=1.0.0 must be installed separately to function.
karmarequiredPeer dependency: Karma is required to run the preprocessor; typically already installed in test projects.
Agent activity
6 hits · last 30 days
node
6
Resources
karma-rollup — npm install karma-rollup · libregistry