Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
5415791 to
ffb7945
Compare
`restore`, `reset`, `clear`
ffb7945 to
d8566d8
Compare
|
Hey, I'd appreciate some input on the CI failing - |
It's just flaky, don't worry |
|
The team thinks it's better to restore the implementation in |
|
Wouldn't that be a breaking change with respect to the Jest compatibility layer? I am imagining like: import { expect, it, vi } from "vitest"
// this test passes with jest
// it would not pass in vitest with the proposed changes to `mockReset`
it("should reset", () => {
const value = 0
const fn = vi.fn(() => {
value++
})
fn()
expect(value).toBe(1)
fn.mockReset()
fn()
expect(value).toBe(1)
})Please let me know if I have misunderstood anything ❤️ Sorry, I am happy to help, I just want to make sure the discussion was rigorous before proceeding 😅 |
Yes and yes |
|
Alright - I think I will close this for now, then, and open a new PR for that |
Description
Adds a new method
mockRevertto spies. It's in the same vein asmockClear,mockReset,mockRestore- it is most similar tomockRestore, with the key difference being that it does not 'un-spy' mocks created withvi.spyOn().See #6308 for discussion.
PR Checklist
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci. (I am waiting forplaywrightto install)Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.