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
Create matchers for vitest
#139
Comments
I found this in the vitest docs: https://vitest.dev/guide/features.html#chai-and-jest-expect-compatibility When I set |
Hey, sorry for the late reply. Thank you @kldavis4 for finding and sharing the way to make While I see a raising popularity of |
It still doesn't work for me, even with test.globals set to true.
|
This is really excellent test utility, thank you to all who have contributed so far. On this point from the README: Lines 513 to 514 in c6896a3
One problem here is the Vitest “Jest” matcher utils are a much smaller subset of the actual Jest matcher utils (which also rely on other Jest packages like jest-diff). ✅ If the expectation passes there is no problem, the matchers work as expected with vitest. ❌ However if the expectations then
At this point Vitest runner will bail:
Happy to stick my hand up to make a contribution. My thoughts are there are a few possibilities:
In the very short term I think either the limitations should be documented -or- Vitest not be officially documented as supported for just the matchers. @colesiegel On the typings question, I hope you got this resolved? Sharing my configuration in case it helps:
vitest.config.ts: import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true,
mockReset: true,
setupFiles: ['./awsSdkClientMatchers.ts'],
},
}); awsSdkClientMatchers.ts: import 'aws-sdk-client-mock-jest'; tsconfig.json: {
"extends": "@tsconfig/node18/tsconfig",
"compilerOptions": {
"allowJs": true,
"lib": ["ESNext"],
"module": "NodeNext",
"moduleResolution": "nodenext",
"noEmit": true,
"types": ["vitest/globals"]
}
} |
Hello and thanks for this great lib 🙌
On my project we went from
jest
tovitest
, mainly for performances. Sadly, we lost thetoHaveReceivedCommand
matchers in the process 🥲Would be awesome to have them for
vitest
as well! Maybe it was the aim of separatingjest
matchers in another lib in the first place ?See https://vitest.dev/guide/extending-matchers.html
Cheers !
The text was updated successfully, but these errors were encountered: