Registry / testing / karma-sourcemap-loader

karma-sourcemap-loader

JSON →
library0.4.0jsnpmunverified

A Karma plugin preprocessor that loads existing JavaScript source map files (both inline and external) into the Karma test runner. Version 0.4.0 is current stable. Unlike karma-sourcemap-preprocessor, this plugin does not generate source maps but locates them from previous build steps (e.g., TypeScript, Babel, webpack). It supports remapping source paths via prefix replacement or custom callback, and modifying sourceRoot. Inline source maps using base64 are also supported. Release cadence is low, primarily maintenance updates. Key differentiator: solves source map loading when compilation happens outside Karma.

npm install karma-sourcemap-loader
INSTALL
IMPORT
SIG · KARMA-SOURCEMAP-LO
K
karma-sourcemap-loader
testingjavascriptv0.4.0
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

sourcemap
preprocessors: { '**/*.js': ['sourcemap'] }
preprocessors: { '**/*.js': ['karma-sourcemap-loader'] }
The preprocessor name is 'sourcemap', not the package name.
sourceMapLoader
config.set({ sourceMapLoader: { ... } })
config.set({ sourcemapLoader: { ... } })
Configuration key must use camelCase: sourceMapLoader (capital M) in karma.conf.js.
remapPrefixes
sourceMapLoader: { remapPrefixes: { '/myproject/': '../src/' } }
sourceMapLoader: { remap: { '/myproject/': '../src/' } }
The exact key is 'remapPrefixes', not 'remap' or 'prefixes'.

Configures Karma to load existing source maps for all JS files, remapping paths with a prefix.

// karma.conf.js module.exports = function(config) { config.set({ basePath: '', frameworks: ['jasmine'], files: ['src/**/*.js', 'test/**/*.spec.js'], preprocessors: { '**/*.js': ['sourcemap'] }, sourceMapLoader: { remapPrefixes: { '/myproject/': '../src/' } }, browsers: ['ChromeHeadless'], singleRun: true }); };
Debug
Known issues
gotchaPreprocessor name is 'sourcemap' not 'karma-sourcemap-loader'.
fix
Use 'sourcemap' as the preprocessor name in preprocessors config.
affects: >=0.2.0
gotchaConfiguration key is 'sourceMapLoader' (camelCase) not 'sourcemaploader' or 'source-map-loader'.
fix
Use 'sourceMapLoader' in config.set().
affects: >=0.3.0
breakingRemoved Node.js < 10 support. Graceful-fs usage may break on older Node.
fix
Upgrade Node.js to version 10 or later.
affects: >=0.4.0
deprecatedThe 'remapSource' callback function may be deprecated in future versions; prefer 'remapPrefixes'.
fix
Use 'remapPrefixes' object instead of 'remapSource' function if possible.
affects: >=0.4.0
Errors
Common errors & fixes
Error: No provider for "sourcemap"! (Resolving: sourcemap)
Preprocessor name 'sourcemap' is misspelled or not configured correctly.
fix
Ensure preprocessors config uses 'sourcemap' exactly, e.g., preprocessors: { '**/*.js': ['sourcemap'] }.
ReferenceError: module is not defined in ES module scope
Using CommonJS module.exports in an ESM project (package.json type: module).
fix
Rename file to .cjs or use export default or dynamic import() for ES modules.
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies
graceful-fsrequiredUsed for filesystem operations to load source map files
Agent activity
2 hits · last 30 days
node
2
Resources
karma-sourcemap-loader — npm install karma-sourcemap-loader · libregistry