espower-typescript is an instrumentation library that integrates `power-assert` with TypeScript projects, enabling rich, detailed assertion messages for test failures. It functions as a `mocha` `--require` hook, transforming TypeScript test files (`.ts`, `.tsx`) on the fly to inject power-assert's expressive assertions. The current stable version is 10.0.1. It aims to maintain compatibility with specific TypeScript versions (v2.7+ for v10.x) and Node.js environments (v10+), typically updating to align with major `ts-node` or `typescript` releases rather than a fixed cadence. Its key differentiators include a zero-config mode, automatic `tsconfig.json` detection, internal reliance on `ts-node` for compilation, and support for JSX/React and `allowJs` configurations.
npm install espower-typescriptVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install espower-typescript with its common peer dependencies and run a simple, failing TypeScript test with Mocha to show power-assert's detailed output.
Upgrade your Node.js environment to version 10 or newer.
Update the `typescript` package in your project to version 2.7 or later (`npm install typescript@latest`).
Explicitly add `typescript` to your project's devDependencies: `npm install -D typescript`.
Install necessary type definitions: `npm install -D @types/node @types/mocha`.
Always use the CommonJS-style `import assert = require('assert')` for the assertion module when using `espower-typescript`.Consult the `ts-node` v9 release notes and adjust any `ts-node` specific environment variables or configurations if issues arise.
Install `typescript` as a devDependency: `npm install -D typescript`.
Install the missing type definitions: `npm install -D @types/node`.
Ensure you are using `import assert = require('assert')` for the `assert` module in your test files.Verify your Node.js version is >=10.x. Update Node.js if necessary.