-
Notifications
You must be signed in to change notification settings - Fork 668
TypeError: key.charAt is not a function #452
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
Seems related to #312 |
The problem is happening because VueMaterial is installed on the base Vue constructor. I'm not sure yet if the problem is with vue-test-utils. I'll look into it soon. A workaround for the moment is to use a localVue, install VueMaterial, and pass the localVue to shallow: import { mount, createLocalVue } from '@vue/test-utils'
import VueMaterial from 'vue-material'
const localVue = createLocalVue()
localVue.use(VueMaterial)
// ..
wrapper = mount(HelloWorld, { localVue })
// .. |
I have a similar issue when trying to test the Vue component in the following repo
I am using version EDIT: If a do not set wrapper data with |
@iraklisg This is a separate problem. It looks like the issue is that selectedCoupon is not defined, but I might be wrong. Can you make a minimal reproduction of the bug, and create a new issue? |
@eddyerburgh did you want to mention @iraklisg ? |
@ilyaztsv yes 😜 |
@eddyerburgh Apparently, I made haste to comment on this issue 😶 I further debug the aforementioned example and indeed the error was actually caused by the Vue component code itself and, specifically, by the computed property I also made a minimal example to test |
@eddyerburgh For clarification, is it |
@eddyerburgh I did a bit of debugging on this, and the gist of what the problem looks to be is that the renderProxy that Vue defines in non-production modes does not handle Symbols well when the Symbols do not have a For anyone else looking at this, here's how I'm cheating around this problem till we get a patch in. This uses webpack, but you should be able to modify it for your build process: const Proxy = window.Proxy;
window.Proxy = undefined;
const Vue = require('vue').default;
window.Proxy = Proxy; I'm essentially just lying to Vue about the browser support to |
Thanks @dcherman . I'm closing this since the fix will be in Vue core. |
@dcherman hi man. |
Version
1.0.0-beta.12
Reproduction link
https://github.com/ephemeralquark/vue-test-examples
Steps to reproduce
Clone above repo, npm install, npm test. The failure of key.charAt is not a function error message occurs when using vue-material plug-in on chrome headless with karma mocha tests.
What is expected?
Shallow mount the component and pass tests.
What is actually happening?
Throwing an error, see additional comments.
The text was updated successfully, but these errors were encountered: