-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Changed types for extending matchers #6761
Comments
It's working for me https://github.com/hi-ogawa/reproductions/tree/main/vitest-6761-expect-extend Can you provide a reproduction? |
Hello @dosolkowski-work. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with |
I was able to reproduce using a project created from the StackBlitz link: https://stackblitz.com/edit/vitest-dev-vitest-mskyqm |
I suspect the StackBlitz is not actually reproducing the issue, so I went back to my own reproduction.
|
Can you try reproducing without |
Not sure but this one looks hard. It looks like Funny workaround which may or may not fix your issue is to prevent // in app/src/setupTests.ts
- import "@testing-library/jest-dom/vitest"
+ await import('@testing-library/jest-dom/vitest' as string) Or you can move this one to config as |
I made a new reproduction repository, and something strange is happening: https://github.com/dosolkowski-work/vitest-extend-types-issue/actions Adding |
In the current scenario, the instant you attempt to import anything from |
This is making less and less sense over time. It seems like it's probably not a vitest issue after all and can be closed. It's an incredibly specific combination of things that have to be in place for the problem to manifest, and no one thing seems to make a difference on its own. In the simpler reproduction, all you have to do is change where the |
Describe the bug
Similar to #6660, it looks like the
Assertion<T>
type is being found in@vitest/expect
now instead ofvitest
itself. This changed from v2.1.2 to v2.1.3. As a result, the Extending Matchers documentation on Vitest's own website no longer works; TypeScript will not find the custom matcher functions. If this change is desired, please update the documentation on the website to match.Reproduction
The code in Extending Matchers no longer works as-is. Instead, it must be changed to the following:
In addition, depending on the package manager setup, it may be necessary to add a package reference to
@vitest/expect
.System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: