Connect/Express middleware for NYC (Istanbul) code coverage in server-side and client-side Node.js applications. Version 1.0.4 is current. Provides hookLoader to instrument server code via require() hooks, createHandler to expose live coverage reports (HTML/JSON/lcov), reset, and download endpoints under /coverage, and createClientHandler to serve instrumented browser JS. Ported from istanbul-middleware to use nyc (istanbul v2). No longer actively maintained; latest release is stable.
npm install nyc-middlewareNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up NYC middleware coverage on Express: hooks require() and exposes /coverage endpoints.
Migrate to c8 (built into Node 14+) or use @istanbuljs/nyc-config-babel directly.
Call hookLoader at the very top of your main entry point before requiring any local modules.
Write custom middleware to instrument browser JS or use nyc's built-in instrument command.
Test coverage on your Node version; consider using c8 for native ESM coverage.
Run: npm install nyc-middleware
Use: import { hookLoader } from 'nyc-middleware';Use: import { fileURLToPath } from 'url'; const __dirname = fileURLToPath(new URL('.', import.meta.url));