Skip to content

Commit

Permalink
fix(cli): exit with code 1 when presets fail
Browse files Browse the repository at this point in the history
  • Loading branch information
innocenzi committed Sep 12, 2022
1 parent a7ea780 commit 1dfe5f9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/cli/src/reporters/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default makeReporter({

const inputs: Array<PromptInput & { response: string }> = []
const updateLog = createLogUpdate(process.stdout)
const failedPresets: Set<string> = new Set([])
let rl: readline.Interface
let timer: NodeJS.Timer
let index = 0
Expand Down Expand Up @@ -258,6 +259,7 @@ export default makeReporter({

// Display errors
if (main.status === 'failed') {
failedPresets.add(main.id)
text += '\n\n'
text += ` ${format.titleFail(` ${main.error?.code ?? 'ERROR'} `)} ${c.red(main.error?.parent?.message ?? main.error?.message ?? main.error?.details ?? 'An unknown error occured.')}`
text += '\n'
Expand Down Expand Up @@ -339,6 +341,10 @@ export default makeReporter({
render()
clearInterval(timer)
rl?.close()

if (failedPresets.size > 0) {
process.exit(1)
}
}, 1)
}
})
Expand Down

0 comments on commit 1dfe5f9

Please sign in to comment.