1. danger-plugin-jest
Danger plugin for Jest
danger-plugin-jest
Package: danger-plugin-jest
Created by: macklinu
Last modified: Tue, 14 Jun 2022 18:11:15 GMT
Version: 1.3.0
License: MIT
Downloads: 85,861
Repository: https://github.com/macklinu/danger-plugin-jest

Install

npm install danger-plugin-jest
yarn add danger-plugin-jest

danger-plugin-jest

Build Status
npm version
semantic-release

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:

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code