You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An overview of what Peril does for Artsy is available in the README repo at /culture/peril.md.
TL:DR on this Repo?
Peril is Danger running on a web-server, this repo is the configuration for that, currently the dangerfiles in org
run on every issue and pull request for all our repos.
To Develop
git clone https://github.com/artsy/peril-settings.git
cd peril-settings
yarn install
yarn jest
code .
You will need node and yarn installed beforehand. You can get them both by running brew install yarn. This will give
you auto-completion and types for Danger/Peril mainly.
RFCs
It's likely that any time you want to make a change here you should consult the Artsy RFC process and apply it on artsy/README.
This self-documents where a rule has come from, making it easy for others to understand how we came to specific rules.
The closure passed to rfc can be async as well.
Testing a rule
We use Jest to test our Dangerfiles. It uses the same techniques as testing a
danger plugin where the global imports from danger are fake.
Create a file for your RFC: tests/rfc_[x].test.ts.
Add a before and after setting up and resetting mocks:
jest.mock("danger",()=>jest.fn())import*asdangerfrom"danger"constdm=dangerasanybeforeEach(()=>{dm.danger={}dm.fail=jest.fn()// as necessary})afterEach(()=>{dm.fail=undefined})
Set up your danger object and run the function exported in all-prs.ts:
importrfcNfrom"../org/all-prs"it("warns when there's there's no assignee and no WIP in the title",async()=>{dm.danger.github={pr: {title: "Changes to the setup script",assignee: null}}awaitrfcN()expect(something).toHappen()// [...]})})
Validate that the fail/warn/message/markdown is called.