Danger: Desire to mock and simulate the behavior of Danger in a PR

Created on 25 Jul 2016  路  6Comments  路  Source: danger/danger

I am really enjoying the functionality that Danger provides for me in automating a bunch of tasks when performing PRs. There is one aspect that makes this a bit challenging; needing to perform a PR to test out any new behavior or changes to the Dangerfile. I would like a way to locally test out the behavior that Danger will exhibit on the initial and subsequent updates made to a PR.

Ideally: if my current working branch is not the main/default branch of the repo, then in this mocking mode assume i am making a PR from a commit on my current branch to the main/default. Run Danger on the diff created from these differences, and generate the message that would be made onto the PR. Additionally I think it should allow to be passed additional commit hashes to simulate new commits being pushed to the PR as though it were live and generating the changes that would be made to the comment made by Danger on the PR.

I think this behavior is vital to being able to actively develop and advance what is possible with Danger without putting the burden of creating PRs to test things that are visible to everyone else that is part of or watching the same organization.

Local

Most helpful comment

This feature exists in Danger JS now https://github.com/danger/danger-js/pull/473

All 6 comments

Looks like some improvements to danger local

In theory it could be done by:

  • Specifying the head and base commit
  • Replacing the github plugin with one that either has stubbed data, or with something that absorbs all the requests and doesn't crash, as github.pr_body needs to do something. But there's no PR data

This sounds close to what I am looking for, but not sure if they are exactly the same thing. That's being able to run Danger in a pre-commit hook.

That's included in the giant todo list - https://github.com/danger/danger/pull/518

@orta how are the features to danger local looking these days? I had some ideas recently about how this could be incorporated into pre-commit workflows but haven't been up to date with how development is progressing with danger.

Work went into danger pr which takes a lot of the responsibilities away from danger local - I don't think anything has changed WRT danger local in the last 6 months. I think it'd be fine to make the github object be nullable in there, and figure out what it takes to make sure it works reliably i that context

This feature exists in Danger JS now https://github.com/danger/danger-js/pull/473

Was this page helpful?
0 / 5 - 0 ratings