From b46ee8a1f6a3170075addf72b7e7349a8a09680c Mon Sep 17 00:00:00 2001 From: OnlyWick Date: Tue, 13 Feb 2024 17:27:52 +0800 Subject: [PATCH] fix: @pinia/nuxt breaks createTestingPinia fix #2555 --- packages/testing/src/testing.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/testing/src/testing.ts b/packages/testing/src/testing.ts index 0b4db94f57..50b662682e 100644 --- a/packages/testing/src/testing.ts +++ b/packages/testing/src/testing.ts @@ -18,6 +18,7 @@ import { StateTree, _DeepPartial, PiniaPluginContext, + getActivePinia, } from 'pinia' export interface TestingOptions { @@ -106,7 +107,7 @@ export function createTestingPinia({ fakeApp = false, createSpy: _createSpy, }: TestingOptions = {}): TestingPinia { - const pinia = createPinia() + const pinia = getActivePinia() ?? createPinia() // allow adding initial state pinia._p.push(({ store }) => {