-
Notifications
You must be signed in to change notification settings - Fork 19
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
Adding Plugins Guide #15
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good start. We need to add how to add types for the TS people.
I don’t think that’s necessary. I don’t think Vue docs go into typescript
at all in the examples
…On Sun, Apr 26, 2020 at 4:04 AM Dobromir Hristov ***@***.***> wrote:
***@***.**** commented on this pull request.
Overall good start. We need to add how to add types for the TS people.
------------------------------
In src/guide/plugins.md
<#15 (comment)>
:
> @@ -0,0 +1,80 @@
+## Plugins
+
+Plugins add global-level functionality to Vue Test Utils' API. This is the
+ official way to extend Vue Test Utils' API with custom logic, methods, or
+ functionality.
+
+ If you're missing a bit of functionality, consider writing a plugin to
+ extend Vue Test Utils' API.
+
+ Some use cases for plugins:
+ 1. Aliasing existing public methods
+ 1. Attaching matchers to the Wrapper instance
+ 1. Attaching functionality to the Wrapper or WrapperArray
We dont have WrapperArray any more.
------------------------------
In src/guide/plugins.md
<#15 (comment)>
:
> +
+ If you're missing a bit of functionality, consider writing a plugin to
+ extend Vue Test Utils' API.
+
+ Some use cases for plugins:
+ 1. Aliasing existing public methods
+ 1. Attaching matchers to the Wrapper instance
+ 1. Attaching functionality to the Wrapper or WrapperArray
+
+## Using a plugin
+
+Install plugins by calling the `config.plugins.VueWrapper.install()` method
+. This has to be done before you call `mount`.
+
+ The `install()` method will receive an instance of `WrapperAPI` containing both
+ public and private properties of the instance.
Not everyone uses Jest, I would explicitly state we are using Jest in
these examples. Mocha is still used allot though.
------------------------------
In src/guide/plugins.md
<#15 (comment)>
:
> +config.plugins.VueWrapper.install(MyPlugin)
+```
+
+You can optionally pass in some options:
+```js
+config.plugins.VueWrapper.install(MyPlugin, { someOption: true })
+```
+
+Your plugin should be installed once. In Jest this should be in your Jest
+ config's `setupFiles` or `setupFilesAfterEnv` file.
+
+Some plugins automatically call `config.plugins.VueWrapper.install()` when
+ they're imported. This is common if they're extending multiple interfaces at
+ once. Follow the instructions of the plugin you're installing.
+
+Check out [awesome-vue-test]() for a collection of community-contributed
We can probably put these in
https://vue-community.org/guide/ecosystem/testing.html
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#15 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVL4BEFSJNI5Z4V7ETBUXDROPTJ7ANCNFSM4MRDN56Q>
.
|
afontcu
reviewed
Apr 26, 2020
afontcu
reviewed
Apr 26, 2020
afontcu
reviewed
Apr 26, 2020
lmiller1990
reviewed
Apr 27, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Outstanding:
awesome-vue-test
contributed plugins (using the Testing section of awesome-vue)