tsaiDavid / typescript-coverage-report

Node command tool to generate TypeScript coverage report

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript coverage report

npm version npm downloads standard-readme compliant MIT Licence

Node command tool to generate TypeScript coverage report.

Background

This package fills the gap of a missing type coverage reporting tool which is present in the Flow ecosystem, strongly inspired by the amazing work done by flow-coverage-report and using data generated by type-coverage.

See Also

I've published an article on How I built a TS coverage report tool, which explains more the roadmap and the resoning.

Install

You can install it globally or locally. My advice is to install it as a project dependency and create a script in your package.json.

yarn add --dev typescript-coverage-tool

# npm users
npm install --save-dev typescript-coverage-tool

Usage

If you installed locally, add this in your scripts section of the package.json.

"scripts": {
  "ts-coverage": "typescript-coverage-report"
}

Then run:

yarn ts-coverage

# npm users
npm run ts-coverage

To set the threshold (80% by default) required, use the --threshold option.

yarn ts-coverage --threshold=99

or, following the type-coverage configuration, you can specify it in your package.json.

"typeCoverage": {
  "atLeast": 90
}

terminal table

summary page

details page

Options

The CLI accepts a list of arguments:

Option Description Default value
-t, --threshold [number] The minimum percentage of coverage required. 80
-o, --outputDir [string] The output directory where to generate the report. coverage-ts
-s, --strict [boolean] Run the check in strict mode. false
-d, --debug [boolean] Show debug information. false

Maintainers

@alexcanessa

Contributing

Feel free to dive in! Open an issue or submit PRs.

On this project we follow the Contributor Covenant Code of Conduct.

Commit messages

This project follows the Angular commit messages, but it's very open to emojis 🤯.

Licence

MIT @ Alessandro Canessa

forthebadge

About

Node command tool to generate TypeScript coverage report

License:MIT License


Languages

Language:TypeScript 76.1%Language:JavaScript 21.8%Language:CSS 2.0%