Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Jest asymmetric matchers break in SandpackTests #1137

Open
2 tasks done
EskiMojo14 opened this issue May 18, 2024 · 1 comment
Open
2 tasks done

Custom Jest asymmetric matchers break in SandpackTests #1137

EskiMojo14 opened this issue May 18, 2024 · 1 comment
Labels
bug Something isn't working triage New issues that needs consideration

Comments

@EskiMojo14
Copy link

Bug report

Packages affected

  • sandpack-client
  • sandpack-react

Description of the problem

Custom asymmetric matchers break in Sandpack, because they're not being called with the required matcher context.

This does not affect native Jest asymmetric matchers, or custom symmetric matchers.

I've also tried this in the latest Jest version (on my local machine) and don't experience the issue, which is why I'm raising it here and not in the Jest repo.

What were you doing when the problem occurred?

Creating documentation for my package, https://eskimojo14.github.io/mix-n-matchers/.

What steps can we take to reproduce the problem?

Write a test that utilises a custom asymmetric matcher. This issue is visible both in the Mix 'n' Matchers documentation as well as the jest-extended playground.

You can also replicate it with a short example:

expect.extend({
  example() {
    this.isNot; // this should be fine, but throws
    return { pass: true, message: () => "" }
  }
})

it("throws when matcher is used", () => {
  expect("").toEqual(expect.example())
})

Your Environment

Software Name/Version
Sandpack-client version 2.13.8
Sandpack-react version 2.13.10
Browser Chrome
Operating System Windows, MacOS
@EskiMojo14 EskiMojo14 added bug Something isn't working triage New issues that needs consideration labels May 18, 2024
@EskiMojo14
Copy link
Author

on a more positive note, the fact that this project exists at all is very cool, and a major reason why I wanted a docusaurus site for my package vs a standard README ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that needs consideration
Projects
None yet
Development

No branches or pull requests

1 participant