Skip to content
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

setProps performance issues leads to RangeError: Maximum call stack size exceeded #1046

Closed
AlexandreBonaventure opened this issue Nov 27, 2018 · 1 comment · Fixed by #1062

Comments

@AlexandreBonaventure
Copy link

Version

1.0.0-beta.26

Reproduction link

https://github.com/AlexandreBonaventure/repro-test-utils-setProps

Steps to reproduce

git clone https://github.com/AlexandreBonaventure/repro-test-utils-setProps > yarn install > yarn test:unit

What is expected?

No performance issue across all tests

What is actually happening?

Performance is affected when using more and more messages in vue-i18n


Hello,
I stumbled upon a performance issue when using wrapper.setProps and vue-i18n. For some reasons, tests are running slower and slower with the increased amount of entries (0 -> 3000 lines) in vue-i18n messages (translations), eventually ending up in a RangeError. I know some people will tell me that I could either mock or get rid of vue-i18n in my test, but it is very convenient to do so to track untranslated messages in a vue app. At my company we are using it extensively. Moreover, I don't think we should experience this kind a performance issue anyway and that let me believe this is a code smell in the way test-utils reorders dependencies.

without message + with 1000 lines messages

with 3000 lines messages


NB: using a wrapper factory instead of setProps is fixing the issue as well.
Thanks

@eddyerburgh
Copy link
Member

This issue is caused by the implementation of synchronous updating. This will be fixed after the next patch of Vue is released (Vue 2.5.18). In the meantime you can run your tests with sync set to false:

const wrapper = mount(TestComponent, {
  sync: false
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants