API Documentation / @pinia/testing

Module: @pinia/testing

Interfaces

Functions

createTestingPinia

createTestingPinia(__namedParameters?): TestingPinia

Creates a pinia instance designed for unit tests that requires mocking the stores. By default, all actions are mocked and therefore not executed. This allows you to unit test your store and components separately. You can change this with the stubActions option. If you are using jest, they are replaced with jest.fn(), otherwise, you must provide your own createSpy option.

Parameters

NameType
__namedParametersTestingOptions

Returns

TestingPinia

a augmented pinia instance

Defined in

packages/testing/src/testing.ts:62