MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / persistStep

Function persistStep

lib/plugin/aiTrace.js:247–288  ·  view source on GitHub ↗
(step)

Source from the content-addressed store, hash-verified

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) {

Callers 1

aiTrace.jsFile · 0.70

Calls 7

captureArtifactsForStepFunction · 0.85
generateStepPrefixFunction · 0.85
pushMethod · 0.80
isStepIgnoredFunction · 0.70
toStringMethod · 0.45
findMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected