Closed
Description
When using shallowMount
on a component that uses Symbol
as a value for a property, Vue Test Utils fail to run. I receive the following error:
TypeError: Failed to execute 'setAttribute' on 'Element': parameter 2 is a symbol, which cannot be converted to a string.
at Object.exports.DOMString (node_modules/webidl-conversions/lib/index.js:228:15)
at patchAttr (node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.js:207:16)
at patchProp (node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.js:406:9)
at mountElement (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:3751:25)
at processElement (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:3724:13)
at patch (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:3644:21)
at ReactiveEffect.componentUpdateFn [as fn] (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:4181:21)
at ReactiveEffect.run (node_modules/@vue/reactivity/dist/reactivity.cjs.js:164:29)
at setupRenderEffect (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:4300:9)
I would expect there to be no error when using shallowMount
. When using mount
, the tests run as expected.
Steps to reproduce:
- Clone https://github.com/liamdebeasi/vue-test-utils-symbol.
- Run
npm install
. - Run
npm run test:unit
. Observe that the tests fail on the error above. - Open
src/MyCmp.vue
and change the default value formyProp
fromSymbol()
to'123'
. - Run
npm run test:unit
. Observe that the tests pass as expected.
This is a blocker for some Vue users upgrading to Ionic 6, so it would be great if this could get fixed: ionic-team/ionic-framework#24181. We make use of Symbols to account for this change in behavior with Vue 3.1: vuejs/core#3889
Metadata
Metadata
Assignees
Labels
No labels