webdriverio / webdriverio/expect-webdriverio

Jest Augmentations Limitations

Open
#2,016 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
86
Forks
61
Avg merge
19h 12m
Merged PRs (30d)
15

Description

As discovered while working on this PR, here are the issues to document the limitations around augmentation usage.

See the augmentation issue for Jasmine there https://github.com/webdriverio/expect-webdriverio/issues/1893

Jest

  1. As documented here and demonstrated in this project, we can utilize Jest with @jest/globals and @types/jest to use Jest's expect with wdio augmentation, but it is not a plug-and-play, out-of-the-box solution.
  2. As shown here, to use Jest’s augmentation, we also need to register the wdio custom matcher manually.
  3. Additionally, to utilize the soft assertion service, we need to register it, as shown here.
  4. The typing @types/jest is not offered and supported by Jest’s maintainer, and there is a long-standing issue around that here to get rid of @types/jest
  5. When using Jest’s augmentation of the wdio matchers toMatchSnapshot and toMatchInlineSnapshot, they conflict with one of Jest’s.
  6. A workaround to avoid requiring the registration of the wdio matcher & soft assertion is to force the global.expect (as shown here) to be one of the wdio options, but this could also break other parts of a monorepo project.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked PR #1863 and Jasmine augmentation issue #1893, then review the referenced Jest boilerplate setup examples. Document the listed Jest augmentation, matcher-registration, soft-assertion, typing, snapshot-conflict, and global.expect limitations; done means these limitations and workarounds are covered in the repository documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.