Skip to content

Commit

Permalink
fix: incomplete diff generations
Browse files Browse the repository at this point in the history
  • Loading branch information
kien-ht committed May 28, 2024
1 parent 7a35b92 commit ee4d121
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,15 @@ const getStatsComparisonAndPopulateDiffIfAny = async (args) => {

if (testFailed) {
fs.ensureFileSync(paths.image.diff(args.testName))
diff.pack().pipe(fs.createWriteStream(paths.image.diff(args.testName)))
const stream = diff
.pack()
.pipe(fs.createWriteStream(paths.image.diff(args.testName)))

// make sure the diff image fully populated before proceeding further
await new Promise((resolve, reject) => {
stream.once('finish', resolve)
stream.once('error', reject)
})
}

return { percentage, testFailed }
Expand Down

0 comments on commit ee4d121

Please sign in to comment.