test: update assertions deprecated in vitest 4.1#1629
Conversation
commit: |
📝 WalkthroughWalkthroughThis pull request updates test assertion matchers across nine test files in the examples directory to use newer Vitest matcher APIs. The changes replace deprecated or older matcher syntax with their modern equivalents: Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
should we update app-vitest-workspace and app-vitest too? |
|
thank you for the review |
|
thank you |
🔗 Linked issue
📚 Description
replaced assertions that were deprecated in vitest 4.1:
toBe*spy assertions ->toHaveBeen*toThrowError->toThrowdetails of the deprecations in Vitest 4.1 are as follows:
deprecated:
toBeCalledTimes->toHaveBeenCalledTimestoBeCalled->toHaveBeenCalledtoBeCalledWith->toHaveBeenCalledWithtoThrowError->toThrowtoReturnTimes->toHaveReturnedTimestoReturnWith->toHaveReturnedWithremoved:
nthCalledWith->toHaveBeenNthCalledWithlastCalledWith->toHaveBeenLastCalledWithlastReturnedWith->toHaveLastReturnedWithnthReturnedWith->toHaveNthReturnedWithsearch for repo