Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#5,774 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@mirao がすでに取り組んでいます。

2026年10月30日 から。

  • #5775 @mirao による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, nodejs, playwright
領域
backend, testing

調査の方向性

lib/step/helper.js と lib/step/func.js から始め、run() が startTime をリセットする箇所を確認してから、lib/step/record.js のガードとの動作を比較してください。lib/step/base.js で duration がどのように計算されるかを確認し、既存のリトライテストを探してください。作業完了の条件は、duration が最初の試行から最終的な成功または失敗までの時間をカバーすることです。

索引モデルが issue の本文から書いたものです。

説明

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)

主要言語
JavaScript
スター
4.2k
フォーク
754
平均マージ
2日 11時間
マージ済み PR(30日)
33

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codeceptjs/CodeceptJS のほかの issue

codeceptjs/CodeceptJS の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。