{"library":"babel-plugin-mockable-imports","type":"library","category":null,"description":"A Babel plugin that transforms JavaScript/TypeScript modules to enable mocking of ES imports in tests. Current stable version is 2.0.1. It works with any test runner, bundler, and environment (Node or browser). Unlike tools like proxyquire or rewire, it operates at the Babel AST level, making it compatible with modern ES module syntax. The plugin detects incorrect usage (e.g., mocking non-existent imports) and is designed to minimize runtime overhead. It supports both JavaScript and TypeScript, and can be selectively enabled via Babel's env configuration.","language":"javascript","status":"active","version":"2.0.1","tags":["javascript","mocking"],"last_verified":"Wed May 27","install":[{"cmd":"npm install babel-plugin-mockable-imports","imports":["module.exports = require('babel-plugin-mockable-imports');","import { $imports } from './module';","$imports.$mock({ 'module-name': { exportName: mockValue } });","$imports.$restore();"]},{"cmd":"yarn add babel-plugin-mockable-imports","imports":[]},{"cmd":"pnpm add babel-plugin-mockable-imports","imports":[]}],"homepage":null,"github":"https://github.com/robertknight/babel-plugin-mockable-imports","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/babel-plugin-mockable-imports","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/babel-plugin-mockable-imports/compatibility"}}