Skip to content

v3.4.x Typescript issue in RetryConfig in index.d.ts #3595

Closed
@MhdAlkh

Description

@MhdAlkh

What are you trying to achieve?

Use retry as RetryConfig or RetryConfig[] without defining all fields.
So I can't use retry as indicated in examples here https://codecept.io/basics/#retry-configuration

What do you get instead?

Typescript errors

TSError: ⨯ Unable to compile TypeScript:
codecept.conf.ts:19:3 - error TS2322: Type '{ Feature: number; Scenario: number; Before: number; BeforeSuite: number; After: number; AfterSuite: number; }' is not assignable to type 'number | RetryConfig | RetryConfig[]'.
  Type '{ Feature: number; Scenario: number; Before: number; BeforeSuite: number; After: number; AfterSuite: number; }' is not assignable to type 'number'.

Provide test source code if related
This doesn't work

  retry: {
    Scenario: 3,
    Before: 3,
  },

And this as well

  retry: [{
    Scenario: 3,
    Before: 3,
  }],

I can solve the issue by specifying all fields like:

  retry: {
    grep: '',
    Feature: 0,
    Scenario: 3,
    Before: 3,
    BeforeSuite: 3,
    After: 0,
    AfterSuite: 0,
  },

Details

  • CodeceptJS version: 3.4.1
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: {
      url: 'https://codecept.io/',
      show: false,
      browser: 'chromium'
    }
  },
  retry: {
    //grep: '',
    Feature: 0,
    Scenario: 3,
    Before: 3,
    BeforeSuite: 3,
    After: 0,
    AfterSuite: 0,
  },
  include: {
    I: './steps_file'
  },
  name: 'CodeceptJSExample'
}

You can generate the issue here https://github.com/MhdAlkh/BeforeHookIssue

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