Skip to content

Cannot read property 'subTree' of undefined if expose() is used #435

Closed
@KaelWD

Description

@KaelWD
it('works with expose', async () => {
  const Component = defineComponent({
    setup (props, { expose }) {
      const val = ref('')

      expose({
        val
      })

      return () => h('div')
    }
  })

  const wrapper = mount(Component)
})

In VueWrapper.hasMultipleRoots, this.vm is the exposed object instead of the component instance.

https://github.com/vuejs/vue-test-utils-next/blob/c667907bac0db961439ccdca0644b54a5f5ee382/src/mount.ts#L437-L449

Should be something like this but always returning i.proxy:

https://github.com/vuejs/vue-next/blob/fbf2d68bbcde75c95363e1fd17946c720d0f3925/packages/runtime-core/src/componentPublicInstance.ts#L207-L218

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions