Fix retryFailedStep ignoredSteps exact-name matching#5571
Open
gololdf1sh wants to merge 1 commit into
Open
Conversation
The wildcard check used `ignored.indexOf('*')` as a boolean. `-1` is
truthy in JavaScript (only `0` is falsy), so entries without `*` were
matched via `startsWith(slice(0, -1))` instead of exact compare, which
also chops the last character — broadening the match further.
`ignoredSteps: ['see']` silently ignored `seeElement`, `seeInField`,
`selectOption`, `sendPostRequest` — anything starting with `se`.
Compare against `-1` explicitly so exact-name entries only match
themselves, as the docs describe.
DavertMik
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
lib/plugin/retryFailedStep.js:119the wildcard check usesignored.indexOf('*')as a boolean:String.prototype.indexOfreturns-1when the character is not found.-1is truthy in JavaScript (only0is falsy), so thestartsWith(ignored.slice(0, -1))branch executes for entries that do not contain*too. On top of that,slice(0, -1)chops the last character, broadening the match further.Per the docs,
ignoredStepsshould support both exact step names and wildcard prefixes ('wait*'). The exact-name mode is silently broken.Reproduction
Expected:
seeElementis retried (onlyseeis inignoredSteps).Actual:
seeElementis ignored — single attempt, no retries.ignoredSteps: ['see']also silently ignoresseeElement,seeInField,seeInTitle,selectOption,sendPostRequest— anything starting withse.Fix
Compare
indexOf('*')against-1explicitly. One-character change inlib/plugin/retryFailedStep.js:119:Repro project
gololdf1sh/codeceptjs-retry-test.