Skip to content

Commit

Permalink
fix: improve logic for handling no changes (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley authored Oct 14, 2022
1 parent f800434 commit 9a36564
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/commands/schema/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ export default class SchemaCompare extends SnapshotCommand {
this.debug('existingSchema', existingSchema)
this.debug('latestSchema', latestSchema)
const changes = diff(latestSchema, existingSchema)
if (changes.length === 0) {
this.log('No changes have been detected.')
return []
}

const humanReadableChanges: Record<string, string[]> = {}
for (const change of changes) {
Expand Down Expand Up @@ -89,6 +85,11 @@ export default class SchemaCompare extends SnapshotCommand {
}
}

if (Object.keys(humanReadableChanges).length === 0) {
this.log('No changes have been detected.')
return []
}

this.log()
this.log(bold(red('Found the following schema changes:')))
for (const [commandId, changes] of Object.entries(humanReadableChanges)) {
Expand Down

0 comments on commit 9a36564

Please sign in to comment.