Skip to content

[🐛 Bug]: Chai assertions with "return" fail due to Error: Invalid Chai property: finally since 8.23.0 #11722

@HannaTarasevich

Description

@HannaTarasevich

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

20.10.0

Mode

Standalone Mode

Which capabilities are you using?

capabilities: [{
        browserName: 'chrome',
        browserVersion: 'stable'
    }]

What happened?

I'm using WDIO + Cucumber. Some steps contain the following assertions inside:
return expect(1).to.equal(1) (e.g., in switch statement)

Starting from 8.23.0 release these steps fail with error Error: Invalid Chai property: finally.
It only happens when the chai assertion contain "return".

Note: WDIO expect library works well with return, the same Chai version works well with some other JS frameworks (so, looks like there is no issue in Chai version)

What is your expected behavior?

Assertions with return work without failure in the same way as without return

How to reproduce the bug.

Please use this repo https://github.com/HannaTarasevich/wdio-timeout-issue

  1. Run npm install
  2. Run npm run wdio

Relevant log output

[chrome 119.0.6045.105 windows #0-0] 1) As a user, I can log into the secure area Given I am on the login page
[chrome 119.0.6045.105 windows #0-0] Error: Invalid Chai property: finally
[chrome 119.0.6045.105 windows #0-0] Error: Invalid Chai property: finally
[chrome 119.0.6045.105 windows #0-0]     at Object.proxyGetter [as get] (C:\wdio-timeoutissue\node_modules\chai\lib\chai\utils\proxify.js:78:17)
[chrome 119.0.6045.105 windows #0-0]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions