[Vuejs]-Vue test utils: '[object Object]' is not a valid selector

0๐Ÿ‘

โœ…

That usage of find is deprecated according to the current find docs:

Deprecation warning

Using find to search for a Component is deprecated and will be removed. Use findComponent instead.

And it looks like that support is completely removed now. find currently only accepts a selector string.

To find a component by ref name, use findComponent instead:

wrapper.findComponent({ ref: 'first' })

0๐Ÿ‘

You can get your ref value by this.$refs.first

0๐Ÿ‘

Support for find is removed in Vue Test Utils 1 (for Vue2): vue2_find_docs.

Vue Test Utils 2 (for Vue3) specifies that find should be used for HTML elements while findComponent should be used for Vue components: vue3_find_docs.

Make sure that you are referencing the correct documentation for your Vue version and that you have the correct vue-test-utils package installed.

Leave a comment