Skip to content

@wdio/globals: Declare "expect" global type explicitly#12499

Merged
christian-bromann merged 1 commit intowebdriverio:mainfrom
naruaway:add-global-expect-type
Mar 21, 2024
Merged

@wdio/globals: Declare "expect" global type explicitly#12499
christian-bromann merged 1 commit intowebdriverio:mainfrom
naruaway:add-global-expect-type

Conversation

@naruaway
Copy link
Copy Markdown
Contributor

@naruaway naruaway commented Mar 17, 2024

Proposed changes

Currently expect-webdriverio is implicitly loading expect global type, which is "wrong" since the runtime of expect-webdriverio does not actually load expect into the runtime global scope.
webdriverio/expect-webdriverio#1496 fixes this issue but then we need to make sure to load this type in @wdio/globals.

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Backport Request

//: # (The current main branch is the development branch for WebdriverIO v9. If your change should be released to the current major version of WebdriverIO (v8), please raise another PR with the same changes against the v8 branch.)

Reviewers: @webdriverio/project-committers

Copy link
Copy Markdown
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Can we make the same change in v8 branch to publish it as latest?

@naruaway
Copy link
Copy Markdown
Contributor Author

Additional verification

Since "expect-webdriverio" is loading global expect type (not runtime) (webdriverio/expect-webdriverio#1496), this will cause TS2451: Cannot redeclare block-scoped variable 'expect' for typical projects generated by @wdio/cli when we do "skipLibCheck": false in tsconfig.json. However, we can consider that this is not a breaking change since by default it configures "skipLibCheck": true (source) and with "skipLibCheck": false, anyway there are multiple type errors from webdriverio related packages already even without this change.

@naruaway
Copy link
Copy Markdown
Contributor Author

@christian-bromann thanks! I created backport PR #12502
Could you merge and publish? Then we can start working on webdriverio/expect-webdriverio#1496

@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label Mar 21, 2024
@christian-bromann christian-bromann merged commit ce45ce1 into webdriverio:main Mar 21, 2024
@wdio-bot
Copy link
Copy Markdown
Contributor

Hey naruaway 👋

Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution. We've sent you an email with further instructions on how to claim your expenses from our development fund. Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at expense@webdriver.io or in the contributing channel on Discord.

We are looking forward to more contributions from you in the future 🙌

Have a nice day,
The WebdriverIO Team 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Expensable $50 💸 PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants