testing-library / vue-testing-library

🦎 Simple and complete Vue.js testing utilities that encourage good testing practices.
http://testing-library.com/vue
MIT License
1.09k stars 109 forks source link

`options.attachToDocument` is deprecated & `isVueInstance` is deprecated #138

Closed afenton90 closed 4 years ago

afenton90 commented 4 years ago

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:

Additional context

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

afenton90 commented 4 years ago

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

afontcu commented 4 years ago

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 commented 4 years ago

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

afenton90 commented 4 years ago

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 commented 4 years ago

oh, dang, you're right:

image

So, I think we should:

afontcu commented 4 years ago

:tada: This issue has been resolved in version 5.0.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: