Router and Route are not available in tests when using vue-i18n-routing and vue-test-utils

Aperta
#92 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
frontend, testing

Direzione di ricerca

Inizia con la riproduzione StackBlitz, in particolare tests/Sample.spec.js, e confronta la relativa configurazione di vue-i18n-router con il caso funzionante di vue-router. Conferma il malfunzionamento relativo a useRoute() e useRouter(), quindi verifica che i test montati forniscano entrambi i composable senza l’avviso di injection.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

status: review needed
Describe the bug

When mounting a component that uses useRoute() or useRouter() with vue-test-utils and a vue-i18n-router, the useRoute and useRouter composables do not return any values. Instead the following error will be printed:

[Vue warn]: injection "Symbol(route location)" not found. 
  at <HelloWorld ref="VTU_COMPONENT" > 
  at <VTUROOT>

When using a vue-router instead of the vue-i18n-router everything is working as expected.

Reproduction

https://stackblitz.com/edit/vitejs-vite-vckr8m?file=tests%2FSample.spec.js

System Info
System:
    OS: Linux 5.0 undefined
    CPU: (2) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
Used Package Manager

npm

Additional context

No response

Validations
  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
Lingua principale
TypeScript
Stelle
19
Fork
4
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di intlify/routing

Tutte le issue di intlify/routing

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.