Registry / testing / karma-es6-module-preprocessor

karma-es6-module-preprocessor

JSON →
library0.2.0jsnpmunverified

A Karma preprocessor that compiles ES6 module syntax (import/export) to ES5 using the es6-module-transpiler. Version 0.2.0 is the latest and appears to be unmaintained since 2014. It integrates with Karma test runner to transpile ES6 modules on the fly during testing. Note that the es6-module-transpiler project itself is deprecated in favor of Babel or TypeScript. This preprocessor is specific to the es6-module-transpiler and does not support newer transpilers like Babel. For modern projects, use karma-babel-preprocessor instead.

npm install karma-es6-module-preprocessor
INSTALL
IMPORT
SIG · KARMA-ES6-MODULE-P
K
karma-es6-module-preprocessor
testingjavascriptv0.2.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-es6-module-preprocessor'] in karma.conf.js
plugins: ['es6-module-preprocessor']
Karma plugin names must be prefixed with 'karma-' when given as short names in plugins array.
preprocessor configuration
preprocessors: { '**/*.js': ['es6'] }
preprocessors: { '**/*.js': ['es6-module'] }
The preprocessor name in the preprocessors object is 'es6', not 'es6-module'.
CommonJS require
var es6ModulePreprocessor = require('karma-es6-module-preprocessor');
var es6ModulePreprocessor = require('karma-es6-module-preprocessor').default;
The package exports a function as module.exports, not a default export.

Karma configuration to transpile ES6 modules to ES5 using the karma-es6-module-preprocessor during testing.

// karma.conf.js module.exports = function(config) { config.set({ frameworks: ['jasmine'], plugins: ['karma-es6-module-preprocessor', 'karma-jasmine', 'karma-chrome-launcher'], preprocessors: { '**/*.js': ['es6'] }, files: [ 'src/**/*.js', 'test/**/*.test.js' ], browsers: ['ChromeHeadless'], singleRun: true }); };
Debug
Known issues
deprecatedThe es6-module-transpiler project is deprecated and no longer maintained. This preprocessor relies on an outdated transpiler.
fix
Migrate to karma-babel-preprocessor with appropriate Babel presets for ES6 modules.
affects: >=0.0.0
gotchaPreprocessor name must be 'es6' in preprocessors config, not 'es6-module' or 'karma-es6-module-preprocessor'.
fix
Use 'es6' as the preprocessor name in the preprocessors object.
affects: >=0.0.0
gotchaKarma plugins must include the full plugin name prefixed with 'karma-' if using short names.
fix
Set plugins: ['karma-es6-module-preprocessor'] in karma.conf.js.
affects: >=0.0.0
breakingThis plugin only supports Karma >=0.12.0. Older versions are incompatible.
fix
Upgrade Karma to version 0.12.0 or later.
affects: <0.12.0
Errors
Common errors & fixes
Module "es6-module-transpiler" not found
The es6-module-transpiler is not installed as a dependency and this preprocessor depends on it.
fix
Install es6-module-transpiler as a devDependency: npm install es6-module-transpiler --save-dev
No provider for "framework:karma-es6-module-preprocessor"!
The plugin is listed in karma.conf.js with an incorrect name or not installed.
fix
Add 'karma-es6-module-preprocessor' to plugins array and ensure it is installed.
TypeError: Cannot read property 'transpile' of undefined
The es6-module-transpiler has not been found or initialization failed.
fix
Ensure es6-module-transpiler is installed and the path is correct.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
karmarequiredpeer dependency required for Karma plugin integration
Agent activity
2 hits · last 30 days
node
2
Resources
karma-es6-module-preprocessor — npm install karma-es6-module-preprocessor · libregistry