Skip to content

Jasmine / Jest matchers #1254

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
winniehell opened this issue Jun 7, 2019 · 5 comments
Closed

Jasmine / Jest matchers #1254

winniehell opened this issue Jun 7, 2019 · 5 comments

Comments

@winniehell
Copy link
Contributor

What problem does this feature solve?

Custom matchers help to make tests more readable and can provide easier to understand error messages.

What does the proposed API look like?

Instead of

expect(wrapper.exists()).toBe(true)

use

expect(wrapper).toExist()

for example. After #1135 is resolved, this could provide the selector in the error message if the assertion fails.


Documenting the use of custom matchers was previously discussed in #634. However here I want to suggest providing matchers as part of vue-test-utils rather than documenting how to do it yourself.


See also

@winniehell
Copy link
Contributor Author

@eddyerburgh Do you think custom matchers for common test frameworks (Jasmine and Jest?) could be a package inside vue-test-utils? This would ensure the matchers are always compatible with the latest version of the library.

@eddyerburgh
Copy link
Member

Maybe they could be included in the future, but for now we should focus on getting v1 released with the current API.

@winniehell
Copy link
Contributor Author

winniehell commented Aug 11, 2019

@eddyerburgh Would it make sense to you if I develop them in a separate package already that we can then merge after v1 got released?

EDIT: This will not happen as I have stopped using Vue in my projects.

@eddyerburgh
Copy link
Member

Yes that's a good idea

@winniehell
Copy link
Contributor Author

there is https://github.com/hmsk/jest-matcher-vue-test-utils which is also in the docs now thanks to #1372 🙂

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

No branches or pull requests

3 participants