Skip to content

Commit

Permalink
fix: be defensive about missing stats for #365
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Feb 21, 2025
1 parent 56398ea commit abf2355
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ function cypressSplit(on, config, userSpecOrderFn = undefined) {
const specAbsoluteToRelative = {}

on('after:spec', (spec, results) => {
// be defensive about the results
if (!results) {
console.error('cypress-split: Missing results for %s', spec.relative)
return
}
if (!results.stats) {
console.error('cypress-split: Missing stats for %s', spec.relative)
return
}
if (!('failures' in results.stats)) {
console.error('cypress-split: Missing failures for %s', spec.relative)
return
}
if (!('passes' in results.stats)) {
console.error('cypress-split: Missing passes for %s', spec.relative)
return
}
// console.log(results, results)

const passed = results.stats.failures === 0 && results.stats.passes > 0
Expand Down

0 comments on commit abf2355

Please sign in to comment.