Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

step.duration reflects only the last retry attempt (HelperStep.run() overwrites startTime)

Abierto Apto para principiantes
#5,774 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@mirao ya está trabajando en esto.

Desde el 30/10/2026.

  • #5775 de @mirao — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript, nodejs, playwright
Área
backend, testing

Línea de trabajo

Empieza por lib/step/helper.js y lib/step/func.js, donde run() restablece startTime, y luego compara su comportamiento con la condición de protección en lib/step/record.js. Comprueba cómo se calcula duration en lib/step/base.js y busca pruebas de reintentos existentes. El trabajo está terminado cuando la duración abarca desde el primer intento hasta el éxito o el fallo final.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What happens

When a helper step is retried (e.g. by the retryFailedStep plugin), step.duration covers only the last attempt instead of the whole step.

In our run, a I.click(...) step was retried for ~50 seconds before it finally failed. The HTML report (@testomatio/reporter, which shows step.duration) listed it as 3ms, while the scenario took 49s 697ms.

Cause

lib/step/record.js deliberately keeps the start time of the first attempt:

() => {
  if (!step.startTime) {
    // step can be retries
    event.emit(event.step.started, step)
    step.startTime = +Date.now()
  }
  return (val = step.run(...args))
},

But HelperStep.run() in lib/step/helper.js overwrites it on every attempt:

run() {
  this.args = Array.prototype.slice.call(arguments)
  this.startTime = +Date.now()
  ...

So duration (endTime - startTime in lib/step/base.js) is measured from the start of the last retry. FuncStep.run() in lib/step/func.js has the same assignment.

Expected

step.duration covers all attempts, from the first start to the final pass or failure, as the guard in record.js intends. A possible fix is to set startTime in run() only when it isn't already set.

Steps to reproduce
  1. Enable retryFailedStep.
  2. Run a step that fails for a while and is retried, e.g. I.click() on an element that never shows up.
  3. Read step.duration in an event.step.finished listener, or look at the step time in any reporter that uses it. It shows only the last attempt's duration (a few ms).
Environment
  • CodeceptJS 4.2.2 (also present on current main)
  • Playwright helper, Bun runtime

Created by AI agent (Claude Code)

Lenguaje dominante
JavaScript
Estrellas
4.2k
Forks
754
Merge medio
2 d 11 h
PR fusionados (30 d)
33

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de codeceptjs/CodeceptJS

Todos los issues de codeceptjs/CodeceptJS

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.