Registry / testing / karma-rollup-plugin

karma-rollup-plugin

JSON →
library0.2.4jsnpmunverified

A Karma preprocessor plugin that integrates Rollup for on-the-fly bundling and ES2015+ transpilation in test environments. Current version is 0.2.4 (stable, but rarely updated). It supports Rollup plugins, source maps (inline), and multiple ES versions via Babel or Buble. Compared to alternatives like karma-rollup-preprocessor, this plugin is simpler, more actively maintained at the time, and more aligned with the Rollup ecosystem. However, it lacks modern Rollup features and may not work with Rollup >=1.0.

npm install karma-rollup-plugin
INSTALL
IMPORT
SIG · KARMA-ROLLUP-PLUGI
K
karma-rollup-plugin
testingjavascriptv0.2.4
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 (Karma config key)
// In karma.conf.js rollupPreprocessor: { /* options */ }
rollupPreprocessor: require('karma-rollup-plugin')
The plugin is automatically loaded by Karma. No explicit require() in karma.conf.js.
Plugin as a module (programmatic use)
const karmaRollup = require('karma-rollup-plugin');
import karmaRollup from 'karma-rollup-plugin';
Plugin exports a function for programmatic configuration, but typically used via Karma config.
Preprocessor in preprocessors
preprocessors: { 'test/**/*.js': ['rollup'] }
preprocessors: { 'test/**/*.js': ['karma-rollup-plugin'] }
Use the short name 'rollup', not the package name.

Configures Karma to use the rollup preprocessor for test files, with Rollup and Buble plugin for transpilation.

// karma.conf.js module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine'], files: [ 'test/**/*.spec.js' ], preprocessors: { 'test/**/*.spec.js': ['rollup'] }, rollupPreprocessor: { plugins: [ require('rollup-plugin-buble')() ], format: 'iife', sourceMap: 'inline' }, reporters: ['progress'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['ChromeHeadless'], singleRun: false }); };
Debug
Known issues
breakingNo support for Rollup >=1.0 due to API changes.
fix
Upgrade to a maintained fork or use karma-rollup-preprocessor with Rollup compatibility.
affects: >=0.2.4
deprecatedPackage is no longer actively maintained; last release was years ago.
fix
Consider using @open-wc/karma-esm or karma-rollup-preprocessor.
affects: >=0.0.0
gotchaUsing 'umd' format without a module name throws a warning and may produce unexpected results.
fix
Always specify a module name when using 'umd', or use 'iife' for tests.
affects: >=0.0.0
gotchaSource maps must be 'inline' because Karma expects them inlined for proper debugging.
fix
Set sourceMap: 'inline' in rollupPreprocessor config.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup'
Rollo is not installed or is a missing peer dependency.
fix
Run: npm install rollup --save-dev
TypeError: rollup.rollup is not a function
Incompatible Rollup version >=1.0 where API changed.
fix
Install Rollup 0.x: npm install rollup@0.68.2 --save-dev
WARN: 'umd' format requires a module name. Use the 'moduleName' option.
Using 'umd' format without 'moduleName' in rollupPreprocessor.
fix
Add moduleName to rollupPreprocessor or switch to 'iife'.
Upgrade
Version history
0.2.4latest on npm
Audit
Dependencies
rolluprequiredpeer dependency for bundling functionality
Agent activity
8 hits · last 30 days
node
8
Resources
karma-rollup-plugin — npm install karma-rollup-plugin · libregistry