coverage-slackify
v1.2.7
Published
The `coverage-slackify` package allows you to effortlessly integrate code coverage summaries and build details into your Slack workflow. It simplifies the process of notifying your team about the health of your project's test coverage.
Downloads
15
Readme
Coverage Slackify
The coverage-slackify
package allows you to effortlessly integrate code coverage summaries and build details into your Slack workflow. It simplifies the process of notifying your team about the health of your project's test coverage.
Table of Contents
🚀 Features
- Easily incorporate code coverage summaries and build details into your Slack channels.
- Define pass/fail thresholds for project coverage to keep your team informed about the state of your tests.
- Works smoothly with popular CI/CD platforms like Jenkins, Travis CI, and GitHub Actions.
- Handles scenarios where Git is not enabled or the Slack webhook is not provided with ease.
- Customize default settings through
package.json
for a tailored integration.
🔧 Installation
You can install coverage-slackify via npm or yarn:
npm install --save-dev coverage-slackify
# or
yarn add -D coverage-slackify
📋 Prerequisites
Before using coverage-slackify, make sure you have the following:
- A Slack webhook URL from your Slack workspace.
- Istanbul or Jest coverage report can be generated for your project.
🛠 Usage
Via npm Task
If you prefer using npm tasks, you can include coverage-slackify as part of your testing workflow:
"scripts": {
"test": "jest --coverage",
"test:ci": "npm test && coverage-slackify"
}
Then, you can run the task in your CI/CD pipeline:
SLACK_WEBHOOK=$SLACK_WEBHOOK npm run test:ci
Defining SLACK_WEBHOOK Environment Variable
You can also define the Slack webhook directly as an environment variable:
"scripts": {
"test": "jest --coverage",
"test:ci": "npm test && SLACK_WEBHOOK=https://hooks.slack.com/xxxxx coverage-slackify"
}
Note: Be cautious about exposing your Slack webhook URL in public repositories.
🔧 Custom Configuration
You can override default configurations by adding a coverageSlackify
section in your package.json
:
"coverageSlackify": {
"threshold": 80,
"projectName": "Coverage Slackify",
"coverageFiles": [
"coverage/coverage-final.json"
]
}
🤝 Contributing
Contributions are welcome! If you have any ideas, enhancements, or bug fixes, feel free to open an issue or create a pull request.
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.