Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings for missing translation in the parent component test #1016

Closed
alexandrastrekalova opened this issue Oct 16, 2020 · 2 comments
Closed
Labels
Status: Need More Info Lacks enough info to make progress

Comments

@alexandrastrekalova
Copy link

When testing a parent component some warnings are generated that translation for a key in the child component can not be found: "Value of key 'logout' is not a string!"

Here is what the component looks like:

<Dashboard>
  <PageWithHeader>
    {{ $t('logout') }}
  </PageWithHeader>
</Dashboard>

The translation for the key logout is defined in the PageWithHeader component.
Same warnings are thrown on the console when the Dashboard component is rendered. In the test for PageWithHeader no warnings are thrown. I can disable the warnings with silentTranslationWarn: true in the index.js, then there are no warnings in the browser console.

However, I don't know how I can disable them in the Dashboard.spec.js. Or may be there is a better option how to change the test setup, so that the parent component does not throw any warnings?

Here is the test setup portion for i18n:

import VueI18n from 'vue-i18n';
const localVue = createLocalVue();
localVue.use(VueI18n);

vue & vue-i18n version

8.18.2

@kazupon
Copy link
Owner

kazupon commented Oct 17, 2020

Did you try to use vue-i18n-jest?
https://github.com/intlify/vue-i18n-jest

@kazupon
Copy link
Owner

kazupon commented Nov 21, 2020

close due to in-activity

@kazupon kazupon closed this as completed Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Need More Info Lacks enough info to make progress
Projects
None yet
Development

No branches or pull requests

2 participants