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

Bug introduced from 1.1.4 and later #1845

Closed
ravjsdev opened this issue May 10, 2021 · 6 comments · Fixed by #1857
Closed

Bug introduced from 1.1.4 and later #1845

ravjsdev opened this issue May 10, 2021 · 6 comments · Fixed by #1857
Labels

Comments

@ravjsdev
Copy link

ravjsdev commented May 10, 2021

Subject of the issue

My unit tests suddenly started breaking from 1.1.4 and later

Steps to reproduce

since updating to 1.1.4 (or greater) my unit tests are now breaking - I have a custom component (renderer) which renders form components (e.g. input, text area, checkbox etc) dynamically using a config provided via props. The component iterates through the config and renders the inputs (mapping them to appropriate vue components) - now in my test when i do the following:

...
const dynamicFormConfig = ['text-area', 'text-input'];

const options = merge({
    propsData: {
      dynamicFormConfig,
    },
    store,
    localVue,
  }, params.options);

textInput = mount(RendererComponent, options).findComponent({` name: 'MyTextInput' });

expect(textInput.exists()).toBe(true); 

i should get true, but now my tests fail with false.

Expected behaviour

I should get true from the test expectation but now im getting false. When i downgrade to 1.1.3 everything works fine and the tests pass.

Actual behaviour

The test now fails. (i.e. textInput.exist() returns false)

Possible Solution

Revert the breaking change introduced in 1.1.4 (Djaler:fix/find-functional-component)

@lmiller1990
Copy link
Member

I don't think we should revert a change that fixes a real bug. Let's just fix this new bug. Can you please post your entire test and component? We can add it to the test suite, then make it pass. Then both bugs will be fixed. What do you think? 👍

@ravjsdev
Copy link
Author

ok sure i'll put a demo repo together which replicates this problem

@lmiller1990
Copy link
Member

Thank you!

@GeorgieH
Copy link

I've worked with ravjsdev to create a minimal example which reproduces the issue. Here it is: https://github.com/GeorgieH/vue-test-utils-1845

Info is in the README. Let me know if you have any questions.

@lmiller1990
Copy link
Member

Thanks.

@lmiller1990
Copy link
Member

lmiller1990 commented Jun 14, 2021

Released in 1.2.1 https://github.com/vuejs/vue-test-utils/releases/tag/v1.2.1.

This should be good now, if not lmk and I will re-open this.

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

Successfully merging a pull request may close this issue.

3 participants