より柔軟にテストが書けそう。 const wrapper = mount(HelloWorld, { global: { plugins: [ createTestingPinia({ initialState: { counter: { count: 100 } } }), ], }, }); const store = useCounterStore(); // Store呼び出し const incrementSpy = vi.spyOn(store, "increment"); // モック化 incrementSpy.mockImplementation(() => (store.count += 2)); wrapper.find("button").trigger("click"); expect(wrapper.text()).toContain("count is 102");