-
Notifications
You must be signed in to change notification settings - Fork 669
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
False positive prop mutation error #1034
Comments
Version Just got a similar problem (jsx). Below samples are reduced to problematic parts only. const wrapper = shallowMount(Select);
wrapper.vm._onDropdownOpened(); _onDropdownOpened() {
this.isDropdownOpen = true;
}, complains about
which makes no sense, if I comment out the Select render function is render(h) {
return <og-popper
value={this.isDropdownOpen}
popupClass={['og-multi-select-dropdown', { 'og-multi-select-dropdown--multi': this.multiple }]}
/>;
} If I remove Now, if popupClass={'og-multi-select-dropdown'}
// or
popupClass="og-multi-select-dropdown" I get no warnings or errors and everything goes fine. As alternative, tried passing a frozen object, cloned array/object - still shows the warning. |
@donnysim Yep, same situation here. I can remove random bits of code that seem totally unrelated to the error shown and the error will go away. We have the same situation with another prop as well (so we have this bug on 2 props) but I haven't provided this in the repo as they're both the same issue and I assume fixing this will fix the other one too. |
This issue isn caused by how Vue Test Utils implements synchrnous updates. It will be fixed after Vue 2.5.18 is released, which includes synchronous update mode in core. A temporary workaround is to run your tests asynchronously: it("renders", () => {
let wrapper = shallowMount(demo, { sync: false });
wrapper.setData({selectedDate: testDate})
setTimeout(() => {
wrapper.vm.selectedDate.should.be.equal(testDate)
done()
})
}); |
This also happened to me while using |
Version
1.0.0-beta.25
The issue is also inside
1.0.0-beta.20
which is the real version we use, but we cannot upgrade to.25
due to #1026, but the bug is inside.25
as well. Reproduction repo uses.25
.Reproduction link
https://github.com/MechJosh0/vue-test-utils-prop-error
Steps to reproduce
Output
What is expected?
No error.
What is actually happening?
Producing an error saying that the prop
mode
is being mutated when it is in fact not.The text was updated successfully, but these errors were encountered: