intlify / intlify/routing

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

Open
#92 1 comment 1 reaction 0 assignees View on GitHub
status: review needed
Dominant language
TypeScript
Stars
19
Forks
4
PR merge metrics
No merged PRs in 30d

Description

### 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
at
```

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

```Shell
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

- [X] Follow our [Code of Conduct](https://github.com/intlify/routing/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guide](https://github.com/intlify/routing/blob/main/CONTRIBUTING.md).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a [minimal reproducible](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.