Open
Description
Duties can be executed in different environments (non-exhaustive list):
- On (actual) CI
- On the local machine
- With github metadata (
danger pr
anddanger ci
) - Without github metadata (
danger local
)
- With github metadata (
- (Internal) For testing purposes
Different duties have different implicit assumptions about their
environment right now, but those assumptions are not checked. Clients of
our library have to write those checks themselves if they want to have a
robust dangerfile that works in a variety of scenarios without breaking.
This is error prone for consumers of our API.
We can provide public helpers that check those assumptions and fail if
they aren't met. Users can compose them with duties they write
themselves if they want. We can also use them internally when exporting
our duties to the world. Ex:
src/duties/pr.js
:
module.exports = {
// No changes here. Export uncomposed duties for testing
}
src/duties/index.js
:
let pr = require('./pr')
let autoFix = require('./autoFix')
let { checkGithub } = require('./utils')
module.exports = Object.assign(
{},
_.mapValues(duti => _.flow(checkGithub, duti), pr),
_.mapValues(duti => _.flow(checkActualCI, checkGithub, duti), autoFix),
...
)
Metadata
Metadata
Assignees
Labels
No labels