danger-plugin-jest
danger-plugin-jest copied to clipboard
Danger plugin for Jest
danger-plugin-jest
Danger plugin for Jest
Usage
Setup Jest
This Danger plugin relies on modifying your Jest configuration slightly on CI to also output a JSON file of the results.
You need to make the yarn jest command include: --outputFile test-results.json --json. This will run your tests
like normal, but will also create a file with the full test results after.
You may also want to add the JSON output file to your
.gitignore, since it doesn't need to be checked into source control.
Setup Danger
Install this Danger plugin:
yarn add danger-plugin-jest --dev
By default, this package will assume you've set the filename as test-results.json, but you can use any path.
// dangerfile.js
import path from 'path'
import jest from 'danger-plugin-jest'
// Default
jest()
// Custom path
jest({ testResultsJsonPath: path.resolve(__dirname, 'tests/results.json') })
See src/index.ts for more details.
Changelog
See the GitHub release history.
Development
Install Yarn, and install the dependencies - yarn install.
Run the Jest test suite with yarn test.
This project uses semantic-release for automated NPM package publishing.
:heart: