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 🙏

© 2026 – Pkg Stats / Ryan Hefner

angular-templates-code-coverage

v3.3.8

Published

Provides code coverage for angular templates

Downloads

133

Readme

Angular-Templates-Code-Coverage

This is a script to check unit tests exist for your Angular HTML templates. It checks for unit tests with titles that include the id of the html elements.

Version: 3.3.8 Updated: 30th Oct 2021

It checks for:

  • ngIf elements -
    • A test that the element is shown. The title of the test should contain the words 'should show' and the id of the element.
    • A test that the element is not shown. The title of the test should contain the words 'shouldnt show' and the id of the element.
  • ngFor elements -
    • A test that the correct number of elements are shown. The title of the test should contain the words 'should show the correct number of' and the id of the element.
  • outputs -
    • A test for each output to check that the correct function is called. The title of each test should contain the name of the output, a space and then the id of the element. e.g. 'outputName id'.
  • inputs -
    • A test for each input to check that the correct data is passed down to the child component. The title of each test should contain the name of the input, a space and then the id of the element. e.g. 'inputName id'.
  • ngClass -
    • A test for each class in ngClass to check that the class is applied. The title of the test should contain the words 'should apply' and then the name of the class and the id of the element. e.g. 'should apply show testId'.
    • A test for each class in ngClass to check that the class is not applied. The title of the test should contain the words 'should not apply' and then the name of the class and the id of the element. e.g. 'should not apply show testId'.
  • fields set correctly -
    • A test for each input element to check the correct field updates when the user enters a new value. The title of the test should contain the words 'set the field' and then the id of the element. e.g. 'set the field testId'.
    • A test for each textarea element to check the correct field updates when the user enters a new value. The title of the test should contain the words 'set the field' and then the id of the element. e.g. 'set the field testId'.

Imgur

It will print out the coverage percentage of your html templates. It will throw an error if the coverage is less than the failBelow limit you specify. Default is 80%.

NPM https://www.npmjs.com/package/angular-templates-code-coverage GitHub https://github.com/s3nt1n3lz21/Angular-Templates-Code-Coverage

Install

npm install angular-templates-code-coverage --save-dev

Usage

template-coverage --failBelow=70

Development

This git repo contains both the NPM package and a folder called 'test' that contains a test angular app with HTML Templates, that we can test the NPM package against before publishing it publicly to www.npmjs.com.

We first create a local private NPM registry using Verdaccio. We publish the package to this Verdaccio registry, then download and install it from here into our test app.

Install verdaccio

npm install --global verdaccio

Run verdaccio, a local private npm registry will be created on your computer at http://localhost:4873

verdaccio

Publish the package to this private repo using

npm publish --registry http://localhost:4873

In the terminal, change directories to the root of the test app. Then install the package into the test app

npm install angular-templates-code-coverage --registry http://localhost:4873

Run the package for the test app

template-coverage

Publishing To NPM

To publish to NPM, first login using

npm login

Publish the package using

npm publish