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

karma-sabarivka-reporter

v3.3.1

Published

A Karma plugin. Adds untested files to istanbul coverage statistic

Downloads

52,841

Readme

logo

karma-sabarivka-reporter Version Badge

Code coverage badge Snyk Vulnerabilities badge Maintainability Language grade: JavaScript

NPM badge

⭐️ Please, star me on GitHub — it helps!

karma-sabarivka-reporter – is a Karma plugin which adds untested files to istanbul coverage statistic

screenshot before

screenshot after

📖 Table of Contents

❓ Why? 🔝

With karma, to test source code – you need to include only *.spec.(ts|js) files into test config. Then those spec files will import corresponding source code files. This leads to an issue with "fake" test coverage, as if some source code file would be omitted by all *.spec.(ts|js)) files – this source code file won't be shown in coverage report at all.

karma-sabarivka-reporter plugin fixes described issue by going through all the source files and including them explicitly into coverage result.

Plugin works with both: TypeScript (*.ts) and JavaScript (*.js) files

✨ Features 🔝

💾 Install 🔝

With npm installed, run

npm install --save-dev karma-sabarivka-reporter

🎛️ API 🔝

@param {string[] | string} coverageReporter.include - Glob pattern, string or array of strings. Files which should be included into the coverage result.

🤹 Usage 🔝

Important Note: if used with karma-coverage, 'sabarivka' should go before 'coverage' in reporters list

Update karma.conf.js

include as array of strings 🔝

reporters: [
  // ...
  'sabarivka'
  // 'coverage-istanbul' or 'coverage' (reporters order is important for 'coverage' reporter)
  // ...
],
coverageReporter: {
  include: [
      // Specify include pattern(s) first
      'src/**/*.(ts|js)',
      // Then specify "do not touch" patterns (note `!` sign on the beginning of each statement)
      '!src/main.(ts|js)',
      '!src/**/*.spec.(ts|js)',
      '!src/**/*.module.(ts|js)',
      '!src/**/environment*.(ts|js)'
  ]
},

Same result may be achieved with more complex one line glob pattern

include as string 🔝

reporters: [
  // ...
  'sabarivka'
  // 'coverage-istanbul' or 'coverage' (reporters order is important for 'coverage' reporter)
  // ...
],
coverageReporter: {
    include: 'src/**/!(*.spec|*.module|environment*|main).(ts|js)',
},

karma plugins section 🔝

If your karma config has plugins section, add also karma-sabarivka-reporter there, otherwise — no action is required.

Karma's documentation:

By default, Karma loads all sibling NPM modules which have a name starting with karma-*.
You can also explicitly list plugins you want to load via the plugins configuration setting. The configuration value can either be a string (module name), which will be required by Karma, or an object (inlined plugin).

See here more info on how karma plugins loading works

plugins: [
  // ...
  require('karma-sabarivka-reporter'),
  // ...
],

📄 License 🔝

This software is licensed under the MIT

Stargazers over time