This plugin analyzes your last pull request, and displays the code coverage on the new files and modified files you just wrote
You need to install Danger JS first:
yarn add -D danger
Then add this package
yarn add -D code-coverage-dangerjs-plugin
- Create a dangerfile (dangerfile.js or dangerfile.ts at the root of your project folder)
- Edit it with
import { sendCoverageMessage } from "code-coverage-dangerjs-plugin";
sendCoverageMessage();
- Run locally to test if it works
yarn danger local
You should see some lines in your terminal
-
Run with your Continuous Integration system:
- Follow the steps described in the "Setting up Danger to run on your CI" section of the GETTING STARTED WITH DANGER JS page
- Generate a new GitHub Token
- Add it in your CI environment
Example for Circle CI:
version: 2
jobs:
build:
steps:
- run: ... YOUR OTHER STEPS ...
- run:
name: Run Danger
command: yarn danger ci
environment:
DANGER_GITHUB_API_TOKEN: YOUR_GITHUB_TOKEN
- Push a new PR and run the CI on it.
- Go see your pull request with a useful comment!
- ⭐️Add a star on this repo if you like it ;)