Skip to content

fix(plugin): guard against undefined step.name in retryFailedStep#5562

Open
gololdf1sh wants to merge 1 commit into
codeceptjs:4.xfrom
gololdf1sh:fix/retry-failed-step-null-guard
Open

fix(plugin): guard against undefined step.name in retryFailedStep#5562
gololdf1sh wants to merge 1 commit into
codeceptjs:4.xfrom
gololdf1sh:fix/retry-failed-step-null-guard

Conversation

@gololdf1sh
Copy link
Copy Markdown

@gololdf1sh gololdf1sh commented May 14, 2026

Problem

When running tests in run-workers mode with retryFailedStep enabled, step events are serialized via step.simplify() before being sent from worker to master process. simplify() maps step.nametitle:

// lib/step/base.js — simplify()
return {
  title: step.name,   // ← name becomes title
  args, status, ...
}

The retryFailedStep plugin only reads step.name, which is undefined on simplified objects. The ignoredSteps loop then calls .startsWith() / .match() on undefined, crashing the worker:

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at EventEmitter.<anonymous> (lib/plugin/retryFailedStep.js:119:67)

Fix

Use step.name || step.title so the plugin works with both full Step objects (in-process) and simplified ones (from workers). Falls back to an early return if neither is present.

Testing

  • Reproduced crash in run-workers mode (2 workers, 4 tests) — workers crashed consistently
  • Applied fix — same run passes, no TypeError
  • Unit tests pass (test/unit/plugin/retryFailedStep_test.js — 5 passing, 4 pending/skipped pre-existing)

…rkers

In `run-workers` mode, step events are serialized via `step.simplify()`
which maps `step.name` to `title` (not `name`). The `retryFailedStep`
plugin only checked `step.name`, which is `undefined` for simplified
step objects, causing a TypeError crash in the `ignoredSteps` loop.

Use `step.name || step.title` so the plugin works with both full Step
objects (in-process) and simplified ones (from workers).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gololdf1sh gololdf1sh force-pushed the fix/retry-failed-step-null-guard branch from a0599c8 to 7a96d61 Compare May 14, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant