diff --git a/src/vnodeTransformers/stubComponentsTransformer.ts b/src/vnodeTransformers/stubComponentsTransformer.ts
index 2a9788b85..547d7875f 100644
--- a/src/vnodeTransformers/stubComponentsTransformer.ts
+++ b/src/vnodeTransformers/stubComponentsTransformer.ts
@@ -47,10 +47,10 @@ const normalizeStubProps = (props: ComponentPropsOptions) => {
const $props = props as unknown as ComponentObjectPropsOptions
return Object.keys($props).reduce((acc, key) => {
if (typeof $props[key] === 'symbol') {
- return { ...acc, [key]: $props[key]?.toString() }
+ return { ...acc, [key]: [$props[key]?.toString()] }
}
if (typeof $props[key] === 'function') {
- return { ...acc, [key]: '[Function]' }
+ return { ...acc, [key]: ['[Function]'] }
}
return { ...acc, [key]: $props[key] }
}, {})
diff --git a/tests/props.spec.ts b/tests/props.spec.ts
index 90c2948e8..7ba71b3b7 100644
--- a/tests/props.spec.ts
+++ b/tests/props.spec.ts
@@ -1,4 +1,4 @@
-import { describe, expect, it } from 'vitest'
+import { describe, expect, it, vi } from 'vitest'
import { mount, shallowMount, VueWrapper } from '../src'
import WithProps from './components/WithProps.vue'
import PropWithSymbol from './components/PropWithSymbol.vue'
@@ -318,6 +318,20 @@ describe('props', () => {
expect(wrapper.html()).toBe('')
})
+ // https://github.com/vuejs/test-utils/issues/2411
+ it('should not warn on stringify props in stubs', () => {
+ const spy = vi.spyOn(console, 'warn').mockReturnValue()
+ const Comp = defineComponent({
+ name: 'Comp',
+ template: ` {}">`
+ })
+
+ const wrapper = mount(Comp)
+
+ expect(wrapper.html()).toContain(' {
it('works with Symbol as default', () => {
const Comp = defineComponent({