Skip to content

TypeError: Cannot convert a Symbol value to a string with certain libraries #833

Closed
@andrewisaburden

Description

@andrewisaburden

Version

1.0.0-beta.20

Reproduction link

https://github.com/andrewisaburden/vue-test-utils-symbol-error

Steps to reproduce

Run yarn test:unit in the terminal.

What is expected?

The test should pass with no errors.

What is actually happening?

TypeError: Cannot convert a Symbol value to a string is printed on attempting to mount localVue.


This happens with several libraries (vue-js-modal, vue-material, vue2-google-maps for example). When vue-test-utils tries to deepClone the localVue which is using one of the relevant libraries, it attempts to call Symbol(Symbol.toStringTag) in Object(value) (line 462 in vue-test-utils.js). hasHandler() fails, and tries to print that Property or method Symbol(Symbol.toStringTag) is not defined on the instance.... However, Symbol(Symbol.toStringTag) does not resolve to a string unless cast to a string (e.g. String(key) in warnNonPresent()).

Even once it does resolve to a string by casting to a String, the underlying issue still exists. I don't know how to further investigate the issue, but at this stage it seems to be a vue-test-utils issue rather than an external library issue.

Possibly related issues:
euvl/vue-js-modal#246
#452

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions