return pinia
}
+
+/**
+ * Dispose a Pinia instance by stopping its effectScope and removing the state, plugins and stores. This is mostly
+ * useful in tests, with both a testing pinia or a regular pinia and in applications that use multiple pinia instances.
+ *
+ * @param pinia - pinia instance
+ */
+export function disposePinia(pinia: Pinia) {
+ pinia._e.stop()
+ pinia._s.clear()
+ pinia._p.splice(0)
+ pinia.state.value = {}
+ // @ts-expect-error: non valid
+ pinia._a = null
+}
* @module pinia
*/
export { setActivePinia, getActivePinia } from './rootStore'
-export { createPinia } from './createPinia'
+export { createPinia, disposePinia } from './createPinia'
export type {
Pinia,
// TODO: remove in next release