karma-es6-shim

raw JSON →
1.0.0 verified Fri May 01 auth: no javascript abandoned

Karma plugin that includes both es5-shim and es6-shim polyfills for testing ES6 features in PhantomJS. Version 1.0.0, last updated in 2016. Designed for projects using AMD/RequireJS and Babel transpilation. Simplifies configuration by ensuring both shims are loaded in the correct order for PhantomJS, which lacks ES5 and ES6 support. No active maintenance since 2016.

error Uncaught TypeError: Array.prototype.find is not a function
cause PhantomJS does not support ES6 methods like Array.find, and the package is not loading polyfills.
fix
Ensure 'es6-shim' is included in karma.conf.js frameworks array after 'requirejs'.
error Module 'es6-shim' is not available
cause Missing npm dependency or incorrect Karma configuration (e.g., frameworks order).
fix
Run 'npm install karma-es6-shim --save-dev' and verify frameworks array in karma.conf.js.
deprecated Package is abandoned; last release in 2016. ES6-shim is largely unnecessary for modern browsers and PhantomJS is no longer maintained.
fix Consider using Karma with a modern headless browser (e.g., ChromeHeadless) that natively supports ES6, or use Babel's polyfill instead.
gotcha Must add 'es6-shim' to frameworks AFTER 'requirejs', not as a plugin. If listed incorrectly, shims may not load.
fix Ensure frameworks array is ordered as ['requirejs', 'es6-shim'].
gotcha Requires PhantomJS with RequireJS. If not using RequireJS, the polyfills may not be injected properly.
fix This package is designed for AMD/RequireJS setups. For other module systems, use es6-shim directly as a plugin or via script tags.
npm install karma-es6-shim
yarn add karma-es6-shim
pnpm add karma-es6-shim

Install karma-es6-shim and add 'es6-shim' to the frameworks array after 'requirejs' in karma.conf.js to load ES5 and ES6 polyfills for PhantomJS.

// Install the package
npm install karma-es6-shim --save-dev

// In karma.conf.js
module.exports = function(config) {
  config.set({
    frameworks: ['requirejs', 'es6-shim'],
    // ... other config
  });
};