GithubHelp home page GithubHelp logo

jest-reporter-github-issues's Introduction

Jest Reporter for Github Issues

Background

Sometimes, you want a simple way to do alerting without the frills, and on the cheap.

Using Jest reporters is often time used to generate artefacts like HTML reports, but you can also utilise it for logging and applications such as gathering test results to pass them onto another entity.

This simple reporter raises alerts to Github Issues when Jest Tests fails has given me satisfying results.

Applied

The way I have been using it is for tests that are triggered by a machine, either as the result of an event or on a scheduler - eg for synthetic tests .

Here is an example with Github Actions that you could store under .github/workflows/example.yml

name: Synthetic API Tests
on:
  schedule:
    - cron: 0 0 * * *

jobs:
  integration-tests:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - name: "Run integration tests"
        run: npm ci && npm run test
        env:
            GH_SYNTH_TOKEN: ${{ secrets.GH_SYNTH_TOKEN }}
            ISSUE_TITLE: "Synthetic API Tests: Unexpected response from API"

Set up

Add the following to your package.json file, et voilà!

{
  "jest": {
    "reporters": [
      "./jest-reporter-github-issues.js"
    ]
  }
}

If a machine runs your tests, you can use the following options.

{
  "scripts": {
    "test": "jest --ci --passWithNoTests --noStackTrace ."
  }
}

(NB: the outer curly brace should already be in your file)

For best results

For maximum results, you should be notified of new issues via email.

Try the account notifications page, specifically the section under 'Issues' and make sure that you are receiving the notifications via email.

jest-reporter-github-issues's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.