test-coverage-bundle
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

test-coverage-bundle

Hey there, meet our nifty little test coverage bundle! 🚀 It's your go-to buddy for checking out how well your code is covered. Just toss in a JSON file path, and bam! It'll crunch the numbers and show you how much of your features are cozy under the testing blanket. Perfect for keeping an eye on those UI end-to-end tests, and hey, not just limited to UI!😉🔍

Installation

npm install test-coverage-bundle

Usage

TypeScript

import { calculateUICoverage } from "../src";

calculateUICoverage("./coverage.json");

Considering the provided page mapping: coverage.json. If you haven't specified unique tags for the scenarios, no need to worry – the code takes care of it for you.

[
  {
    "page": "/landing",
    "features": {
      "table view": {
        "Open table view": "@tbl-vw-o-ef5c75d4",
        "Close table view": "@tbl-vw-cls-tbl-vw-818397e3",
        "View table content": "@tbl-vw-vw-tbl-cntnt-21f0400f",
        "Copy table content": "@tbl-vw-cpy-tbl-cntnt-22e5bfde",
        "Download CSV file": "@tbl-vw-dwnld-csv-fl-15717f04",
        "Open additional columns": "@tbl-vw-pn-ddtnl-clmns-08a9628a"
      },
      "periodicity menu": {
        "Default setting": "@prdcty-mn-dflt-sttng-445a8fcf",
        "Select minutes": "@prdcty-mn-slct-mnts-b18ddbc9",
        "Select days": "@prdcty-mn-slct-dys-2ee998c9",
        "Select weeks": "@prdcty-mn-slct-wks-f94b5228",
        "Select months": "@prdcty-mn-slct-mnths-8858db37"
      }
    }
  },
  {
    "page": "/account",
    "features": {
      "email": {
        "Open table view": "@ml-pn-tbl-vw-5c467d57",
        "Close table view": "@ml-cls-tbl-vw-f0088d1b"
      },
      "set new password": {
        "Open table view": "@st-nw-psswrd-pn-tbl-vw-3cd03061",
        "Close table view": "@st-nw-psswrd-cls-tbl-vw-132da7dd"
      }
    }
  }
]

When you toss some new pages into the mix, your console will be buzzing with log outputs, something like this:

Number of Pages: 2
Number of Features: 4
Number of Scenarios: 15
Number of Covered Scenarios: 0
Percentage of Covered Scenarios: 0%
Detailed Coverage Report: [
  {
    "page": "/landing",
    "features": {
      "table view": {
        "Open table view": "non-covered",
        "Close table view": "non-covered",
        "View table content": "non-covered",
        "Copy table content": "non-covered",
        "Download CSV file": "non-covered",
        "Open additional columns": "non-covered"
      },
      "periodicity menu": {
        "Default setting": "non-covered",
        "Select minutes": "non-covered",
        "Select days": "non-covered",
        "Select weeks": "non-covered",
        "Select months": "non-covered"
      }
    }
  },
  {
    "page": "/account",
    "features": {
      "email": {
        "Open table view": "non-covered",
        "Close table view": "non-covered"
      },
      "set new password": {
        "Open table view": "non-covered",
        "Close table view": "non-covered"
      }
    }
  }
]
Overall Uncovered Scenarios:
/landing - table view - Open table view
/landing - table view - Close table view
/landing - table view - View table content
/landing - table view - Copy table content
/landing - table view - Download CSV file
/landing - table view - Open additional columns
/landing - periodicity menu - Default setting
/landing - periodicity menu - Select minutes
/landing - periodicity menu - Select days
/landing - periodicity menu - Select weeks
/landing - periodicity menu - Select months
/account - email - Open table view
/account - email - Close table view
/account - set new password - Open table view
/account - set new password - Close table view

This will churn out identical details in a file labeled coverage_YYYY-MM-DDTHH-MM-SS.SSSZ as well.

Package Sidebar

Install

npm i test-coverage-bundle

Weekly Downloads

4

Version

1.0.2

License

ISC

Unpacked Size

23.5 kB

Total Files

20

Last publish

Collaborators

  • v!w3bb0x