Socket
Book a DemoInstallSign in
Socket

badge-js-test-coverage

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

badge-js-test-coverage

Library to create unit test badges coverage to Javascript and Typescript

0.0.1
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

Logo

badge-js-test-coverage

This library implements badges for JavaScript test coverage. It supports tests using either Mocha or Jest implementations.

Get Started

Requirements

Configure Jest or Mock.

Mocha Configuration

Using:

"nyc": "^15.1.0",

Add the following to your package.json:

"nyc": {
    "extension": [
      ".js"
    ],
    "reporter": [
      "json-summary",
      "lcov",
      "text"
    ],
    "include": [
      "src"
    ],
    "exclude": "**/*.mock.js"
  }

Run:

nyc report --reporter=lcov --reporter=text --reporter=json-summary

It is necessary to have the .nyc_output folder.

Jest Configuration

Run:

jest --coverage --coverageReporters="json-summary"

It is necessary that the coverage folder exists.

Usage

  • Install the library:
npm install 
  • Run the command:
npx badge-js-test-coverage {badges_output}

Example:

npx badge-js-test-coverage badges_output

Add the following to your README.md:

**Tests Coverage**

| Statements                  | Branches                | Functions                 | Lines             |
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
| ![Statements](./badges_output/statements.svg) | ![Branches](./badges_output/branches.svg) | ![Functions](./badges_output/functions.svg) | ![Lines](./badges_output/lines.svg) |

That will displays something like:

Tests Coverage

StatementsBranchesFunctionsLines
StatementsBranchesFunctionsLines

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  • Fork the Project
  • Create your Feature Branch (git checkout -b feature/AmazingFeature)
  • Commit your Changes (git commit -m 'Add some Feature')
  • Push to the Branch (git push origin feature/Feature)
  • Open a Pull Request

License

Distributed under the MIT License. See LICENSE.md for more information.

Contact

Created by: @marialuisacp - contato@malu.dev

Keywords

jest

FAQs

Package last updated on 18 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.