npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@liftr/tscov

v2.0.0

Published

Check the type coverage of any TypeScript project with this easy npm package

Downloads

2,334

Readme

TSCOV - Check the type coverage of any TypeScript project with this easy npm package

The Liftr framework provides a structure and tools to build API's with TypeScript and express. This repo/package is for the coverage of types in TypeScript.

tscov npmversion npmlicense downloads

Quick start

Globally

First globally install @liftr/tscov by running the following in the command line.

npm i @liftr/tscov -g

cd <your-repo-location>

# To run the coverage of the types.
tscov

Project

Go to your local project in the command line.
Then install @liftr/tscov as devDependency by running:

npm i @liftr/tscov --save-dev

And set tscov up by adding an extra npm script in your package.json like this:

"scripts": {
    "tscov": "tscov -m <number>"
},

Then you could run this with:

npm run tscov

How to use

You can use the following commands in the command line or in a project as npm script:

# Show max reachable coverage and covered/uncovered types (default 90% minimal coverage)
tscov

# Define your minimum wanted coverage % by replacing `<number>` (0-100) with `95` for example 
tscov -m <number>
tscov --min-coverage <number>

# Show all uncovered types  
tscov -d
tscov --details

# Test specific folder
tscov -p <path-to-folder/foldername>
tscov --project <path-to-folder/foldername>

# Testing specific files
tscov -p <path-to-folder/foldername> -f <filename>.ts
tscov --project <path-to-folder/foldername> --file <filename>.ts

# Start debugging
tscov --debug

# Show version
tscov -v
tscov --version

# Show all available options
tscov -h
tscov --help

Example output

Example by running this command: tscov --min-coverage=95.

  _____   ____     ____    ___   __     __
 |_   _| / ___|   / ___|  / _ \  \ \   / /
   | |   \___ \  | |     | | | |  \ \ / /
   | |    ___) | | |___  | |_| |   \ V /
   |_|   |____/   \____|  \___/     \_/

The TypeScript CLI to calculate type coverage


----------------- coverage ------------------
3337 - max reachable type coverage
3287 - types covered
50 - types uncovered

98.50% - coverage percentage
You can run "tscov --details" to show all uncovered types.

Contributing

Want to file a bug, contribute some code, or improve documentation? Feel free to place an issue.

First fork this project.

git clone <your-forked-repo>
npm install

git checkout -b my-fix
# fix some code...

git commit -m "added this feature"
git push origin my-fix

Lastly, open a pull request on Github.

The following npm script are available

  • npm start - create build, install globally and run tscov
  • npm run build - create build
  • npm run global - install globally and run tscov
  • npm run link-upstream - add remote
  • npm run sync - fetch, checkout, merge and push
  • npm run reset - removes node modules, package-lock.json, lib and re-installs everything.