Skip to content

Jest Augmentations Limitations #2016

@dprevost-LMI

Description

@dprevost-LMI

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 #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.

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