Skip to content

(docs): Add guide for some useful libraries for testing #1372

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

Merged
merged 3 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Vue Test Utils is the official unit testing utility library for Vue.js.
- [Using with TypeScript](guides/using-with-typescript.md)
- [Using with Vue Router](guides/using-with-vue-router.md)
- [Using with Vuex](guides/using-with-vuex.md)
- [Useful Libraries for Testing](guides/useful-libraries-for-testing.md)
- [API](api/)
- [mount](api/mount.md)
- [shallowMount](api/shallowMount.md)
Expand Down
16 changes: 16 additions & 0 deletions docs/guides/useful-libraries-for-testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Useful Libraries for Testing

`vue-test-utils` provides useful methods for testing Vue components. Community members have also written some additional libraries which either extend `vue-test-utils` with extra useful methods, or provide tools for testing other things found in Vue applications.
Copy link
Member

Choose a reason for hiding this comment

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

As far as I can tell VTU is usually refered as Vue Test Utils instead of vue-test-utils

Suggested change
`vue-test-utils` provides useful methods for testing Vue components. Community members have also written some additional libraries which either extend `vue-test-utils` with extra useful methods, or provide tools for testing other things found in Vue applications.
Vue Test Utils provides useful methods for testing Vue components. Community members have also written some additional libraries which either extend Vue Test Utils with extra useful methods, or provide tools for testing other things found in Vue applications.

Copy link
Member Author

Choose a reason for hiding this comment

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

Was not sure how to revert to VTU - thanks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.


### `vuex-mock-store`

[`vuex-mock-store`](https://github.com/posva/vuex-mock-store) provides a simple and straightforward mock store to simplify testing components consuming a Vuex store.

### `jest-matcher-vue-test-utils`

[`jest-matcher-vue-test-utils`](https://github.com/hmsk/jest-matcher-vue-test-utils) adds additional matchers for the Jest test runner with the goal of making assertions more expressive.


### `jest-mock-axios`

[`jest-mock-axios`](https://github.com/knee-cola/jest-mock-axios) allows you to easily mock `axios`, a common HTTP client, in your tests. It works out of the box with Jest, and the author provides guidance on supporting other test runners in the documentation.