testing-library / vue-testing-library

🦎 Simple and complete Vue.js testing utilities that encourage good testing practices.
http://testing-library.com/vue
MIT License
1.09k stars 109 forks source link

Vue-I18n translations bugs with Vue Testing Library, but working with Vue Test Utils. #318

Open ben-hamel opened 3 months ago

ben-hamel commented 3 months ago

Describe the bug Vue Testing Library isn't handling translations correctly with Vue-i18n. When using Vue Testing library you can translate once for local scoped messages but then it won't work again after that. Global messages seem to work okay though. Vue Test Utils can handle both correctly so it seems to be an issue with Vue Test Library afaik.

To Reproduce Steps to reproduce the behavior: You can view the tests I have in this repo to reproduce - https://github.com/ben-hamel/vtl-i18n-bug. I have added Vue Testing Library and Vue Test Utils, test have be recreated for both options. I have labeled tests VTL(Vue Testing Library) and VTU(Vue Test Utils) to help differentiate.

Expected behavior When translating tests, local scope will change with the global scope as can be found in Vue Test Utils tests in my repo linked above.

Related information:

Relevant code or config (if any)

To test run

 npm run test