Registry / testing / babel-jest-amcharts

babel-jest-amcharts

JSON →
library0.0.2jsnpmunverified

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.

npm install babel-jest-amcharts
INSTALL
IMPORT
SIG · BABEL-JEST-AMCHART
B
babel-jest-amcharts
testingjavascriptv0.0.2
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.

default
module.exports = require('babel-jest-amcharts')
import babelJest from 'babel-jest-amcharts'
This package is CJS-only and should be required, not imported as ESM.
createTransformer
const { createTransformer } = require('babel-jest-amcharts')
import { createTransformer } from 'babel-jest-amcharts'
createTransformer is exported as a CJS export. Use destructured require.
getCacheKey
const { getCacheKey } = require('babel-jest-amcharts')
import { getCacheKey } from 'babel-jest-amcharts'
getCacheKey is a utility function for Jest cache. Available via destructured require.

Installation, Jest configuration setup, and a basic test to verify amCharts loads correctly.

// Install the package and its peer deps npm install --save-dev babel-jest-amcharts @babel/core babel-jest babel-preset-react-app // In jest.config.js or package.json: "transform": { "^.+\\.(js|jsx)$": "babel-jest-amcharts" }, "transformIgnorePatterns": [ "[/\\\\]node_modules[/\\\\](?!(@amcharts)\\/).+\\.(js|jsx|ts|tsx)$" ] // Example test (__tests__/amcharts.test.js): import * as am4core from '@amcharts/amcharts4/core'; test('amCharts loads', () => { expect(am4core).toBeDefined(); });
Debug
Known issues
gotchaThe transformIgnorePatterns must include a negative lookahead for @amcharts to allow transformation of amCharts modules.
fix
Set transformIgnorePatterns as shown in the README.
affects: >=0.0.0
gotchaThis package overrides the default babel-jest transformer. If you also use TypeScript, you may need additional configuration.
fix
Consider using ts-jest or babel-jest with TypeScript preset alongside this plugin.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'babel-jest-amcharts' from 'jest.config.js'
Missing installation of babel-jest-amcharts or its peer dependencies.
fix
Run 'npm install --save-dev babel-jest-amcharts @babel/core babel-jest babel-preset-react-app'
SyntaxError: Cannot use import statement outside a module for @amcharts/amcharts4/core
Jest is not transforming the amCharts ESM modules because of incorrect transformIgnorePatterns.
fix
Update transformIgnorePatterns to include '[/\\\\]node_modules[/\\\\](?!(@amcharts)\\/).+\\.(js|jsx|ts|tsx)$'
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies
babel-jestrequiredpeer dependency, required for Jest transformation
babel-preset-react-apprequiredpeer dependency, required for React app preset
Agent activity
17 hits · last 30 days
node
16
OpenAI (training)
1
Resources
babel-jest-amcharts — npm install babel-jest-amcharts · libregistry