(step)
| 245 | }) |
| 246 | |
| 247 | async function persistStep(step) { |
| 248 | if (stepNum === -1) return |
| 249 | if (isStepIgnored(step)) return |
| 250 | if (step.metaStep && step.metaStep.title === 'BeforeSuite') return |
| 251 | |
| 252 | const stepKey = step.toString() |
| 253 | |
| 254 | if (savedSteps.has(stepKey)) { |
| 255 | const existingStep = steps.find(s => s.step === stepKey) |
| 256 | if (existingStep && step.status === 'failed') { |
| 257 | existingStep.status = 'failed' |
| 258 | step.artifacts = {} |
| 259 | await captureArtifactsForStep(step, existingStep, existingStep.prefix) |
| 260 | } |
| 261 | return |
| 262 | } |
| 263 | savedSteps.add(stepKey) |
| 264 | |
| 265 | const stepPrefix = generateStepPrefix(step, stepNum) |
| 266 | stepNum++ |
| 267 | |
| 268 | const stepData = { |
| 269 | step: step.toString(), |
| 270 | status: step.status, |
| 271 | prefix: stepPrefix, |
| 272 | artifacts: {}, |
| 273 | meta: {}, |
| 274 | debugOutput: [], |
| 275 | } |
| 276 | |
| 277 | if (step.startTime && step.endTime) { |
| 278 | stepData.meta.duration = ((step.endTime - step.startTime) / 1000).toFixed(2) + 's' |
| 279 | } |
| 280 | |
| 281 | if (config.captureDebugOutput && debugOutput.length > 0) { |
| 282 | stepData.debugOutput = [...debugOutput] |
| 283 | debugOutput = [] |
| 284 | } |
| 285 | |
| 286 | await captureArtifactsForStep(step, stepData, stepPrefix) |
| 287 | steps.push(stepData) |
| 288 | } |
| 289 | |
| 290 | async function captureArtifactsForStep(step, stepData, stepPrefix) { |
| 291 | if (!step.artifacts) { |
no test coverage detected