Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.62 KB

File metadata and controls

29 lines (22 loc) · 1.62 KB

Types Definition

TypeScript

If you are using the WDIO Testrunner everything will be automatically setup. Just follow the setup guide from the docs. However if you run WebdriverIO with a different testrunner or in a simple Node.js script you will need to add expect-webdriverio to types in the tsconfig.json.

  • "expect-webdriverio" for everyone except Jasmine/Jest users.
  • "expect-webdriverio/jasmine" for Jasmine without @wdio/jasmine-framework
  • "expect-webdriverio/jest" for Jest
  • "expect-webdriverio/expect-global" // Optional, if you wish to use expect of expect-webdriverio globally without explicit import

JavaScript (VSCode)

It's required to create jsconfig.json in project root and refer to the type definitions to make autocompletion work in vanilla js.

{
  "include": [
    "**/*.js",
    "**/*.json",
    "node_modules/expect-webdriverio"
  ]
}

Jasmine

  • With @wdio/jasmine-framework: add "@wdio/jasmine-framework" to types, after "@wdio/globals/types". It types its hybrid global expect: the Jasmine matchers stay synchronous, and the WebdriverIO matchers return a promise. Do not add "expect-webdriverio/jasmine".
  • With Jasmine alone: add "expect-webdriverio/jasmine". It types the WebdriverIO matchers on expectAsync, which you register yourself.

See Framework.md for the details.