-
Notifications
You must be signed in to change notification settings - Fork 401
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
TypeScript error when passing matchers to vitest expect #537
Comments
If you are using i.e., just this: import '@testing-library/jest-dom/vitest'; Or just this: import * as matchers from '@testing-library/jest-dom/matchers';
import { expect } from 'vitest';
expect.extend(matchers); But in the second version you will also need to augment the global matcher types for vitest |
I'm not able to get either one to work with version 6 or greater. I'm still getting the following error:
|
I tried that, but in both versions typescript dont recognize matchers. Actually they work while running tests but still in IDE typescript shouts those matchesr are not recognized. I also added in tsconfig "vitest/globals" but I guess something more related to jsdom would be needed. |
Any workaround for this? |
@testing-library/jest-dom
version: 6.1.3node
version: 18.15.0jest
(orvitest
) version: vitest 0.34.4npm
(oryarn
) version: npm 9.5.0Relevant code or config:
What you did:
Tried to setup
@testing-library/jest-dom
v6 with vitest.What happened:
Got a TypeScript error:
Reproduction:
vitest.setup.ts
fileThe text was updated successfully, but these errors were encountered: