Skip to content

Commit

Permalink
clean up code using @orta's suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
deecewan committed Feb 21, 2017
1 parent b8cc328 commit a70cc3e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
5 changes: 1 addition & 4 deletions source/runner/Dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ export function contextForDanger(dsl: DangerDSLType): DangerContext {
scheduled: []
}

const schedule = (fn: Function) => {
console.log("scheduling task", fn)
results.scheduled.push(fn)
}
const schedule = (fn: Function) => results.scheduled.push(fn)
const fail = (message: MarkdownString) => results.fails.push({ message })
const warn = (message: MarkdownString) => results.warnings.push({ message })
const message = (message: MarkdownString) => results.messages.push({ message })
Expand Down
4 changes: 3 additions & 1 deletion source/runner/DangerfileRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export async function runDangerfileEnvironment(filename: Path, environment: Dang
runtime.requireModule(filename)
})

return environment.context.results
const results = environment.context.results
await Promise.all(results.scheduled)
return results
}

/**
Expand Down
3 changes: 0 additions & 3 deletions source/runner/Executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ export class Executor {
* @returns {void} It's a promise, so a void promise
*/
async handleResults(results: DangerResults) {
// run the asynchronous code first
console.log("handling scheduled tasks", results.scheduled)
await Promise.all(results.scheduled)
// Ensure process fails if there are fails
if (results.fails.length) {
process.exitCode = 1
Expand Down

0 comments on commit a70cc3e

Please sign in to comment.