Registry / testing / jest-text-formatter

jest-text-formatter

JSON →
library1.0.2jsnpmunverified

CLI tool to convert Jest text coverage output into Reviewdog-compatible format. Current stable version 1.0.2, actively maintained. Supports any Jest text coverage output file; transforms summary table into line-by-line annotations Reviewdog can parse. Key differentiator: enables CI integration with Reviewdog for coverage diff annotations without custom parsing scripts.

npm install jest-text-formatter
INSTALL
IMPORT
SIG · JEST-TEXT-FORMATTE
J
jest-text-formatter
testingjavascriptv1.0.2
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.

format-coverage (binary)
npx format-coverage <input> <output> <rootPath>
const formatter = require('jest-text-formatter')
Package is CLI-only; programmatic API not exposed.
package.json scripts
"scripts": { "format": "format-coverage ./coverage.txt ./out.txt /path" }
No equivalent CommonJS require; must use CLI.
Docker usage
RUN format-coverage coverage.txt /out/coverage.txt /app
Spaces in paths not escaped

Install, generate Jest text coverage, convert to Reviewdog format with source root path.

npm install jest-text-formatter --save-dev # Run Jest with text reporter, save output npx jest --coverage --coverageReporters='text' > coverage.txt # Run formatter npx format-coverage ./coverage.txt ./formatted-coverage.txt /path/to/project/root # Example of output cat ./formatted-coverage.txt # /path/to/project/root/src/index.ts|0|0|0|0| uncovered lines # /path/to/project/root/src/utils.ts|5|5|0|2| 2 uncovered lines
Debug
Known issues
gotchaInput file must contain only the coverage summary; if stderr or other output is mixed in, parse errors occur.
fix
Redirect stderr separately: `npx jest --coverage --coverageReporters='text' 2>/dev/null > coverage.txt`
affects: >=0.0.1
gotchaThe rootPath argument must be an absolute path; relative paths cause malformed output.
fix
Use `pwd` or `${process.cwd()}` to provide absolute path.
affects: >=0.0.1
gotchaOutput file parent directory must exist; tool does not create directories.
fix
Create directory beforehand: `mkdir -p ./outputPath`
affects: >=0.0.1
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '...'
Input or output file path misspelled or parent dir missing
fix
Verify paths and create directories: `mkdir -p $(dirname ./outputPath/coverage.txt)`
Output file is empty
Input file does not contain a valid Jest text coverage summary
fix
Ensure Jest coverage reporter is 'text' and no other output is mixed in. Run `npx jest --coverage --coverageReporters='text' > coverage.txt`
format-coverage: line 1: unexpected EOF while looking for matching `''
Root path contains spaces without escaping
fix
Wrap root path in quotes: `npx format-coverage ... "/path/with spaces/root"`
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
jestoptionalcoverage output needed as input
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
jest-text-formatter — npm install jest-text-formatter · libregistry