Registry / testing / karma-rollup-preprocessor

karma-rollup-preprocessor

JSON →
library7.0.8jsnpmunverified

Karma preprocessor to bundle ES modules using Rollup. Current stable version 7.0.8 (last released 2021). Release cadence is sporadic with long gaps between major versions. Key differentiators: integrates Rollup into Karma test pipeline, supports all Rollup options, allows multiple configured preprocessors for different transpilation setups. Requires Rollup >=1.0.0 as peer dependency.

npm install karma-rollup-preprocessor
INSTALL
IMPORT
SIG · KARMA-ROLLUP-PREPR
K
karma-rollup-preprocessor
testingjavascriptv7.0.8
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
config.set({ rollupPreprocessor: { ... } })
module.exports = { rollupPreprocessor: ... }
Configuration is set inside Karma config function, not exported directly.
rollup
preprocessors: { 'test/**/*.spec.js': ['rollup'] }
preprocessors: { 'test/**/*.spec.js': ['rollupPreprocessor'] }
The preprocessor name is 'rollup', not 'rollupPreprocessor'. The configuration key is 'rollupPreprocessor'.
customPreprocessors
customPreprocessors: { rollupBabel: { base: 'rollup', options: { ... } } }
customPreprocessors: { rollupBabel: { base: 'rollupPreprocessor', options: { ... } } }
The base preprocessor is referenced as 'rollup', not 'rollupPreprocessor'.

Basic Karma configuration with rollupPreprocessor for bundling test files.

// karma.conf.js module.exports = function(config) { config.set({ files: [ { pattern: 'test/**/*.spec.js', watched: false } ], preprocessors: { 'test/**/*.spec.js': ['rollup'] }, rollupPreprocessor: { plugins: [ require('rollup-plugin-commonjs')(), require('rollup-plugin-node-resolve')() ], output: { format: 'iife', name: 'MyTest', sourcemap: 'inline' } } }); };
Debug
Known issues
deprecatedrollup-plugin-buble and rollup-plugin-babel are no longer maintained; use @rollup/plugin-buble and @rollup/plugin-babel instead.
fix
Replace require('rollup-plugin-buble') with require('@rollup/plugin-buble') and update configuration accordingly.
affects: >=2.0.0
gotchaKarma's file watcher must be disabled for files processed by rollupPreprocessor (watched: false).
fix
Set `watched: false` in the files array for patterns handled by rollup preprocessor.
affects: >=1.0.0
gotchaThe Rollup input option is handled automatically; setting it manually can cause issues.
fix
Do not specify `input` in rollupPreprocessor options; the preprocessor sets it to each test file.
affects: >=2.0.0
gotchaSource map file paths may be incorrect on Windows when using absolute paths.
fix
Use relative paths or update to version 7.0.8 which includes a fix.
affects: >=6.0.0
Errors
Common errors & fixes
Error: Invalid configuration: preprocessors.rollup expected a string or an array of strings.
Preprocessor name used incorrectly (e.g., 'rollupPreprocessor' instead of 'rollup').
fix
In preprocessors config, use 'rollup' as the preprocessor name, not 'rollupPreprocessor'.
TypeError: Cannot read property 'plugins' of undefined
rollupPreprocessor object is missing or not correctly placed in Karma config.
fix
Ensure rollupPreprocessor is defined inside config.set({...}) as a top-level key.
Error: ENOENT: no such file or directory, open '...'
Input file not found because Rollup is trying to resolve a missing module.
fix
Install missing npm packages and configure resolve plugins (e.g., @rollup/plugin-node-resolve).
Upgrade
Version history
7.0.8latest on npm
Audit
Dependencies
rolluprequiredpeer dependency; used for bundling ES modules
Agent activity
9 hits · last 30 days
node
8
Resources
karma-rollup-preprocessor — npm install karma-rollup-preprocessor · libregistry