Skip to content

TypeError: Cannot read property '$options' of undefined #673

Closed
@feliupe

Description

@feliupe

Version

1.0.0-beta.15

Reproduction link

https://github.com/feliupe/vuerror

Steps to reproduce

yarn && yarn test

What is expected?

The test to run with no error.

What is actually happening?

There two errors:

  • TypeError: Cannot read property '$options' of undefined
  • and TypeError: Cannot set property '_error' of undefined, that I think is related to the errorHandler and my not be related to the test failing.
    TypeError: Cannot read property '$options' of undefined

       6 |     it('Mock', () => {
       7 |         const wrapper = mount(Page)
    >  8 |         wrapper.vm.treeData = {}
       9 |         // wrapper.vm.$forceUpdate()
      10 |     })
      11 | })
      
      at updateChildComponent (node_modules/vue/dist/vue.js:2573:8)
      at prepatch (node_modules/vue/dist/vue.js:3510:5)
      at patchVnode (node_modules/vue/dist/vue.js:5425:7)
      at updateChildren (node_modules/vue/dist/vue.js:5340:9)
      at patchVnode (node_modules/vue/dist/vue.js:5436:29)
      at VueComponent.patch [as __patch__] (node_modules/vue/dist/vue.js:5566:9)
      at VueComponent.Vue._update (node_modules/vue/dist/vue.js:2428:19)
      at VueComponent.updateComponent (node_modules/vue/dist/vue.js:2542:10)
      at Watcher.get (node_modules/vue/dist/vue.js:2883:25)
      at Watcher.run (node_modules/vue/dist/vue.js:2960:22)
      at Watcher.update (node_modules/vue/dist/vue.js:2948:10)
      at Dep.notify (node_modules/vue/dist/vue.js:784:13)
      at Object.reactiveSetter [as treeData] (node_modules/vue/dist/vue.js:1006:11)
      at updateChildComponent (node_modules/vue/dist/vue.js:2599:18)
      at prepatch (node_modules/vue/dist/vue.js:3510:5)
      at patchVnode (node_modules/vue/dist/vue.js:5425:7)
      at updateChildren (node_modules/vue/dist/vue.js:5340:9)
      at patchVnode (node_modules/vue/dist/vue.js:5436:29)
      at updateChildren (node_modules/vue/dist/vue.js:5340:9)
      at patchVnode (node_modules/vue/dist/vue.js:5436:29)
      at VueComponent.patch [as __patch__] (node_modules/vue/dist/vue.js:5566:9)
      at VueComponent.Vue._update (node_modules/vue/dist/vue.js:2428:19)
      at VueComponent.updateComponent (node_modules/vue/dist/vue.js:2542:10)
      at Watcher.get (node_modules/vue/dist/vue.js:2883:25)
      at Watcher.run (node_modules/vue/dist/vue.js:2960:22)
      at Watcher.update (node_modules/vue/dist/vue.js:2948:10)
      at VueComponent.Vue.$forceUpdate (node_modules/vue/dist/vue.js:2449:19)
      at updateChildComponent (node_modules/vue/dist/vue.js:2615:8)
      at prepatch (node_modules/vue/dist/vue.js:3510:5)
      at patchVnode (node_modules/vue/dist/vue.js:5425:7)
      at VueComponent.patch [as __patch__] (node_modules/vue/dist/vue.js:5566:9)
      at VueComponent.Vue._update (node_modules/vue/dist/vue.js:2428:19)
      at VueComponent.updateComponent (node_modules/vue/dist/vue.js:2542:10)
      at Watcher.get (node_modules/vue/dist/vue.js:2883:25)
      at Watcher.run (node_modules/vue/dist/vue.js:2960:22)
      at Watcher.update (node_modules/vue/dist/vue.js:2948:10)
      at Dep.notify (node_modules/vue/dist/vue.js:784:13)
      at Object.reactiveSetter [as treeData] (node_modules/vue/dist/vue.js:1006:11)
      at VueComponent.proxySetter [as treeData] (node_modules/vue/dist/vue.js:3075:26)
      at Object.it (test/Test.spec.js:8:9)

  console.error node_modules/vue/dist/vue.js:667
    TypeError: Cannot set property '_error' of undefined
        at errorHandler (/home/feliupe/archii/vuerror/node_modules/@vue/test-utils/dist/vue-test-utils.js:5126:13)
        at handleError (/home/feliupe/archii/vuerror/node_modules/vue/dist/vue.js:565:25)
        at Array.<anonymous> (/home/feliupe/archii/vuerror/node_modules/vue/dist/vue.js:709:11)
        at nextTickHandler (/home/feliupe/archii/vuerror/node_modules/vue/dist/vue.js:654:16)
        at <anonymous>

I tried to create the minimum setup to reproduce the problem. Almost any statement you remove from this code will make the test pass. Like removing <message/> for example.

You may ask, why this setup of components, with a Tree and Message wrapped in a Layout: it's a representation of what I have in my project.

May also help to know that the error disappears if you remove wrapper.vm.treeData = {} and also happens if you uncomment wrapper.vm.$forceUpdate().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions