Module installs the following binary commands:
coverage-badges
- Jest test coverage badges fromcoverage-summary.json
(options: --read, --save)custom-badges
- Configurable badges frombadges.json
(options: --read, --save)version-badge
- Package version badge frompackage.json
(options: --save)
yarn add @adso-ts/badges
Jest coverage report must be saved as coverage-summary.json
, thus requires the following entries in jest.config.js
are necessary:
module.exports = {
...
collectCoverage: true,
coverageReporters: ['json-summary'],
...
};
A config file must be present and pointed to when executing custom-badges
command.
{
"badges": [
{
"badge_name": {
"label": "Badge label",
"value": "value to show",
"color": "hexadecimal color for value background"
}
}
]
}
"scripts": {
"coverage-badges": "coverage-badges --read=custom_path_to_coverage-summary.json --save=custom_badges_folder"
"custom-badges": "custom-badges --read=custom_path_to_badges.json --save=custom_badges_folder"
"version-badge": "version-badge --save=custom_badges_folder"
}
yarn coverage-badges
yarn custom-badges
yarn version-badge
read
: alternative location ofJSON
file (coverage-summary.json
orbadges.json
)save
: custom path to save badge svg files
![Average](./badges/average.svg)
![Lines](./badges/lines.svg)
![Statements](./badges/statements.svg)
![Branches](./badges/branches.svg)
![Functions](./badges/functions.svg)
![Version](./badges/version.svg)
![npm](./badges/npm.svg)
![dependencies](./badges/dependencies.svg)