Search code examples
vue.jsvuejs2vue-componentvue-test-utils

How to get props of functional component with vue-test-utils


I can't just access props as wrapper.props() when I want to do that with functional component, so how can I access them?

Error: [vue-test-utils]: wrapper.props() cannot be called on a mounted functional 
component.

Solution

  • Found an answer right after asking: https://vue-test-utils.vuejs.org/api/wrapper/#attributes

    Since functional is essentially a DOM node, so I should just get it's attributes (props are just attributes here)