]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
feat(warn): improve warning message
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 24 Apr 2023 07:54:36 +0000 (09:54 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 24 Apr 2023 07:59:58 +0000 (09:59 +0200)
package.json
packages/pinia/__tests__/rootState.spec.ts
packages/pinia/src/store.ts

index 383476c69676c002610505cf3e4c4c7144695a79..0e92f3c1423ac9ef1dd43433063ee071f0c8d5dd 100644 (file)
@@ -15,7 +15,7 @@
     "lint": "prettier -c --parser typescript \"packages/*/{src,__tests__,e2e}/**/*.[jt]s?(x)\" \"packages/docs/**/*.[jt]s\"",
     "lint:fix": "pnpm run lint --write",
     "test": "pnpm run -r dev:prepare && pnpm run test:types && pnpm run test:vitest && pnpm run -r test && pnpm run build && pnpm run build:dts && pnpm test:dts",
-    "test:vitest": "vitest run --coverage",
+    "test:vitest": "vitest --coverage",
     "test:types": "tsc --build ./tsconfig.json",
     "test:dts": "pnpm run -r test:dts",
     "docs:api": "pnpm run --filter ./packages/docs -r docs:api"
index be905258910c8e1508e64c412fe1a9f83de55664..0cb023ef5f1a8c797535c1d4667a7bc0b105a07c 100644 (file)
@@ -13,7 +13,7 @@ describe('Root State', () => {
   })
 
   it('warns if creating a store without a pinia', () => {
-    expect(() => useA()).toThrowError(/with no active Pinia/)
+    expect(() => useA()).toThrowError(/there was no active Pinia/)
   })
 
   it('works with no stores', () => {
index 37ce278d15ac856146102c3cfebac0fbe72db8b1..f5dd8a61c5f0a95d90a4511ae8d458f0b45801f9 100644 (file)
@@ -898,7 +898,7 @@ export function defineStore(
 
     if (__DEV__ && !activePinia) {
       throw new Error(
-        `[🍍]: getActivePinia was called with no active Pinia. Did you forget to install pinia?\n` +
+        `[🍍]: "getActivePinia()" was called but there was no active Pinia. Did you forget to install pinia?\n` +
           `\tconst pinia = createPinia()\n` +
           `\tapp.use(pinia)\n` +
           `This will fail in production.`