Power Assert in JavaScript v1.6.1 (stable, released 2017). Provides descriptive assertion messages via the standard Node.js assert interface. No API is the best API – you only need assert(any_expression). Requires code transformation (via Babel, browserify, webpack, etc.) to generate detailed failure messages. Differentiated from chai/should by reusing the native assert module; you can swap require('power-assert') for require('assert') with zero API change. Works server-side and browser-side. Maintained by the original author but has been stable with infrequent releases.
npm install power-assertVerified import paths — ran on the pinned version, not inferred.
Usage with Babel: augment assert, then use native assert methods; power-assert provides detailed diffs.
Add a code transformation step (Babel plugin, browserify transform, webpack loader, etc.) to your build process.
Use import 'power-assert' at module top; still call require('assert') for assertions.Use npm to install power-assert.
Ensure test files are transformed via Babel, browserify, or other tools. Use babel-plugin-espower or eslint-plugin-espower as part of the build.
Run mocha with --require babel-register and Babel config with babel-plugin-espower.
Use `import 'power-assert'` as a side-effect import, not expecting named exports.
Add babel-plugin-espower to Babel config and run test with Babel.
Run `npm install --save-dev power-assert`.
Switch to ES module import: `import assert from 'assert'` after `import 'power-assert'`.