GithubHelp home page GithubHelp logo

danger-plugin-jest's Introduction

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.

❤️

danger-plugin-jest's People

Contributors

greenkeeper[bot] avatar ken-kenware avatar macklinu avatar miszo avatar orta avatar suheb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

danger-plugin-jest's Issues

Support for BitBucket Server

Danger JS now supports BitBucket Server, but this plugin relies on the github property existing on the danger DSL, and uses HTML, which BBS doesn't support.

I've got a hacked copy of this module in a local repo which I might clean up and PR upstream to support BBS in this module, if it is wanted 😄

Add option to post coverage

Rather than use a service like coveralls, it'd be great if this Danger plugin could post a comment whenever the coverage drops from a PR!

In search of example CircleCI config.yml

First off, thanks for open sourcing this!

I'm having some trouble using this plugin with CircleCI. To be clear, my issue is with CircleCI itself: I seem to be unable to persist my jest output, test-results.json, from one job to the next when the tests fail.

Tl;dr: the persist_to_workspace step doesn't run after my test step fails in the same job, so I have no way of accessing the results in the next job where I run Danger.

If anyone can shed some light on this issue, I'd appreciate it! I fully expect this issue to be closed immediately, but thought it was worth a shot in case anyone can share a working config.yml, or has suggestions. Thanks!

PR comment fails if message is too long

Hi there,

Here is what I got from Jenkins when dealing with a 100+ failed snapshots result :

11:03:16  + yarn danger ci
11:03:16  yarn run v1.15.2
11:03:16  $ /home/agentadmin/workspace/front-newlook_PR-2433/node_modules/.bin/danger ci
11:03:21  Jest tests passed :+1:
11:03:21  
11:03:21  
11:03:22  Failing the build, there is 1 fail.
11:03:27  Request failed [422]: https://api.github.com/repos/onedior/front-newlook/issues/comments/477510827
11:03:27  Response: {
11:03:27    "message": "Validation Failed",
11:03:27    "errors": [
11:03:27      {
11:03:27        "resource": "IssueComment",
11:03:27        "code": "custom",
11:03:27        "field": "body",
11:03:27        "message": "body is too long (maximum is 65536 characters)"
11:03:27      }
11:03:27    ],
11:03:27    "documentation_url": "https://developer.github.com/v3/issues/comments/#edit-a-comment"
11:03:27  }
11:03:27  Feedback: undefined
11:03:28  Done in 11.56s.

Should we truncate the file if it is too long ?

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add option to disable success message

I don't particularly care to see the Danger comment if the Jest tests pass, I can see that in the commit status, I mainly care about seeing the test failures right on GitHub when they fail!

It'd be great if there was an option to disable posting a success message so the comment gets deleted once all tests pass:

screen shot 2017-10-10 at 9 31 17 pm

/cc @orta

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.