-
Notifications
You must be signed in to change notification settings - Fork 667
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
TypeError: Cannot read property 'split' of undefined #839
Comments
Without a reproduction I can't debug. But this might be an issue with the Try set the test('use Vue.nextTick', (done) => {
const wrapper = mount(TestComponent, { sync: false })
wrapper.trigger('click')
Vue.nextTick(() => {
expect(wrapper.text()).toBe('updated')
done()
})
}) |
Hello @eddyerburgh I understand your point, I will try to create a repo asap. Actually there are too many dependencies and that was the reason I wrote psuedo code only. I tried sync=false, didn't work I got the same error. console.error node_modules/vue/dist/vue.runtime.common.js:1739 TypeError: Cannot read property 'split' of undefined In the mean while I will try to provide with more details. It would be helpful if you could throw some more light on this matter. |
Unfortunately there isn't anything I can do without a reproduction, can you create a minimal reproduction for me? |
Hi, I'm having a similar error when testing a simple Login component:
The component is:
And the test:
What's weird is that the test passes but the console is showing that stacktrace. The project is using Vue, Vuetify and VeeValidate. |
Hello @martosoler, Thank you for providing with a reproduction code. I have seen when the code is as below then the test fails on execution.
|
I tried upgrading the version of vue-test-utils to the lastest (
Note: I have abstracted Firebase library call into a authentication module
I can see that the error is being thrown in the |
Yes @martosoler that's an issue with an un stubbed TransitionGroup. Are you able to provide a reproduction? The error is thrown because you're running in an environment without transition styles (I'm guessing JSDOM). A quick workaround is to monkey patch const { getComputedStyle } = window
window.getComputedStyle = function getComputedStyleStub(el) {
return {
...getComputedStyle(el),
transitionDelay: '',
transitionDuration: '',
animationDelay: '',
animationDuration: '',
}
} |
I have the same problem with:
I mount all my test wrappers with @eddyerburgh That monkey patch solved the issue for me. Any chance to solve this in a more clean way? |
Yes, this is an issue with transition not stubbed correctly, but im unable
to reproduce the bug in order to fix it. Are you able to provide a
reproduction?
…On Mon, 6 Aug 2018, 18:00 Tobias Vetter, ***@***.***> wrote:
I have the same problem with:
- Vue 2.5.16
- Vuetify 1.1.9
- Vue Test Utils 1.0.0 Beta 16
- Jest 23.1.0
(and a lot of other stuff)
I mount all my test wrappers with sync: false.
@eddyerburgh <https://github.com/eddyerburgh> That monkey patch solved
the issue for me. Any chance to solve this in a more clean way?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#839 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMlbW2e2QEdq5n829pj5X9GJJtA_LFyDks5uOHZEgaJpZM4VYQPj>
.
|
@eddyerburgh I was finally able to reproduce this in simpler project, I tried to simplify it more, but simple move-transition didn't trigger it, so it still uses Vuetify. There are 2 identical specs, only one uses workaround you provided. |
For me I need to do both things to completely pass the test and get rid of error in console.
This happens when the test dimisses the VueMaterial MdDialog. |
Version
1.0.0-beta.20
Reproduction link
https://codesandbox.io/s/mzlzo73j7p
Steps to reproduce
Sorry unable to provide with the code as I would have to do a lot of boiler plate code as there are few dependencies such as Vuetify, Vuex and graphql.
I am providing a pseudo code. You can find the code in the test/test.js
Issue:
When I am trying to test a button click event I am getting error 'TypeError: Cannot read property 'split' of undefined'.
On button click an action is triggered that triggers mutation and updates the store.
I am writing integration tests that actually mocks the graphql server and provides with the fake data.
Note:
I have vuex store.
I am using Vuetify as the component library.
Steps to Reproduce:
const btn = wrapper.findAll({name: 'v-btn'});
btn.at(1).trigger('click');
After this I get above mentioned error.
I would like to know if there is something I can do to resolve the issue.
What is expected?
Expected behavior is that on the button click event the store should get updated with the mock data that was supplied.
What is actually happening?
Actually error is occurring - TypeError: Cannot read property 'split' of undefined
I have read few issue surrounding this which comments on transition. I have followed #52
and applied
stubs: {
'transition': TransitionStub,
'transition-group': TransitionGroupStub
}
With no success. I am not aware of what is actually happening it would be great if anybody can throw some light.
The text was updated successfully, but these errors were encountered: