Skip to content

options.attachToDocument is deprecated & isVueInstance is deprecated #138

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

Closed
afenton90 opened this issue May 6, 2020 · 6 comments · Fixed by #139
Closed

options.attachToDocument is deprecated & isVueInstance is deprecated #138

afenton90 opened this issue May 6, 2020 · 6 comments · Fixed by #139
Labels

Comments

@afenton90
Copy link
Contributor

Describe the bug

When running the latest versions of @testing-library/vue & @vue/test-utils I get the following 2 console.error from @vue/test-utils:

[vue-test-utils]: options.attachToDocument is deprecated in favor of options.attachTo and will be removed in a future release
[vue-test-utils]: isVueInstance is deprecated and will removed in the next major version

It is true that these will be deprecated in the next major version of @vue/test-utils and there are alternatives available in the latest releases.

To Reproduce Steps to reproduce the behavior:

Install the latest versions of @testing-library/vue & @vue/test-utils and run tests.

Expected behavior

The warnings above do not appear as the library has been refactored.

Related information:

  • @testing-library/vue version: 5.0.2
  • Vue version: 2.6.11
  • @vue/test-utils version: 1.0.0
  • node version: v12.6.0
  • npm (or yarn) version: 1.22.4

Additional context

Looks like @vue/test-utils has recently had it's 1.0.0 release with these added

@afenton90 afenton90 added the bug Something isn't working label May 6, 2020
@afenton90
Copy link
Contributor Author

Happy to pick up the fix for this, if it isn't already being done

@afontcu
Copy link
Member

afontcu commented May 6, 2020

Hi! Thanks for bringing this up.

True that we should bump VTU to v1.0 now that it is out of beta, and handle these couple of deprecation messages.

If you're willing to work on this, then by all means! 🤗

for the record: There's an ongoing PR to port Vue Testing Library to Vue 3 and Vue Test Utils 2. This may be related.

@afontcu afontcu removed the bug Something isn't working label May 6, 2020
@afontcu
Copy link
Member

afontcu commented May 6, 2020

However… may I ask why are you installing @vue/test-utils manually? I mean, Vue Testing Library already installs beta.32 for you.

@afenton90
Copy link
Contributor Author

Hey @afontcu thanks for the context. Yeah sure I can put in a PR to get that sorted 😄

For the @vue/test-utils dependency I am not installing it manually. Seems that yarn has resolved it to 1.0.0 even though the beta version is specified in package.json.

This is the entry in my yarn.lock file.

"@vue/test-utils@^1.0.0-beta.29", "@vue/test-utils@^1.0.0-beta.32":
  version "1.0.0"
  resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.0.0.tgz#02e81ec674a45c694e95be2e06116a7275819c7b"
  dependencies:
    dom-event-types "^1.0.0"
    lodash "^4.17.15"
    pretty "^2.0.0"

@afontcu
Copy link
Member

afontcu commented May 6, 2020

oh, dang, you're right:

image

So, I think we should:

  • Mark ^1.0.0 as the desired version of VTU.
  • Replace attachToDocument with attachTo. no need to change anything else.
  • Replace isVueInstance. Not sure about possible edge cases here. In VTU we replaced it with this.vm, but that's not possible on Vue Testing Lib.

@afontcu
Copy link
Member

afontcu commented May 20, 2020

🎉 This issue has been resolved in version 5.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

2 participants