-
Notifications
You must be signed in to change notification settings - Fork 668
shallowMount fails with TypeError when component uses a data of type Symbol
in it's template
#1833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can confirm, It's still an issue and only happening when running tests. In the browser console no errors are shown regarding the usage of a Symbol |
Any news on this? Still happening |
I can confirm this issue. If I replace |
Some of our users are also running into this issue with Ionic Vue (see: ionic-team/ionic-framework#24181). Vue 3.1 sets all property keys in the properties object, even if certain properties are not actually being used by the end developer (see vuejs/core#3889). We use Using |
I looked into this, I posted my findings and some ideas to proceed here: ionic-team/ionic-framework#24181 (comment) This is not really a specific Test Utils problem, but more of how jsdom chooses to implement their attribute serializer, but it only manifests when using shallowMount. There's not a real "fix", but we will probably need some kind of hack/escape hatch for this scenario (stubs w/ symbols). See my link ^ for more. |
@lmiller1990 any news? Ionic 6.0 is now out as stable, but can't be used with Vue before this is fixed. |
@boboldehampsink Ionic 6 seems to use Vue 3, so you'll need Test Utils v2. This bug is fixed here vuejs/test-utils#1076 which will be released this week. As for back-porting that fix, you could do something similar and strip out symbols in this library. It's not a priority for me right now, but if you'd like to make a PR, that'd be great. |
@lmiller1990 Do we leave this ticket open for back porting it? |
I think it's fine to leave this open - known issue, not fixed. It's unlikely anyone is using Vue 2 with Ionic now, they would likely be looking to upgrade. |
This problem can be solved using the wrapping layer arrow function |
Please share a snippet @wangxiang4, this sounds like useful info. Thanks! |
Version
1.1.4
Reproduction link
https://github.com/penguintree/vue-test-util-symbol-issue
Steps to reproduce
npm run test:unit
What is expected?
Unit tests should pass
What is actually happening?
One of the unit test fails with error :
TypeError: Failed to execute 'setAttribute' on 'Element': parameter 2 is a symbol, which cannot be converted to a string.
Possibly a regression in regards of this closed issue
Basically, it is not possible to shallowMount a component wich passes a Symbol to a child component.
The text was updated successfully, but these errors were encountered: