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

Custom transformer (this project) never appears to run #51

Open
marr opened this issue Jun 21, 2022 · 0 comments
Open

Custom transformer (this project) never appears to run #51

marr opened this issue Jun 21, 2022 · 0 comments

Comments

@marr
Copy link

marr commented Jun 21, 2022

Hi,
I have a vue2 project that I'm trying to run tests on and I use the following:

Jest 28
@vue/vue2-jest@28
[email protected]
vue-i18n@8
@vue/[email protected]

I have added to my jest.config.js the following:

 globals: {
    '@vue/vue2-jest': {
      transform: {
        'i18n': 'vue-i18n-jest'
      }
    }
  },
  transform: {
     '^.+\\.vue$': '@vue/vue2-jest'
  }

note: I also tried the vue-jest key in the globals section with the same results.

My tests fail with the following error:

TypeError: Cannot read properties of undefined (reading 't')

line in question:

data() {
    headers: [
      {
         text: this.$i18n.t('admin.users.headers.name'),

My test render call:

it('renders', () => {
  const wrapper = shallowMount(UserList, {
    Vue,
    propsData: {
      users,
    },
  });

Thank you for any guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant