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

refactor(component-testing): simplify vue mount #15275

Merged
merged 5 commits into from Mar 19, 2021

Conversation

elevatebart
Copy link
Contributor

@elevatebart elevatebart commented Mar 1, 2021

User facing changelog

Fixes some of the memory leaks in with @cypress/vue

Additional details

  • Avoid recreating the root element at each test
  • Make sure we properly destroy the vue instance after each iteration

This might fix some issues with devtools

PR Tasks

  • Has the original issue or this PR been tagged with a release in ZenHub?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 1, 2021

Thanks for taking the time to open a PR!

npm/vue/src/index.ts Outdated Show resolved Hide resolved
npm/vue/src/index.ts Outdated Show resolved Hide resolved
dmtrKovalenko
dmtrKovalenko previously approved these changes Mar 5, 2021
@lmiller1990
Copy link
Contributor

We could use the feature that is built in to test utils: https://vue-test-utils.vuejs.org/api/#enableautodestroy-hook

@lmiller1990 lmiller1990 self-requested a review March 8, 2021 00:33
Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could consider using the version built into test utils: We could use the feature that is built in to test utils: https://vue-test-utils.vuejs.org/api/#enableautodestroy-hook

@elevatebart
Copy link
Contributor Author

@lmiller1990 I do not think we can put anything in afterEach without reaching for a support file.
It would uselessly complicate the installation process.

Where were you thinking we call this enableAutoDestroy function?

@elevatebart
Copy link
Contributor Author

I understand after looking at your vite PR what you mean.
Tell me if my implementation seems fine.

@cypress
Copy link

cypress bot commented Mar 8, 2021



Test summary

9392 0 119 3Flakiness 1


Run details

Project cypress
Status Passed
Commit b7a380b
Started Mar 19, 2021 12:23 AM
Ended Mar 19, 2021 12:34 AM
Duration 10:46 💡
OS Linux Debian - 10.5
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/retries.ui.spec.js Flakiness
1 runner/cypress retries.ui.spec > opens attempt on each attempt failure for the screenshot, and closes after test passes

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

lmiller1990
lmiller1990 previously approved these changes Mar 11, 2021
npm/vue/src/index.ts Outdated Show resolved Hide resolved
JessicaSachs
JessicaSachs previously approved these changes Mar 13, 2021
Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay to me. It's an improvement on where we currently are. There are some fundamental issues with how we are cleaning up, but those will be addressed when we refactor these to use Cypress's internal events.

@lmiller1990 lmiller1990 self-requested a review March 15, 2021 23:25
lmiller1990
lmiller1990 previously approved these changes Mar 15, 2021
Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JessicaSachs
JessicaSachs previously approved these changes Mar 18, 2021
Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually tested this. It's looking good.

- Avoid recreating the root element at each test
- Make sure we properly destroy the vue instance after each iteration
JessicaSachs
JessicaSachs previously approved these changes Mar 18, 2021
@JessicaSachs JessicaSachs merged commit a12b72b into develop Mar 19, 2021
@elevatebart elevatebart deleted the refact/simplify-vue-mount branch March 19, 2021 00:47
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 5, 2021

Released in 7.0.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v7.0.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants