Registry / testing / karma-systemjs

karma-systemjs

JSON →
library0.16.0jsnpmunverified

A Karma plugin adapter for loading test files via SystemJS module loader instead of script tags. Current version 0.16.0 disables SystemJS bundles by default; set useBundles: true to enable. Supports transpilers like Babel and TypeScript. Key differentiator: integrates SystemJS module loading into Karma test runner for testing ES modules with transpilation. Requires manual configuration of SystemJS config file and serving of dependencies. Note: The project appears to be in maintenance mode with limited recent activity.

npm install karma-systemjs
INSTALL
IMPORT
SIG · KARMA-SYSTEMJS
K
karma-systemjs
testingjavascriptv0.16.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default (plugin)
plugins: ['karma-systemjs']
require('karma-systemjs')
karma-systemjs is a Karma plugin, not imported directly. Add to plugins array in karma.conf.js.
framework (systemjs)
frameworks: ['systemjs']
frameworks: ['karma-systemjs']
Use the short name 'systemjs' in the frameworks array. Must be the first framework in the list.
System (global)
System.config({...})
import { System } from 'systemjs'
System is available globally after loading systemjs, not imported as ES module inside Node.js config files.

Configures Karma to use SystemJS for loading test files via System.import(), with a separate system config file and additional serve files.

// karma.conf.js module.exports = function(config) { config.set({ frameworks: ['systemjs', 'jasmine'], files: [ 'test/**/*.spec.js' ], plugins: ['karma-systemjs', 'karma-jasmine', 'karma-chrome-launcher'], systemjs: { configFile: 'system.conf.js', serveFiles: [ 'lib/**/*.js' ], config: { paths: { 'angular-mocks': 'node_modules/angular-mocks/angular-mocks.js' } }, useBundles: false }, browsers: ['Chrome'] }); };
karma --version
Debug
Known issues
breakingIn v0.16.0, SystemJS bundles are no longer automatically loaded. You must set useBundles: true in the systemjs config to enable bundle loading.
fix
Set systemjs.useBundles: true in your Karma config if you rely on SystemJS bundles.
affects: >=0.16.0
breakingIn v0.9.0, arrays in SystemJS config file are overwritten by arrays in karma config, rather than merged.
fix
Ensure that the karma config arrays either contain all needed values or use a different approach to avoid data loss.
affects: >=0.9.0 <0.16.0
gotchaThe transpiler (e.g., plugin-babel, traceur) must be served as served:true, included:false in Karma file patterns since v0.13.0.
fix
In your SystemJS config, specify the transpiler path under paths or map; karma-systemjs will handle serving automatically.
affects: >=0.13.0
gotchaPhantomJS v1.x lacks Function.prototype.bind, causing transpiler errors: 'TypeError: undefined is not a function'
fix
Install phantomjs-polyfill and include it in your SystemJS config.
affects: all
deprecatedes6-module-loader is deprecated in favor of systemjs itself; modern SystemJS versions may not need it.
fix
Consider using SystemJS 0.21+ which includes its own polyfill; remove es6-module-loader dependency if not needed.
affects: >=0.16.0
Errors
Common errors & fixes
TypeError: 'undefined' is not a function (evaluating 'Function.prototype.bind')
PhantomJS v1.x does not support Function.prototype.bind, required by transpilers.
fix
Add 'phantomjs-polyfill' to your SystemJS config: System.config({ map: { 'phantomjs-polyfill': 'node_modules/phantomjs-polyfill/bind-polyfill.js' } });
Error: Mismatched anonymous define() module: function (...) { ... }
Files loaded via System.import() that contain AMD define() blocks may conflict with SystemJS's own AMD detection.
fix
Ensure all modules are properly defined as ES modules or System.register; avoid anonymous AMD define() calls.
Upgrade
Version history
0.16.0latest on npm
Audit
Dependencies
systemjsrequiredRequired runtime dependency for module loading
es6-module-loaderrequiredRequired for polyfilling ES6 module loading in older browsers (e.g., PhantomJS)
systemjs-plugin-babeloptionalOptional transpiler plugin for Babel support
phantomjs-polyfilloptionalProvides Function.prototype.bind for PhantomJS v1.x compatibility
Agent activity
2 hits · last 30 days
node
2
Resources
karma-systemjs — npm install karma-systemjs · libregistry