Home

Awesome

TypeScript Coverage Report

npm version npm downloads standard-readme compliant MIT Licence Automated Release Notes by gren

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

All Contributors

<!-- ALL-CONTRIBUTORS-BADGE:END -->

Node command line tool for generating TypeScript coverage reports ✨

Overview

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 an example of the coverage report.

Background

To learn more about the reasoning behind this project and its roadmap, please refer to the following article: How I built a TS coverage report tool

Install

typescript-coverage-report can be installed locally or globally.

Users are advised to install it as a project (dev) dependency and create a script in package.json.

$ yarn add --dev typescript-coverage-report

# OR

$ npm install --save-dev typescript-coverage-report

Usage

If installed locally, add the following to the scripts section of package.json.

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

Then run:

$ yarn ts-coverage

# OR

$ npm run ts-coverage

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

$ yarn ts-coverage --threshold=99

As an alternative, options may be provided through the type-coverage configuration, specified in package.json.

"typeCoverage": {
  "atLeast": 90
}

terminal table

summary page

details page

Options

The CLI accepts a list of arguments:

OptionDescriptionDefault 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
-c, --cache [boolean]Save and reuse type check result from cache.false
-p, --project [string]File path to tsconfig file, eg: --project "./app/tsconfig.app.json".
-i, --ignore-files [boolean]Ignore specified files, eg: --ignore-files "demo1/*.ts" --ignore-files "demo2/foo.ts"false
-u, --ignore-unread [boolean]Allow writes to variables with implicit any typesfalse

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.

Developing

Thanks for contributing!

Remember to run the following commands to link your version of this package and build the TypeScript files.

# Link the package globally, so you'll be able to test it in other projects.
$ yarn link
# Builds the TypeScript files and watches for changes
$ yarn build --watch

Commit messages

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

Contributors ✨

Thanks goes to these wonderful people (emoji key):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tbody> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/tsaiDavid"><img src="https://avatars3.githubusercontent.com/u/12259854?v=4?s=100" width="100px;" alt="David Tsai"/><br /><sub><b>David Tsai</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=tsaiDavid" title="Documentation">📖</a> <a href="https://github.com/alexcanessa/typescript-coverage-report/issues?q=author%3AtsaiDavid" title="Bug reports">🐛</a></td> <td align="center" valign="top" width="14.28%"><a href="https://wvvw.me"><img src="https://avatars2.githubusercontent.com/u/6525926?v=4?s=100" width="100px;" alt="Alexis Tyler"/><br /><sub><b>Alexis Tyler</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/issues?q=author%3AOmgImAlexis" title="Bug reports">🐛</a></td> <td align="center" valign="top" width="14.28%"><a href="https://effectivetypescript.com"><img src="https://avatars1.githubusercontent.com/u/98301?v=4?s=100" width="100px;" alt="Dan Vanderkam"/><br /><sub><b>Dan Vanderkam</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=danvk" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="http://dignat.se"><img src="https://avatars2.githubusercontent.com/u/2315367?v=4?s=100" width="100px;" alt="Daniel Edholm Ignat"/><br /><sub><b>Daniel Edholm Ignat</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=dignite" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://kyle.kiwi"><img src="https://avatars0.githubusercontent.com/u/16009897?v=4?s=100" width="100px;" alt="Kyℓe Hensel"/><br /><sub><b>Kyℓe Hensel</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=k-yle" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/cabello"><img src="https://avatars.githubusercontent.com/u/60936?v=4?s=100" width="100px;" alt="Danilo Cabello"/><br /><sub><b>Danilo Cabello</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=cabello" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="http://sanjaypojo.com"><img src="https://avatars.githubusercontent.com/u/4957294?v=4?s=100" width="100px;" alt="Sanjay Guruprasad"/><br /><sub><b>Sanjay Guruprasad</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/issues?q=author%3Asanjaypojo" title="Bug reports">🐛</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://stackexchange.com/users/4249831/luislhl?tab=accounts"><img src="https://avatars.githubusercontent.com/u/5041650?v=4?s=100" width="100px;" alt="Luis Helder"/><br /><sub><b>Luis Helder</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/issues?q=author%3Aluislhl" title="Bug reports">🐛</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/tomardern"><img src="https://avatars.githubusercontent.com/u/1135454?v=4?s=100" width="100px;" alt="Tom Ardern"/><br /><sub><b>Tom Ardern</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/issues?q=author%3Atomardern" title="Bug reports">🐛</a> <a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=tomardern" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/lroskoshin"><img src="https://avatars.githubusercontent.com/u/53659626?v=4?s=100" width="100px;" alt="lroskoshin"/><br /><sub><b>lroskoshin</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=lroskoshin" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/MhMadHamster"><img src="https://avatars.githubusercontent.com/u/4090965?v=4?s=100" width="100px;" alt="Max Burmagin"/><br /><sub><b>Max Burmagin</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=MhMadHamster" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://ceramichacker.com"><img src="https://avatars.githubusercontent.com/u/38059171?v=4?s=100" width="100px;" alt="Alexander Skvortsov"/><br /><sub><b>Alexander Skvortsov</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=askvortsov1" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/adicuco/"><img src="https://avatars.githubusercontent.com/u/16133586?v=4?s=100" width="100px;" alt="Adi Cucolaș"/><br /><sub><b>Adi Cucolaș</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=adicuco" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/StaRenn"><img src="https://avatars.githubusercontent.com/u/58230797?v=4?s=100" width="100px;" alt="Stanislav Golyshev"/><br /><sub><b>Stanislav Golyshev</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=StaRenn" title="Code">💻</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/roikoren755"><img src="https://avatars.githubusercontent.com/u/26850796?v=4?s=100" width="100px;" alt="roikoren755"/><br /><sub><b>roikoren755</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=roikoren755" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/jinphic"><img src="https://avatars.githubusercontent.com/u/78671853?v=4?s=100" width="100px;" alt="jinphic"/><br /><sub><b>jinphic</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=jinphic" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="http://brandonbarker.me"><img src="https://avatars.githubusercontent.com/u/4194371?v=4?s=100" width="100px;" alt="Brandon Barker"/><br /><sub><b>Brandon Barker</b></sub></a><br /><a href="https://github.com/alexcanessa/typescript-coverage-report/commits?author=ProjectBarks" title="Code">💻</a></td> </tr> </tbody> </table> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the all-contributors specification. Contributions of any kind welcome!

Licence

MIT @ Alessandro Canessa

forthebadge