Skip to content
Check the type coverage of any TypeScript project with this easy npm package
TypeScript JavaScript
Branch: master
Clone or download
jeroenouw Merge pull request #10 from josh/exit-status
Exit with non-zero status if command fails
Latest commit bb0370e Aug 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Updated bin path Jan 19, 2019
src Exit with non-zero status if command fails Aug 6, 2019
.gitignore Placed lib folder in gitignore and added npmignore Feb 6, 2019
.npmignore Placed lib folder in gitignore and added npmignore Feb 6, 2019
CODE_OF_CONDUCT.md Added CODE_OF_CONDUCT and CONTRIBUTING Jan 19, 2019
CONTRIBUTING.md Added CODE_OF_CONDUCT and CONTRIBUTING Jan 19, 2019
LICENSE Setup tscov Jan 19, 2019
README.md Added tscov to '@liftr' framework and deprecated versions below 1.4.0 Jun 1, 2019
package-lock.json Added tscov to '@liftr' framework and deprecated versions below 1.4.0 Jun 1, 2019
package.json
tsconfig.json Made classes, splitted files, updated readme and depedencies, added i… Feb 2, 2019
tslint.json

README.md

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.

License

npmlicense

You can’t perform that action at this time.