Registry / testing / coverage-putty

coverage-putty

JSON →
library0.1.0jsnpmunverified

coverage-putty is a transform preprocessor for Jest that uses Istanbul to exclude JavaScript helper functions generated by the TypeScript transpiler from coverage reports. Version 0.1.0 is the current release, with no recent updates. It helps avoid skewing coverage metrics with boilerplate TypeScript output. Only works with Jest and Istanbul; requires manual transform configuration. No competing packages address this exact niche.

npm install coverage-putty
INSTALL
IMPORT
SIG · COVERAGE-PUTTY
C
coverage-putty
testingjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

istanbul-ignore.js
transform: { 'src/.*\\.js$': 'coverage-putty/istanbul-ignore.js' }
transform: { 'src/.*\\.js$': 'coverage-putty' }
The transform expects a path to the file istanbul-ignore.js inside the package.
Coordination
npm install coverage-putty --save-dev
npm install coverage-putty --save
This is a dev dependency, used only during testing.
Configuration
Use Jest's transform option in package.json or jest.config.js
Use transformIgnorePatterns
transformIgnorePatterns is for ignoring modules from transforming, not for applying a custom transform.

Configures Jest to use coverage-putty for transforming JS files, excluding TypeScript-generated helpers from coverage.

// package.json { "jest": { "collectCoverage": true, "coverageDirectory": "report/", "collectCoverageFrom": [ "src/**/*.js" ], "transform": { "src/.*\\.js$": "coverage-putty/istanbul-ignore.js" } } } // Run tests npx jest --coverage
Debug
Known issues
gotchaTransform file pattern must be a JavaScript RegExp string, not a file glob.
fix
Ensure the pattern starts with 'src/' and includes proper escaping for dots: 'src/.*\\.js$'.
affects: >=0.1.0
gotchacoverage-putty only works with JavaScript files that are output of TypeScript compilation; will not work if you point it at .ts files.
fix
Compile TypeScript to JS first (e.g., via ts-jest or tsc), then apply the transform on the JS files.
affects: >=0.1.0
deprecatedThe package has not been updated since 2018; may not be compatible with latest Jest versions.
fix
Consider using 'jest-coverage-ignore' or similar alternatives, or test with your Jest version.
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'coverage-putty'
Package not installed or not listed in devDependencies.
fix
Run npm install coverage-putty --save-dev
TypeError: Cannot read property 'transform' of undefined
Jest configuration is missing or malformed.
fix
Ensure 'jest' key exists in package.json with 'transform' object containing the pattern.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
coverage-putty — npm install coverage-putty · libregistry