Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Mocha retries option doesn't work with BDD scenarios and rewrites it in case of using retries from BDD steps

Open
#2,961 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js, playwright
Domain
testing-qa

Research direction

Reproduce the issue with the shown mocha.retries configuration, comparing a traditional scenario with a BDD scenario and the Before hook that calls test.retries(3). Trace how retries are transferred from the CodeceptJS config and BDD steps into Mocha. Done means configured retries apply consistently to both scenario styles without one style rewriting the other.

Written by the indexing model from the issue text.

Description

What are you trying to achieve?

The goal is to use retry option from Mocha object in codeceptjs config file for both traditional and BDD steps
I've set up retries option inside Mocha object in codeceptjs config file

    mocha: {
        retries: 5
    },

And it works for traditional scenarios, number of retries are the same as I expect

What do you get instead?

But as soon as I'm using it for BDD scenarios retry doesn't apply for those scenarios and test is executing only once.

From other side, if I use retry in BDD steps

Before(test => {
    test.retries(3);
});

traditional scenarios use these retries but not from codeceptjs config file


### Details

* CodeceptJS version: 3.0.7
* NodeJS Version: 14.15.1
* Operating System: Mac OS
* playwright 1.12.0
* cucumber: ^6.0.5

Dominant language
JavaScript
Stars
4.2k
Forks
756
Avg merge
2d 9h
Merged PRs (30d)
16

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from codeceptjs/CodeceptJS

All issues in codeceptjs/CodeceptJS

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.