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
Right now we eval to run the dangerfile, and in most peril setups there's this faff:
constisJest=typeofjest!=="undefined"// Stores the parameter in a closure that can be invoked in tests.conststoreRFC=(reason: string,closure: ()=>void|Promise<any>)=>// We return a closure here so that the (promise is resolved|closure is invoked)// during test time and not when we call rfc().()=>(closureinstanceofPromise ? closure : Promise.resolve(closure()))// Either schedules the promise for execution via Danger, or invokes closure.construnRFC=(reason: string,closure: ()=>void|Promise<any>)=>schedule(closure)constrfc: any=isJest ? storeRFC : runRFC
Which is needed to write tests, and to setup the schedule system which isn't needed in sandbox'd environments like peril-staging but we can verify and wrap it in a scheduler anyway on heroku instances
But what if instead you could provide a default export and that is evaluated or tested? Then you get logical async scope easily, and can test trivially too.
exportdefaultasync()=>{if(danger...
}
Might be even better for the DSL because the webhook could be passed in which fixes the awkward const gh = (danger.github as any) as Create too
Right now we eval to run the dangerfile, and in most peril setups there's this faff:
Which is needed to write tests, and to setup the schedule system which isn't needed in sandbox'd environments like peril-staging but we can verify and wrap it in a scheduler anyway on heroku instances
But what if instead you could provide a default export and that is evaluated or tested? Then you get logical async scope easily, and can test trivially too.
Might be even better for the DSL because the webhook could be passed in which fixes the awkward
const gh = (danger.github as any) as Create
tooThe text was updated successfully, but these errors were encountered: