Registry / testing / babel-plugin-espower

babel-plugin-espower

JSON →
library3.0.1jsnpmunverified

Babel plugin for power-assert that transforms assertion expressions (assert, assert.ok, assert.equal, etc.) at build time to produce detailed, tree-structured failure messages. Current stable version is 3.0.1 (for Babel 7+). Release cadence is low, driven by power-assert ecosystem updates. Key differentiator: unlike generic assertion libraries, it leverages Babel AST rewriting to embed variable values and expression results into assertion output, enabling richer debugging without runtime instrumentation. Compatible only with Babel 7; separate major versions exist for Babel 6 (2.x) and Babel 5 (1.x).

npm install babel-plugin-espower
INSTALL
IMPORT
SIG · BABEL-PLUGIN-ESPOW
B
babel-plugin-espower
testingjavascriptv3.0.1
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
import espower from 'babel-plugin-espower'
const espower = require('babel-plugin-espower')
Package exports a single function; ESM import is recommended for Babel 7 projects. CJS require works in Node.js but may not be compatible with Babel's plugin resolution across bundlers.
Plugin
plugins: ['babel-plugin-espower']
plugins: [require('babel-plugin-espower')]
In .babelrc or babel.config.js, use the string name. The actual import is rarely needed; Babel resolves strings to the module internally.
Default (Babel API)
babel.transform(code, { plugins: ['babel-plugin-espower'] })
babel.transform(code, { plugins: [espower] })
When using Babel API, the plugin can be specified as a string. The imported function is only needed for advanced usage like custom options (none documented).

Shows a complete example of configuring babel-plugin-espower with Babel 7 and running a mocha test with power-assert.

// Install: npm install --save-dev @babel/core @babel/preset-env babel-plugin-espower power-assert mocha // Create babel.config.js: module.exports = { presets: [['@babel/preset-env', { targets: { node: 'current' } }]], plugins: ['babel-plugin-espower'] }; // test.js import assert from 'power-assert'; const alice = { name: 'alice' }; const bob = { name: 'bob' }; assert(`${alice.name} and ${bob.name}` === `bob and alice`); // Run: npx mocha --require @babel/register test.js
Debug
Known issues
breakingbabel-plugin-espower v3 is incompatible with Babel 6. You must use v2 for Babel 6 and v1 for Babel 5.
fix
Use babel-plugin-espower@2 for Babel 6, babel-plugin-espower@1 for Babel 5, or upgrade to Babel 7.
affects: >=3.0.0
breakingbabel-plugin-espower must be applied after all other syntax transforms (e.g., after preset-env) to work correctly.
fix
Place 'babel-plugin-espower' last in the plugins array in your Babel config.
affects: >=1.0.0
gotchapower-assert must be imported in test files for babel-plugin-espower to have effect; the plugin transforms calls to assert, assert.ok, etc.
fix
Ensure you have `import assert from 'power-assert'` (or `const assert = require('power-assert')`) in every test file using assert.
affects: >=1.0.0
deprecatedbabel-plugin-espower v2 is deprecated for Babel 6 users; actively maintain for Babel 7 only.
fix
Upgrade to Babel 7 and use babel-plugin-espower v3.
affects: 2.x
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-espower'
babel-plugin-espower is not installed or version mismatched with Babel.
fix
Run `npm install --save-dev babel-plugin-espower`. Ensure Babel version matches: Babel 7 uses v3, Babel 6 uses v2, Babel 5 uses v1.
AssertionError: expected [...] to deeply equal [...] (no power-assert output)
babel-plugin-espower is not applied to the test file, or power-assert import is missing.
fix
Add 'babel-plugin-espower' to your Babel plugins configuration (after presets) and ensure test files import power-assert.
Error: Plugin or preset file "babel-plugin-espower" is not a function.
Using a version of babel-plugin-espower incompatible with your Babel version (e.g., v3 with Babel 6).
fix
Check Babel version: Babel 7 -> babel-plugin-espower@3, Babel 6 -> @2, Babel 5 -> @1.
TypeError: Cannot read properties of undefined (reading 'type')
babel-plugin-espower running before syntax transforms, causing AST nodes to not be fully parsed.
fix
Ensure babel-plugin-espower is listed last in the plugins array, after all presets and other plugins.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
@babel/corerequiredPeer dependency for Babel plugin API (Babel 7). Must be installed alongside.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
babel-plugin-espower — npm install babel-plugin-espower · libregistry