-
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
Improve error handling of stubs option #465
Comments
The problem is you're stubbing the stub with itself, which leads to a circular reference. You can fix your tests by passing an element, or stubs: {
'child-component': '<div />',
'child-component': true
} We should throw a more useful error, and make it clear in the docs that you need to pass either string HTML tag, Component object, or Boolean. I'll keep this issue open to make sure we improve the error handling and docs. |
@eddyerburgh thank you for the replay. I've found out one interesting thing that if I use Please see the repo above:
Steps to reproduce
Result
|
@eddyerburgh Hello! Do you have any news about the message above? 😃 |
So the problem you posted is that your registering a stub component that should render the component you're trying to stub. When Vue tries to resolve the component it gets stuck in an infinite loop: child-component renders child-component which renders child-component, which renders child-component etc. I'm not sure why because I haven't seen the code, but in your second example, Vue will not be getting stuck in the loop because it can resolve the component without getting caught in a loop. |
Thanks! |
Sorry. I reopen the issue because:
|
Version
1.0.0-beta.12
Reproduction link
https://github.com/ilyaztsv/jest-and-vue-test-utils-stubs
Steps to reproduce
npm i
npm run test
What is expected?
tests should end successfully and terminal console should contain
html
of renderedMyComponent
:What is actually happening?
The text was updated successfully, but these errors were encountered: