Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Install @testing-library/vue by default instead of @vue/test-utils #6228

Open
Labels
intend to implementThe team has the intention to implement this feature at some point. Contribution is also welcome. scope: unit-jest scope: unit-mocha
@Robin-Hoodie

Description

What problem does this feature solve?

In the official documentation on testing, the following is mentioned when suggesting the 2 libraries that can be used for testing:

Vue Test Utils is the official low-level component testing library that was written to provide users access to Vue specific APIs. If you are new to testing Vue applications, we would recommend using Vue Testing Library, which is an abstraction over Vue Test Utils.

The recommendation for new users is to use @testing-library/vue.
However, @vue/cli-plugin-unit-jest doesn't actually install @testing-library/vue, but @vue/test-utils

I find it to be unintuitive that despite the recommendation, the more low-level (and "harder to use") alternative is installed by default.

It's probably not a good idea to install both by default, but if we have to pick one, @testing-library/vue seems like the obvious choice to me.

The users who would be more likely to go with @vue/test-utils instead, are more likely to be more experienced, and will have a better understanding of the alternatives.

What does the proposed API look like?

Change

'@vue/test-utils': isVue3 ? '^2.0.0-0' : '^1.0.3'
to add @testing-library/vue instead

Happy to open a PR on this myself

Metadata

Metadata

Assignees

No one assigned

    Labels

    intend to implementThe team has the intention to implement this feature at some point. Contribution is also welcome. scope: unit-jest scope: unit-mocha

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /