babel-plugin-mockable-imports

JSON →
library 2.0.1 ·javascript
verified May 27, 2026

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.

total hits 28
actors 8 distinct systems
last hit 2d ago human
Amazonbot
4
MetaBot
4
ByteDance
3
GPTBot
2
Script
1
Search engines
1
Humans
5

top countries 🇺🇸 United States · 🇩🇪 Germany · 🇸🇬 Singapore · 🇨🇦 Canada · 🇬🇧 United Kingdom