pinia
pinia copied to clipboard
Allow stubbing specific actions only
What problem is this solving
createTestingPinia() can stub or spy all actions but in some cases, it's useful to stub only a few ones
Proposed solution
-
Adapt the option of stubActions for { include, exclude }
-
Document that you can mock a specific action:
const counter = useStore() vi.spyOn(counter, 'increment').mockImplementation(() => {}) // or if using testing pinia counter.increment.mockImplementation()- see https://pinia.vuejs.org/cookbook/testing.html#Mocking-the-returned-value-of-an-action to have the second version wor
Describe alternatives you've considered
No response