shieldgen
v1.0.2
Published
Update your package readme on every test with build status and code coverage
Downloads
8
Maintainers
Readme
shieldgen
Update your package readme on every test with build status and code coverage.
(Because paying >1k a month for badges on private projects would be silly)
Installation
Only supported with Jest.
- Install as dev dependency:
npm i -D shieldgen
- Set to run after jest in package.json
"scripts": {
"test": "jest --json --outputFile coverage/testResults.json && shieldgen"
},
- Enable code coverage in jest.config.js:
module.exports = {
// ...
collectCoverage: true,
coverageReporters: ["html"]
};
Configuration
Configuration for badge colors and messages, as well as optional Airtable integration is specified in .shieldgen.config.json. For integration, AIRTABLE_API_KEY must be set as an environment variable.
Here is an example configuration.
{
"readmePath": "readme.md",
"testing": {
"label": "build",
"testStatusPath": "coverage/testResults.json",
"pass": {
"message": "passed",
"color": "brightgreen"
},
"fail": {
"message": "failed",
"color": "red"
}
},
"coverage": {
"label": "coverage",
"coveragePath": "coverage/index.html",
"zeroCoverageColor": "ee4444",
"fullCoverageColor": "22dd22"
},
"airtableIntegration": {
"baseId": "appbHzsS9UBTiFabc",
"tableName": "Repos",
"nameColumn": "Name",
"testStatusColumn": "Test Status",
"coverageColumn": "Coverage"
}
}