Skip to content

Commit

Permalink
fix: @pinia/nuxt breaks createTestingPinia
Browse files Browse the repository at this point in the history
  • Loading branch information
OnlyWick committed Feb 13, 2024
1 parent e132a11 commit fbb1a56
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/testing/src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ export function createTestingPinia({
fakeApp = false,
createSpy: _createSpy,
}: TestingOptions = {}): TestingPinia {
const pinia = createPinia()
const app: App = (globalThis as any).__unctx__.get('nuxt-app').tryUse().vueApp
const symbols = Object.getOwnPropertySymbols(app._context.provides)
const nuxtPinia: Pinia = app._context.provides[symbols[0]]
const pinia = nuxtPinia ?? createPinia()

// allow adding initial state
pinia._p.push(({ store }) => {
Expand Down

0 comments on commit fbb1a56

Please sign in to comment.