Skip to content

TypeError: Cannot read property '$el' of undefined #958

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

Closed
falloutcoder opened this issue Sep 6, 2018 · 4 comments
Closed

TypeError: Cannot read property '$el' of undefined #958

falloutcoder opened this issue Sep 6, 2018 · 4 comments
Labels

Comments

@falloutcoder
Copy link

Version

1.0.0-beta.24

Reproduction link

https://codesandbox.io/s/7307xq2171

Steps to reproduce

Bump @vue/test-utils version from 1.0.0-beta.21 to any later/latest version to reproduce the bug on provided sandbox link.

What is expected?

There shouldn't be any error on console.

What is actually happening?

TypeError: Cannot read property '$el' of undefined.


This issue does not occur on 1.0.0-beta.21.

@eddyerburgh eddyerburgh added the bug label Sep 8, 2018
@rhymes
Copy link

rhymes commented Sep 10, 2018

It happened to me as well while upgrading from 1.0.0-beta.24 to 1.0.0-beta.25.

While running the tests I get:

  ● default › should match the snapshot

    TypeError: Cannot read property '$el' of undefined

      10 |
      11 |   it('should match the snapshot', () => {
    > 12 |     expect(vm.$el).toMatchSnapshot()
         |               ^
      13 |   })
      14 |
      15 |   it('should have link to the campaign list page', () => {

      at Object.<anonymous> (tests/unit/specs/views/NotFound.spec.js:12:15)

I put everything in a gist: https://gist.github.com/rhymes/9972f9259711035156545c00efae73c3

@hengkx
Copy link

hengkx commented Nov 21, 2018

When solve this problem?Thanks

@eddyerburgh
Copy link
Member

This is caused by the synchronous Transition stub component that Vue Test Utils adds by default. You can turn it off with the stubs options:

mount(TestComponent, {
  stubs: {
    transition: false
  }
})

@hengkx
Copy link

hengkx commented Nov 26, 2018

import ElementUI from 'element-ui'
const localVue = createLocalVue()
localVue.use(ElementUI)

image

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

No branches or pull requests

4 participants