{"id":19004,"library":"babel-jest-amcharts","title":"babel-jest-amcharts","description":"A Babel Jest transformer plugin customized to work with amCharts libraries. Version 0.0.2 is the latest and only stable release. It patches babel-jest to properly transform amCharts ESM modules during Jest testing. Designed specifically for amCharts 4+ and React projects. Differentiates from generic babel-jest by handling amCharts' non-standard module exports and preventing transformation errors that occur with default Jest configuration.","status":"active","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/abhiisheek/babel-jest-amcharts","tags":["javascript","amcharts4","babel","jest","react"],"install":[{"cmd":"npm install babel-jest-amcharts","lang":"bash","label":"npm"},{"cmd":"yarn add babel-jest-amcharts","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-jest-amcharts","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, required for Jest transformation","package":"babel-jest","optional":false},{"reason":"peer dependency, required for React app preset","package":"babel-preset-react-app","optional":false}],"imports":[{"note":"This package is CJS-only and should be required, not imported as ESM.","wrong":"import babelJest from 'babel-jest-amcharts'","symbol":"default","correct":"module.exports = require('babel-jest-amcharts')"},{"note":"createTransformer is exported as a CJS export. Use destructured require.","wrong":"import { createTransformer } from 'babel-jest-amcharts'","symbol":"createTransformer","correct":"const { createTransformer } = require('babel-jest-amcharts')"},{"note":"getCacheKey is a utility function for Jest cache. Available via destructured require.","wrong":"import { getCacheKey } from 'babel-jest-amcharts'","symbol":"getCacheKey","correct":"const { getCacheKey } = require('babel-jest-amcharts')"}],"quickstart":{"code":"// Install the package and its peer deps\nnpm install --save-dev babel-jest-amcharts @babel/core babel-jest babel-preset-react-app\n\n// In jest.config.js or package.json:\n\"transform\": {\n  \"^.+\\\\.(js|jsx)$\": \"babel-jest-amcharts\"\n},\n\"transformIgnorePatterns\": [\n  \"[/\\\\\\\\]node_modules[/\\\\\\\\](?!(@amcharts)\\\\/).+\\\\.(js|jsx|ts|tsx)$\"\n]\n\n// Example test (__tests__/amcharts.test.js):\nimport * as am4core from '@amcharts/amcharts4/core';\ntest('amCharts loads', () => {\n  expect(am4core).toBeDefined();\n});","lang":"javascript","description":"Installation, Jest configuration setup, and a basic test to verify amCharts loads correctly."},"warnings":[{"fix":"Set transformIgnorePatterns as shown in the README.","message":"The transformIgnorePatterns must include a negative lookahead for @amcharts to allow transformation of amCharts modules.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using ts-jest or babel-jest with TypeScript preset alongside this plugin.","message":"This package overrides the default babel-jest transformer. If you also use TypeScript, you may need additional configuration.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev babel-jest-amcharts @babel/core babel-jest babel-preset-react-app'","cause":"Missing installation of babel-jest-amcharts or its peer dependencies.","error":"Cannot find module 'babel-jest-amcharts' from 'jest.config.js'"},{"fix":"Update transformIgnorePatterns to include '[/\\\\\\\\]node_modules[/\\\\\\\\](?!(@amcharts)\\\\/).+\\\\.(js|jsx|ts|tsx)$'","cause":"Jest is not transforming the amCharts ESM modules because of incorrect transformIgnorePatterns.","error":"SyntaxError: Cannot use import statement outside a module for @amcharts/amcharts4/core"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}