Skip to content

Shell doesn't work with the plugin "retryFailedStep" #4844

Description

@mirao

It's a regression in 3.7.0. It works well in 3.6.10.

Steps:

  • Initialize a project
npx create-codeceptjs .
npx codeceptjs init # Create a Playwright test, with "Show browser window = yes"
  • Run shell
mirao@jobr:~/workspace/my$ codeceptjs shell
Deprecation Warning: 'tryTo' has been moved to the 'codeceptjs/effects' module. Disable tryTo plugin to remove this warning.
Deprecation Warning: 'retryTo' has been moved to the 'codeceptjs/effects' module. Disable retryTo plugin to remove this warning.
Starting interactive shell for current suite...
Error processing test.before event:
TypeError: Cannot read properties of undefined (reading 'disableRetryFailedStep')
    at EventEmitter.<anonymous> (/home/mirao/workspace/my/node_modules/codeceptjs/lib/plugin/retryFailedStep.js:111:19)
    at EventEmitter.emit (node:events:536:35)
    at EventEmitter.emit (node:domain:489:12)
    at Object.emit (/home/mirao/workspace/my/node_modules/codeceptjs/lib/event.js:153:28)
    at module.exports (/home/mirao/workspace/my/node_modules/codeceptjs/lib/command/interactive.js:32:11)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Command.<anonymous> (/home/mirao/workspace/my/node_modules/codeceptjs/bin/codecept.js:38:7)
Error while loading home page: Cannot read properties of undefined (reading 'goto')}
 Interactive shell started
 Use JavaScript syntax to try steps in action
 - Press ENTER to run the next step
 - Press TAB twice to see all available commands
 - Type exit + Enter to exit the interactive shell
 - Prefix => to run js commands 
 I.

BTW the message TypeError: Cannot read properties of undefined (reading 'disableRetryFailedStep') is strange. Not sure if it affects the next behavior (but maybe it's a different issue). Could you look at it?

  • Enter amOnPage("https://codecept.io/")

Expected result:

  • The command is performed

Actual result:

  • It fails
 I.amOnPage("https://codecept.io/")
 ERROR  Cannot read properties of undefined (reading 'goto')
 I.TypeError: Chaining cycle detected for promise #<Promise>
    at processTicksAndRejections (node:internal/process/task_queues:105:5)

Also I would expect that a Chromium in windowed mode should be started in the shell mode, but it doesn't happen 🐛 .


codecept.conf.ts:

import { setHeadlessWhen, setCommonPlugins } from '@codeceptjs/configure';
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();

export const config: CodeceptJS.MainConfig = {
  tests: './*_test.ts',
  output: './output',
  helpers: {
    Playwright: {
      browser: 'chromium',
      url: 'http://localhost',
      show: true
    }
  },
  include: {
    I: './steps_file'
  },
  name: 'my'
}

Used SW:

  • CodeceptJS 3.7.0 or 3.7.2
  • Playwright 1.50.1
  • NodeJS 22
  • Ubuntu 24.04

Activity

  1. mirao commented on Apr 15, 2025

    @mirao
    ContributorAuthor

    I'm able to fix the issue TypeError: Cannot read properties of undefined (reading 'disableRetryFailedStep') by a help of CoPilot:

    lib/plugin/retryFailedStep.js:

      event.dispatcher.on(event.test.before, test => {
        // pass disableRetryFailedStep is a preferred way to disable retr
        // test.disableRetryFailedStep is used for backward compatibility
        if (test.opts && test.opts.disableRetryFailedStep || test.disableRetryFailedStep) {
           store.autoRetries = false
           return // disable retry when a test is not active
        }
        if (!test.opts) {
           test.opts = {}
        }
        ...
      }

    but it's still failing on the TypeError: Chaining cycle detected for promise error if I call some method or if I just press ENTER

    $ codeceptjs shell
    Deprecation Warning: 'tryTo' has been moved to the 'codeceptjs/effects' module. Disable tryTo plugin to remove this warning.
    Deprecation Warning: 'retryTo' has been moved to the 'codeceptjs/effects' module. Disable retryTo plugin to remove this warning.
    Starting interactive shell for current suite...
     Interactive shell started
     Use JavaScript syntax to try steps in action
     - Press ENTER to run the next step
     - Press TAB twice to see all available commands
     - Type exit + Enter to exit the interactive shell
     - Prefix => to run js commands 
     I.see("Domain")
    node:internal/process/task_queues:95
        runMicrotasks();
        ^
    
    TypeError: Chaining cycle detected for promise #<Promise>
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    
    Node.js v20.19.0
    
    
  2. mirao commented on May 23, 2025

    @mirao
    ContributorAuthor

    but it's still failing on the TypeError: Chaining cycle detected for promise error if I call some method or if I just press ENTER

    This can be "fixed" by ignoring of unhandledRejection in lib/command/interactive.js

    // Add global handler for unhandled promise rejections
    process.on('unhandledRejection', (reason, promise) => {
      // Intentionally ignore unhandled rejections in interactive shell
    })

    Then the shell works well

    $ codeceptjs shell
    Deprecation Warning: 'tryTo' has been moved to the 'codeceptjs/effects' module. Disable tryTo plugin to remove this warning.
    Deprecation Warning: 'retryTo' has been moved to the 'codeceptjs/effects' module. Disable retryTo plugin to remove this warning.
    Starting interactive shell for current suite...
     Interactive shell started
     Use JavaScript syntax to try steps in action
     - Press ENTER to run the next step
     - Press TAB twice to see all available commands
     - Type exit + Enter to exit the interactive shell
     - Prefix => to run js commands 
     I.amOnPage("https://codecept.io")
     I.see('CodeceptJS');
      OK   I.see('CodeceptJS');
     I.see('CodeceptJSx');
     ERROR  
      OK   I.see('CodeceptJSx');
     FAIL  expected web application to include "CodeceptJSx"
     I.exit
    Exiting interactive shell....

    of course still there is an internal issue that causes the exception and it should be fixed. But can't see through it.

  3. changed the title [-]Shell: Command fails: "Cannot read properties of undefined (reading 'goto')"[/-] [+]Shell: Command fails: TypeError: Chaining cycle detected for promise[/+] on May 26, 2025
  4. changed the title [-]Shell: Command fails: TypeError: Chaining cycle detected for promise[/-] [+]Shell doesn't work with the plugin "retryFailedStep"[/+] on Oct 25, 2025
  5. added a commit that references this issue on Oct 25, 2025
    0ce4a28
  6. added a commit that references this issue on Oct 29, 2025
    2418a1e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions